skills/dotnet/generators/create-clean-module/SKILL.md
Generate a new business module following Clean Architecture, CQRS, and DDD principles with UseCase-driven and Model-driven separation. Use when: - Creating a new business module in Clean Architecture project - Generating module structure with CQRS separation - Scaffolding DDD aggregates and value objects - Setting up module with proper layer organization - Adding new bounded context to existing system Triggers: "create module", "generate module", "new module", "scaffold module", "module structure"
npx skillsauth add yeeehaooo/WorkSpace create-clean-moduleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create a new business module following Clean Architecture, CQRS, and DDD principles with UseCase-driven and Model-driven separation.
Applies to:
Behavior Layer (UseCase-driven):
Model Layer (Model-driven):
API Layer:
API/Modules/{ModuleName}/{Action}/
├── {Action}Endpoint.cs
├── {Action}Request.cs
├── {Action}Response.cs
└── {Action}Mapper.cs
Application Layer:
Application/Modules/{ModuleName}/
├── Commands/{Action}/
│ ├── {Action}Command.cs
│ ├── {Action}Handler.cs
│ └── {Action}Result.cs
└── Queries/{Action}/
├── {Action}Query.cs
├── {Action}Handler.cs
└── {Action}Result.cs
Domain Layer:
Domain/Modules/{ModuleName}/
├── Aggregates/{Entity}/
│ ├── {Entity}.cs
│ ├── I{Entity}Repository.cs
│ └── {Entity}DomainService.cs
├── ValueObjects/
└── DomainEvents/
Infrastructure Layer:
Infrastructure/Modules/{ModuleName}/
└── Persistence/{Entity}/
├── {Entity}Repository.cs
├── {Entity}DataModel.cs
├── {Entity}Configuration.cs
└── {Entity}Mapper.cs
API:
public class LoginRequest
{
public string Username { get; set; }
public string Password { get; set; }
}
public class LoginResponse
{
public string Token { get; set; }
public DateTime ExpiresAt { get; set; }
}
public class LoginEndpoint : IEndpoint
{
public void MapEndpoint(IEndpointRouteBuilder app)
{
app.MapPost("/auth/login", HandleAsync)
.WithName("Login")
.Produces<LoginResponse>();
}
private async Task<IResult> HandleAsync(LoginRequest request, IMediator mediator)
{
var command = new LoginCommand(request.Username, request.Password);
var result = await mediator.Send(command);
return Results.Ok(result);
}
}
Application:
public record LoginCommand(string Username, string Password);
public class LoginHandler : ICommandHandler<LoginCommand, LoginResult>
{
private readonly IUserRepository _userRepo;
private readonly ITokenService _tokenService;
public async Task<LoginResult> Handle(LoginCommand command, CancellationToken ct)
{
var user = await _userRepo.FindByUsernameAsync(command.Username, ct);
if (user == null || !user.VerifyPassword(command.Password))
{
return LoginResult.Failed("Invalid credentials");
}
var token = _tokenService.GenerateToken(user);
return LoginResult.Success(token);
}
}
Domain:
public class User : AggregateRoot
{
public Guid Id { get; private set; }
public string Username { get; private set; }
public string PasswordHash { get; private set; }
public bool VerifyPassword(string password)
{
return BCrypt.Net.BCrypt.Verify(password, PasswordHash);
}
}
When generating a module, specify:
development
Create reusable .NET atomic capability code snippets that can be directly copied and pasted. Use when: - Creating single-purpose code snippets - Building reusable code templates - Implementing atomic technical capabilities - Creating copy-pasteable code blocks - Building snippet library for common patterns Triggers: "create snippet", "code snippet", "reusable snippet", "atomic snippet", "copy-paste code"
development
Create Docker Compose configuration for containerized .NET application development and deployment. Use when: - Containerizing .NET applications - Setting up local development environment with dependencies - Creating multi-container setups (API + DB + Redis) - Defining service dependencies and networking - Building docker-compose.yml for development or production Triggers: "docker compose", "containerize", "multi-container", "docker-compose.yml", "docker setup"
tools
Create adapter structure for integrating third-party APIs in Clean Architecture applications. Use when: - Integrating external APIs or services - Creating HTTP client adapters for third-party services - Implementing API integration with error handling - Setting up adapter pattern for external dependencies - Building resilient external service integrations Triggers: "api adapter", "third-party api", "external service", "http client adapter", "api integration"
development
Enterprise backend structure built on Clean Architecture, DDD, CQRS, and Vertical Slice API Design with Dapper-first persistence. Use when: - Creating new enterprise backend projects - Implementing Clean Architecture with DDD and CQRS - Building vertical slice API endpoints - Using Dapper as primary persistence mechanism - Organizing modules by UseCase-driven and Model-driven separation Triggers: "dmis structure", "clean architecture", "enterprise backend", "DDD CQRS", "vertical slice", "dapper"