← ClaudeAtlas

dotnet-corelisted

Apply these opinionated .NET 8 architecture conventions whenever structuring or reviewing a backend service: clean architecture layering and which direction dependencies point, when CQRS with MediatR is worth it, cross-cutting concerns as pipeline behaviours, minimal APIs grouped by feature, keeping DbContext in Infrastructure, health checks and structured logging, WebApplicationFactory integration tests, and when AOT pays off.
alexander-danilenko/cortex-ai-skills · ★ 15 · DevOps & Infrastructure · score 78
Install: claude install-skill alexander-danilenko/cortex-ai-skills
# .NET Core Architecture House architecture conventions for .NET 8 backend services. This covers how a service is _structured_; for language-level conventions see the `csharp` skill. ## Layering Dependencies point inward only. Domain knows nothing about anything else, and Infrastructure is the one layer allowed to reference a database or an SDK — which is what lets the inner layers be tested without either. ```text Domain entities, value objects, domain events, interfaces → no dependencies Application use cases, CQRS handlers, DTOs, validators → Domain Infrastructure EF Core, external APIs, implementations of Domain interfaces → Domain + Application Api endpoints, DI wiring, middleware → all of the above ``` The test that keeps this honest: if `Domain` compiles with no package references beyond the BCL, the boundary is intact. Entities enforce their own invariants: private setters, a private parameterless constructor for EF Core's materialiser, and a static factory that validates. Public setters mean any layer can put the entity into an invalid state, and then "the domain guarantees X" is just a comment. ```csharp public class Product { public string Name { get; private set; } = string.Empty; public decimal Price { get; private set; } private Product() { } // EF Core materialisation only public static Product Create(string name, decimal price) => price <= 0 ? throw new DomainEx