| name | orchardcore-module-creator |
| description | Creates new Orchard Core modules with proper structure, manifest, startup, and patterns. Use when the user needs to create a new module, add content parts, fields, drivers, handlers, or admin functionality. Use this skill when requests mention Orchard Core Module Creator, Prerequisites, Module Creation Workflow, Step 1 Determine Module Type, Step 2 Create Module Directory, Step 3 Create Required Files, or closely related Orchard Core implementation, setup, extension, or troubleshooting work. Strong matches include work with OrchardCore.Modules, OrchardCore.YourModule, OrchardCore.YourModule.csproj, OrchardCore.Cms.Web, OrchardCore.ModuleName, OrchardCore.Rating, OrchardCore.Module.Targets, OrchardCore.Module.Targets.csproj, OrchardCore.ContentManagement, OrchardCore.ContentManagement.csproj. It also helps with examples, module structure, patterns, Step 2 Create Module Directory, 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 Module Creator
This skill guides you through creating new Orchard Core modules following project conventions.
Prerequisites
- OrchardCore repository (working directory)
- .NET SDK 10.0+ installed
Module Creation Workflow
Step 1: Determine Module Type
What kind of module are you creating?
| Type | Description | Key Components |
|---|
| Content Part | Adds data/behavior to content items | Part, Driver, Views |
| Content Field | Custom field type | Field, Driver, Views |
| Settings | Site-wide configuration | SiteSettings, Driver |
| Admin Feature | Admin pages/tools | Controller, Views, Menu |
| API | REST endpoints | Minimal API endpoint class + Startup route registration |
| Background Task | Scheduled jobs | IBackgroundTask |
Step 2: Create Module Directory
mkdir src/OrchardCore.Modules/OrchardCore.YourModule
cd src/OrchardCore.Modules/OrchardCore.YourModule
Step 3: Create Required Files
Every module needs these three files:
- Manifest.cs - Module metadata
- Startup.cs - Service registration
- OrchardCore.YourModule.csproj - Project file
See references/module-structure.md for templates.
Step 4: Add Components Based on Type
For Content Part modules:
Models/YourPart.cs
ViewModels/YourPartViewModel.cs
Drivers/YourPartDisplayDriver.cs
Views/YourPart.cshtml
Views/YourPart_Edit.cshtml
For Admin modules:
Controllers/AdminController.cs
Views/Admin/Index.cshtml
AdminMenu.cs
PermissionProvider.cs
For Data-storing modules:
Migrations.cs
Indexes/YourIndex.cs
See references/patterns.md for code templates.
Step 5: Register in Startup.cs
public override void ConfigureServices(IServiceCollection services)
{
services.AddContentPart<YourPart>()
.UseDisplayDriver<YourPartDisplayDriver>();
services.AddScoped<IYourService, YourService>();
services.AddDataMigration<Migrations>();
services.AddPermissionProvider<PermissionProvider>();
services.AddNavigationProvider<AdminMenu>();
}
JSON API Endpoints
When a module exposes an endpoint that primarily returns JSON, prefer Orchard Core Minimal APIs over MVC ApiController classes.
Recommended pattern:
public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
{
routes.AddGetWeatherEndpoint();
}
internal static class GetWeatherEndpoint
{
public static IEndpointRouteBuilder AddGetWeatherEndpoint(this IEndpointRouteBuilder builder)
{
_ = builder.MapGet("api/weather", HandleAsync)
.RequireAuthorization()
.DisableAntiforgery();
return builder;
}
private static Task<IResult> HandleAsync()
=> Task.FromResult<IResult>(TypedResults.Ok(new { ok = true }));
}
Use MVC controllers for HTML/admin pages; use Minimal APIs for lightweight JSON endpoints.
Step 6: Build and Test
cd /path/to/orchardcore
dotnet build src/OrchardCore.Modules/OrchardCore.YourModule
cd src/OrchardCore.Cms.Web
dotnet run -f net10.0
Quick Reference
Naming Conventions
| Item | Convention | Example |
|---|
| Module folder | OrchardCore.ModuleName | OrchardCore.Rating |
| Namespace | OrchardCore.ModuleName | OrchardCore.Rating |
| Feature ID | OrchardCore.ModuleName | OrchardCore.Rating |
| Content Part | NamePart | RatingPart |
| Driver | NamePartDisplayDriver | RatingPartDisplayDriver |
| View | PartName.cshtml | RatingPart.cshtml |
| Edit View | PartName_Edit.cshtml | RatingPart_Edit.cshtml |
Common Dependencies
Add to .csproj as needed:
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Module.Targets\OrchardCore.Module.Targets.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.ContentManagement\OrchardCore.ContentManagement.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Admin\OrchardCore.Admin.csproj" />
Feature Categories
Use in Manifest.cs:
Content Management
Content
Navigation
Security
Infrastructure
Theming
Developer
References
references/module-structure.md - Directory layout and file templates
references/patterns.md - Code patterns (parts, drivers, handlers, etc.)
references/examples.md - Complete module examples
AGENTS.md (repo root) - Coding conventions and build commands