dotnet-clean-architecture

Enforce Clean Architecture, CQRS, and DI in layered .NET projects.

5|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/iamBrzDev/enterprise-agent-skills --skill dotnet-clean-architecture-iambrzdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-clean-architecture
Source: https://github.com/iamBrzDev/enterprise-agent-skills/tree/main/skills/dotnet-clean-architecture
Command: npx skills add https://github.com/iamBrzDev/enterprise-agent-skills --skill dotnet-clean-architecture-iambrzdev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps teams structure .NET or ASP.NET Core projects following Clean Architecture, CQRS, and DI patterns, reducing coupling and improving testability.

Core Features & Use Cases

  • Enforced 4-layer solution structure with inward dependencies
  • Guidance for Domain, Application, Infrastructure, and API boundaries
  • Guidance on scaffolding and refactoring of Commands, Queries, and Handlers in C# projects

Quick Start

Create a new feature by adding a Command and a corresponding Handler under the Application layer following the 4-layer Clean Architecture pattern.

Frequently Asked Questions about dotnet-clean-architecture

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

FAQPage Schema
How do I enforce Clean Architecture in a .NET project?

Clean Architecture in .NET uses a four-layer structure—Domain, Application, Infrastructure, and API—with dependencies pointing strictly inward. The Domain layer requires zero external dependencies to ensure decoupled, testable business logic.

How do I add a new feature using CQRS and MediatR in Clean Architecture?

To add a new feature using CQRS and MediatR, you create a Command and its corresponding Handler under the Application layer. This pattern separates read and write operations, reducing coupling and improving scalability across your .NET solution.

What is the correct dependency injection configuration for a Clean Architecture .NET app?

Correct dependency injection in a Clean Architecture .NET app requires registering MediatR handlers and infrastructure services at the API or Infrastructure layer. This setup ensures the Application and Domain layers remain decoupled from external concerns.

Can I refactor an existing ASP.NET Core solution to follow Clean Architecture boundaries?

Yes, you can refactor an existing ASP.NET Core solution by reorganizing code into Domain, Application, Infrastructure, and API boundaries. This process involves moving business logic inward and configuring proper dependency injection to satisfy architecture guidelines.

Does the Domain layer in Clean Architecture require MediatR or other external packages?

No, the Domain layer in Clean Architecture requires zero external dependencies. MediatR command and query handlers belong in the Application layer, ensuring the core business logic remains isolated and fully testable.