dotnet-clean-arch

Implements .NET Clean Architecture features with aggregates, CQRS use cases, FastEndpoints, and EF Core.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/lurodrisilva/personal-skills --skill dotnet-clean-arch-lurodrisilva
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-clean-arch
Source: https://github.com/lurodrisilva/personal-skills/tree/main/coding/dotnet-hex-clean
Command: npx skills add https://github.com/lurodrisilva/personal-skills --skill dotnet-clean-arch-lurodrisilva

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building features in a .NET Clean Architecture solution requires coordinating many files across Core, UseCases, Infrastructure, and Web layers while respecting strict dependency rules; this Skill encodes the Ardalis template conventions so every aggregate, use case, and endpoint is implemented consistently without layering violations. ## Core Features & Use Cases - Domain Model Construction: Creates aggregate roots with private setters, Vogen strongly-typed IDs and value objects, SmartEnums, domain events, handlers, and specifications in the Core project. - CQRS Use Cases: Generates Mediator commands, queries, and handlers returning Result<T>, with repositories for writes and query services for read-optimized list endpoints. - FastEndpoints API Layer: Builds REPR-pattern endpoints with FluentValidation validators, mappers, and Result extension methods, plus EF Core configurations, DI registration, and migrations. - Use Case: When asked to add a new Contributor feature end-to-end, the Skill detects FULL_FEATURE mode and produces all 27 files in dependency order, from the Core aggregate through the EF migration, then verifies with a build checklist. ## Quick Start Ask the AI to add a new aggregate or feature to your Ardalis Clean Architecture project, for example: add a Product feature with create, get, list, update, and delete endpoints.

Frequently Asked Questions about dotnet-clean-arch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new feature to a .NET Clean Architecture project?▼

Adding a feature follows five phases: create the Core aggregate with Vogen IDs and value objects, add Mediator commands and queries in UseCases, build FastEndpoints in Web, configure EF Core and DI in Infrastructure, then run the verification checklist and dotnet build.

How to implement CQRS with Mediator in ASP.NET Core?▼

Define commands implementing ICommand<Result<T>> for mutations using IRepository<T>, and queries implementing IQuery<Result<T>> for reads using IReadRepository<T> or query services. Handlers return ValueTask and never throw exceptions for expected failures.

Should I use Vogen or a manual ValueObject base class in .NET?▼

Use Vogen [ValueObject<T>] when wrapping a single primitive like string or int, since it generates validation and conversions. Use a manual ValueObject base class with GetEqualityComponents for multi-property composites such as Address or PhoneNumber.

Can FastEndpoints access repositories directly in Clean Architecture?▼

No, endpoints must never access repositories directly. They send commands or queries through Mediator, convert value objects at the API boundary with VO.From(), and map results using Result extension methods like ToCreatedResult.

Why does my Core project reference break Clean Architecture rules?▼

Core must have zero infrastructure dependencies and may only reference approved NuGet packages like SharedKernel, Vogen, and Mediator.Abstractions. If Core needs an outer-layer capability, define an interface in Core/Interfaces and implement it in Infrastructure.