Individual skill

orchardcore-deferred-tasks

Skill for running fire-and-forget work after a request in Orchard Core using HttpBackgroundJob.ExecuteAfterEndOfRequestAsync and ShellScope.AddDeferredTask. Covers deferring work until the YesSql session is committed, running in a fresh isolated ShellScope, restoring the current user, deferred signals, IDocumentStore.AfterCommitSuccess, the IOptionsUpdateNotifier post-commit options refresh, and choosing between deferred tasks, after-request jobs and background tasks. Use this skill when requests mention Orchard Core HttpBackgroundJob, ExecuteAfterEndOfRequestAsync, ShellScope.AddDeferredTask, AddDeferredSignal, RegisterBeforeDispose, running code after the session is saved, or closely related Orchard Core troubleshooting work. Strong matches include OrchardCore.BackgroundJobs, OrchardCore.Environment.Shell.Scope, ShellScope, IShellHost, IDocumentStore, ISignal, IHttpContextAccessor.

src/CrestApps.AgentSkills/orchardcore/orchardcore-deferred-tasks/SKILL.md

Read pinned source

Source commit d86d04f234b1b2bd8145368a2544490f9d557596

What was checked

Matches the observed repository HEAD
Yes
Scanner rules are current
Yes
Repository scan complete
No
Skill scan complete
Yes
Observed behavior
Instructions only
Last checked
Nov 6, 2026

These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.

Install this skill

Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.

An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.

Repository context

Repository stars (not skill ratings)
13
Repository last updated
Oct 21, 2026
License
MIT

Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.

Files and excerpt

File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.

Browse files
Read excerpt

# Orchard Core Deferred Tasks and After-Request Background Jobs

Orchard Core provides two complementary ways to run code *after* the main work
of a request, without adding a scheduled `IBackgroundTask`. Both live in the
`OrchardCore.Abstractions` package, so any module can use them.

- `ShellScope.AddDeferredTask` — runs a delegate in a **fresh isolated scope**
  once the current shell scope tears down, **after the YesSql session has been
  committed**. Use it to react to committed data (indexing, cache busting,
  sending a signal) and to see your own just-saved changes.
- `HttpBackgroundJob.ExecuteAfterEndOfRequestAsync` — truly **fire-and-forget**.
  It returns immediately, waits for the current `HttpContext` to be released
  (end of the HTTP response), reloads the shell, restores the current user, and
  runs the job in an isolated scope. Use it for longer work you do not want the