--- name: orchardcore-modules description: Skill for creating and structuring Orchard Core modules. Covers module scaffolding, feature registration, dependency management, startup configuration, and manifest conventions. Use this skill when requests mention Orchard Core Modules, Create a Module, Installing Third-Party Modules, Manifest Pattern, Startup Pattern, Project File Pattern, or closely related Orchard Core implementation, setup, extension, or troubleshooting work. Strong matches include work with OrchardCore.Application.Cms.Targets, OrchardCore.Modules.Manifest, OrchardCore.ContentManagement, OrchardCore.Modules, OrchardCore.Module.Targets, IServiceCollection, Manifest.cs, [RequireFeatures]. It also helps with module examples, Startup Pattern, Project File Pattern, Module Folder Structure, plus the code patterns, admin flows, recipe steps, and referenced examples captured in this skill. license: Apache-2.0 metadata: author: CrestApps Team version: "1.0" --- # Orchard Core Modules - Prompt Templates ## Create a Module You are an Orchard Core expert. Generate the scaffolding for a new Orchard Core module. ### Guidelines - Module names should be PascalCase and typically prefixed with the organization name (e.g., `MyOrg.MyModule`). - Every module must have a `Manifest.cs` file declaring its features. - Each feature must have a unique ID and should declare its dependencies. - Use `Startup` classes to register services, routes, and navigation. - Follow the Orchard Core convention of placing migrations in a `Migrations` folder or file. - Use `[RequireFeatures]` attribute when a service depends on an optional feature. - Third-party modules (CrestApps, Lombiq, or any non-OrchardCore-direct modules) must be installed as NuGet packages or project references in the **web project** (the startup project of the solution), not just in the module project. - Always seal classes. ### Installing Third-Party Modules Third-party modules are installed by adding NuGet packages or project references to the web project: ```xml ``` For local module projects: ```xml ``` ### Manifest Pattern ```csharp using OrchardCore.Modules.Manifest; [assembly: Module( Name = "{{ModuleName}}", Author = "{{Author}}", Website = "{{Website}}", Version = "1.0.0", Description = "{{Description}}", Category = "{{Category}}" )] [assembly: Feature( Id = "{{ModuleName}}", Name = "{{FeatureName}}", Description = "{{FeatureDescription}}", Dependencies = new[] { "OrchardCore.ContentManagement" }, Category = "{{Category}}" )] ``` ### Startup Pattern ```csharp using Microsoft.Extensions.DependencyInjection; using OrchardCore.Modules; namespace {{ModuleName}} { public sealed class Startup : StartupBase { public override void ConfigureServices(IServiceCollection services) { // Register services here } } } ``` ### Project File Pattern ```xml net10.0 true ``` ### Module Folder Structure ``` MyModule/ ├── Manifest.cs ├── Startup.cs ├── MyModule.csproj ├── Controllers/ ├── Drivers/ ├── Handlers/ ├── Migrations/ ├── Models/ ├── Services/ ├── ViewModels/ ├── Views/ └── wwwroot/ ```