clean-architecture

Structure .NET applications into Domain, Application, Infrastructure, and Api layers.

1|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/Maj3D10/Training-Platform --skill clean-architecture-maj3d10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/Maj3D10/Training-Platform/tree/main/.agent/skills/clean-architecture
Command: npx skills add https://github.com/Maj3D10/Training-Platform --skill clean-architecture-maj3d10

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Clean Architecture helps you avoid tightly coupled codebases where business rules, infrastructure concerns, and API wiring become entangled, making changes risky and refactors expensive.

Core Features & Use Cases

  • Dependency inversion by design: Enforces inward dependencies so the Domain layer stays framework-agnostic and stable.
  • Domain owns behavior: Encapsulates business rules in entities and domain logic instead of scattering them across handlers or endpoints.
  • Use cases as unit of work: Implements commands/queries as focused Application handlers that coordinate domain objects and persistence.
  • Infrastructure as a plugin: Keeps EF Core, external services, and persistence implementations behind abstractions so you can swap providers safely.
  • Thin API layer: Maps HTTP to use cases and returns responses without embedding business logic.

Quick Start

Load this skill when you are building a .NET application and want to structure Domain, Application, Infrastructure, and Api projects using dependency inversion and use-case handlers.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I structure a .NET application using clean architecture and domain-driven design?

Structure your .NET application using a 4-project layout: Domain, Application, Infrastructure, and Api. This clean architecture separates domain rules from infrastructure and delivery concerns, enforcing dependency inversion so the Domain layer stays framework-agnostic and stable.

What is the best way to keep EF Core persistence logic separate from business rules in dotnet?

Keep EF Core persistence implementations behind Application and Domain abstractions. This clean architecture pattern treats infrastructure as a plugin, keeping external services and persistence implementations isolated so you can swap providers safely without affecting business rules.

How do I organize use case handlers in a clean architecture .NET project?

Implement use cases as focused Application handlers that coordinate domain objects and persistence. This clean architecture approach treats commands and queries as single handlers, acting as a unit of work to map HTTP requests to use cases without embedding business logic in the API layer.

Can I use minimal-api style endpoints with a clean architecture .NET solution?

Yes, this clean architecture supports minimal-api style endpoint wiring. The thin API layer maps HTTP to use cases and returns responses directly, relying on Application handlers to coordinate domain behavior and persistence without embedding business logic in the endpoints.

Why does my domain layer depend on infrastructure packages in my dotnet clean architecture project?

Your domain layer likely lacks strict dependency inversion. Clean architecture enforces inward dependencies so the Domain layer stays framework-agnostic; infrastructure implementations must sit behind abstractions defined in the Application or Domain layers to prevent this coupling.

Do I need a mediator pattern to implement clean architecture in dotnet?

Using a mediator pattern aligns with this clean architecture approach by routing commands and queries to focused use case handlers. This keeps the Application layer organized and ensures infrastructure implementations remain hidden behind Application and Domain abstractions.