Individual skill

orchardcore-startup-code

Skill for running initialization code on tenant startup in Orchard Core. Covers IModularTenantEvents and ModularTenantEvents, the ActivatingAsync, ActivatedAsync, TerminatingAsync, TerminatedAsync and RemovingAsync hooks, tenant lazy-loading and the BackgroundService ShellWarmup setting, uninitialized tenant checks, preloading data for synchronous access, RequiredStartup components, and module initialization best practices. Use this skill when requests mention Orchard Core Startup Code, Run Code on Tenant Startup, Registering a Startup Task, Seeding Default Data on Tenant Start, warming up tenants, or closely related Orchard Core implementation or troubleshooting work. Strong matches include OrchardCore.Modules, IModularTenantEvents, ModularTenantEvents, ShellSettings, IsUninitialized, ShellScope, IContentManager, ILogger.

plugins/orchardcore/skills/orchardcore-startup-code/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 Startup Code - Prompt Templates

## Run Code on Tenant Startup

You are an Orchard Core expert. Generate code for running initialization tasks when a tenant starts, using the `IModularTenantEvents` interface and `ModularTenantEvents` base class.

### Guidelines

- Implement `IModularTenantEvents` or inherit from `ModularTenantEvents` to run code on tenant activation.
- `ActivatingAsync` is called when a tenant is first hit (lazy-loaded) — use it for initialization logic.
- `ActivatedAsync` is called after all `ActivatingAsync` handlers have completed — use it for post-initialization logic.
- Tenants are **lazy-loaded**: event handlers are NOT invoked at application start — they run on the first request to the tenant, and again each time the shell is rebuilt (after a feature change or a shell release). Set `OrchardCore:BackgroundService:ShellWarmup` to `true` to build shells at startup (the 3.x section name was `OrchardCore_BackgroundService`).
- Handlers also run for **uninitialized** tenants (not set up yet), where `ISession`, `ISiteService` and content services cannot be used; check `ShellSettings.IsUninitialized()` first.
- `ActivatingAsync` events are invoked in module dependency order (based on the module dependency graph).