← ClaudeAtlas

clean-architecture-dotnetlisted

Use when laying out or extending a .NET / ASP.NET Core solution — which project a class belongs in, which project may reference which, and how an endpoint reaches a use case.
SebastienDegodez/skraft-plugin · ★ 14 · AI & Automation · score 70
Install: claude install-skill SebastienDegodez/skraft-plugin
# Clean Architecture — .NET / ASP.NET Core The layer rules are those of `architecture-patterns`. This skill maps them onto .NET projects. ## One project per layer | Project | Holds | Only `<ProjectReference>` to | |---|---|---| | `<Context>.Domain` | aggregates, value objects, domain events | nothing | | `<Context>.Application` | use cases and the interfaces they call | `<Context>.Domain` | | `<Context>.Infrastructure` | implementations of those interfaces, DI registration (`AddInfrastructure()`) | `<Context>.Application` | | `<Context>.Api` | endpoints, `Program.cs` | `<Context>.Infrastructure` | - Inside each project, one folder per feature (`Application/Loans/BorrowBookUseCase.cs`, `Infrastructure/Loans/SqlLoanRepository.cs`), never a technical one (`Persistence`, `Repositories`, `Services`). The `DbContext` and `DependencyInjection.cs` stay at the project root. A feature uses no other feature's Application namespace; what two features use moves to a `Shared` folder. - Use types reached transitively; never add a `<ProjectReference>` to reach them. - EF Core, ASP.NET Core and `HttpClient` appear only in Infrastructure and Api. Domain uses nothing beyond the BCL. - Tests live in the test projects `clean-architecture-testing` defines, never in a layer project. - `node "<skill>/scripts/init-project.mjs" <Context>`, run from the repository root, creates this layout (`<skill>` is this skill's folder). ## Use cases - A use case is a `sealed` class in Application named `*Use