add-module
/add-module
Creates a new module in this solution with its project, database schema, registration, migrations resource and test project, and its contracts project once another module needs one. Use when asked for a new module or bounded context, including in a solution that has no modules yet.
- Author
- Q-Sharp ↗
- Repository
- CloudGround ↗
- Licence
- MIT
- Last repository change
- 01.11.2026
Assessment and security
- Files in this package
- 9
- Scripts
- 6
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 01.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 6 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: src/Modules/CloudGround.App.Modules.ModuleName/GlobalUsings.cs, src/Modules/CloudGround.App.Modules.ModuleName/ModuleNameModule.cs, src/Modules/CloudGround.App.Modules.ModuleName/ModuleNamePolicies.cs, src/Modules/CloudGround.App.Modules.ModuleName/Persistence/ModuleNameDbContext.cs, tests/CloudGround.App.Modules.ModuleName.Tests/GlobalUsings.cs, tests/CloudGround.App.Modules.ModuleName.Tests/Modu
What it does and when to use it
Creates a new module in this solution with its project, database schema, registration, migrations resource and test project, and its contracts project once another module needs one. Use when asked for a new module or bounded context, including in a solution that has no modules yet.
Original author description
Creates a new module in this solution with its project, database schema, registration, migrations resource and test project, and its contracts project once another module needs one. Use when asked for a new module or bounded context, including in a solution that has no modules yet.
How it works
- Steps
- Contracts
- What the copied files contain
- Rules
SKILL.md preview
---
name: add-module
description: Creates a new module in this solution with its project, database schema, registration, migrations resource and test project, and its contracts project once another module needs one. Use when asked for a new module or bounded context, including in a solution that has no modules yet.
---
# Add a module
A module is a class library under `src/Modules/` that owns its endpoints, handlers, persistence and
its own PostgreSQL schema. Other modules reach it only through its contracts project. The
architecture tests in `tests/CloudGround.App.Architecture.Tests` enforce this for every module they
find, and the AppHost model tests in `tests/CloudGround.App.Integration.Tests` check that every
module applies its migrations before the API starts.
## Steps
1. Choose the module name in PascalCase, for example `OrderHistory`. Its lowercase form,
`orderhistory`, names the database schema, the route prefix `/api/orderhistory` and the AppHost
resource `orderhistory-migrations`.
2. Copy the folders `src/` and `tests/` of this skill, `.claude/skills/add-module/src/` and
`.claude/skills/add-module/tests/`, to the solution root. Replace `ModuleName` with the module
name and `modulename` with its lowercase form, in folder names, file names and file contents.
3. Add both projects to the solution and reference the module from the API:
```bash
dotnet sln add src/Modules/CloudGround.App.Modules.<Module>/CloudGround.App.Modules.<Module>.csproj \
tests/CloudGround.App.Modules.<Module>.Tests/CloudGround.App.Modules.<Module>.Tests.csproj
dotnet reference add src/Modules/CloudGround.App.Modules.<Module>/CloudGround.App.Modules.<Module>.csproj \
--project src/CloudGround.App.Api/CloudGround.App.Api.csproj
```
4. Register the module in the API: add `global using CloudGround.App.Modules.<Module>;` to
`src/CloudGround.App.Api/GlobalUsings.cs`, then in `src/CloudGround.App.Api/Program.cs` call
`builder.Add<Module>Module();` after the other `builder.Add…` calls, and
`app.Map<Module>Module();` after `app.MapDefaultEndpoints();` and the other modules'
`Map…Module()` calls.
5. Apply its migrations before the API starts: in `src/CloudGround.App.AppHost/AppHost.cs`, add
`api.WithModuleMigrations("<Module>", database);` before `builder.TagImagesWithVersion();`.
Modules migrate one after another, in the order of these calls.
6. Build and test:
```bash
dotnet build
dotnet format --verify-no-changes
dotnet test --solution CloudGround.App.slnx --filter-not-trait Category=EndToEnd
```
The new module has no entities and no migrations yet. Add its first feature with the add-feature
skill in `.claude/skills/add-feature/SKILL.md`, which also creates the first migration.
## Contracts
A module that offers something to other modules gets a contracts project. Create it when another
module first needs it:
1. Create `src/Modules/CloudGround.App.Modules.<Module>.Contracts/CloudGround.App.Modules.<Module>.Contracts.csproj`
with this content and nothing else:
```xml
<Project Sdk="Microsoft.NET.Sdk">
</Project>
```
2. Add it to the solution, and reference it from the module and from every module that uses it:
```bash
dotnet sln add src/Modules/CloudGround.App.Modules.<Module>.Contracts/CloudGround.App.Modules.<Module>.Contracts.csproj
dotnet reference add src/Modules/CloudGround.App.Modules.<Module>.Contracts/CloudGround.App.Modules.<Module>.Contracts.csproj \
--project src/Modules/CloudGround.App.Modules.<Module>/CloudGround.App.Modules.<Module>.csproj
```
3. Put the public interfaces and integration events there. Other modules never reference the module
itself, and contracts depend on no module, ASP.NET Core, EF Core or Wolverine.
4. Add a `GlobalUsings.cs` at the root of the contracts project together with its first C# file,
even if it stays empty; the project has none until then.
## What the copied files contain
- `CloudGround.App.Modules.<Module>`: the module class with `Add<Module>Module`, which registers the
module's `DbContext` on the `database` connection with its migrations history in the module's
schema, the `Edit` policy that requires the `editor` realm role, and validation, and with
`Map<Module>Module`, which maps the endpoint group `/api/<module>`. `<Module>Policies` holds the
policy name and the role, `Persistence/<Module>DbContext` the schema.
- `CloudGround.App.Modules.<Module>.Tests`: the module's unit tests, starting with one that pins the
edit policy.
- `GlobalUsings.cs` in both projects: all their namespace imports.
## Rules
- Everything in the module is `internal` except the module class, the request types of its
endpoints and the Wolverine handlers in its `Messaging` namespace.
- The module talks to another module only through that module's contracts project: synchronously
through a contract interface, asynchronously through an integration event (see "Add an
integration event" in `README.md`).
- The schema is the lowercase module name; the architecture tests compare them.
- Namespace imports follow the `GlobalUsings.cs` rule under "Code" in `AGENTS.md`.
Files in this package (9)
- SKILL.md 5 KB
- src/Modules/CloudGround.App.Modules.ModuleName/CloudGround.App.Modules.ModuleName.csproj 1 KB
- src/Modules/CloudGround.App.Modules.ModuleName/GlobalUsings.cs 1 KB
- src/Modules/CloudGround.App.Modules.ModuleName/ModuleNameModule.cs 1 KB
- src/Modules/CloudGround.App.Modules.ModuleName/ModuleNamePolicies.cs 1 KB
- src/Modules/CloudGround.App.Modules.ModuleName/Persistence/ModuleNameDbContext.cs 1 KB
- tests/CloudGround.App.Modules.ModuleName.Tests/CloudGround.App.Modules.ModuleName.Tests.csproj 1 KB
- tests/CloudGround.App.Modules.ModuleName.Tests/GlobalUsings.cs 1 KB
- tests/CloudGround.App.Modules.ModuleName.Tests/ModuleNameModuleTests.cs 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · Q-Sharp/CloudGround | 100 | MIT |
| TurbineKit/turbinekit | 100 | MIT |
| fullstackhero/dotnet-starter-kit | 100 | MIT |
| a-pavithraa/springboot-skills-marketplace | 96 | MIT |
Database snapshot: 13.11.2026 · package version 37b497bdf4ad (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100magento-module-dev
Create Magento 2 custom modules — registration, directory structure, models, resource models, collections, declarative schema, and data/schema patches. Use when building new modules or understanding module architecture. - 86add-resource
Add a REST resource to this NestJS API end to end, as a feature module with its controller, service, DTOs, unit spec and contract tests. Use when asked for a new resource, endpoint, route or feature module. - 95module-scaffold
Use when creating a brand new module file in modules/ for a new tool category. Generates the boilerplate with correct array prefix, install_module_<name>() function, and ensures it integrates with install.sh, profiles, and MCP server. Triggers on "new module", "add a module for… - 100core-add-module
Add a new module to the core package (src/packages/core/). Use when adding shared UI framework infrastructure that all packages can use — e.g., a new extension system feature, a new utility, a new shared component pattern, a new picker, or a new workspace primitive. Core modules… - 100create-module
Create a new NestJS module with repository, service, controller, schema, and Drizzle table definition. Use when adding new feature modules, API endpoints, or business domains. - 100module
What a LangWatch module is and how to start one: the four packages (contract, process, browser, client), modules/catalogue.json, pnpm generate:modules, the specs/ and adrs/ folders, the dependency direction between halves, and what another module may import. Use when someone…