clean-architecture

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

Updated Apr 27, 2026
One-click install
npx skills add https://github.com/shahdanish/vibepos --skill clean-architecture-shahdanish
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/shahdanish/vibepos/tree/main/skills/clean-architecture
Command: npx skills add https://github.com/shahdanish/vibepos --skill clean-architecture-shahdanish

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Clean Architecture prevents tangled dependencies and keeps business rules isolated from frameworks, making your .NET codebase easier to scale, test, and evolve.

Core Features & Use Cases

  • Dependency inversion across layers: Enforces that Domain depends on nothing external, while Infrastructure and Api depend on abstractions.
  • Use case-centric organization: Models commands and queries as dedicated Application handlers with validation and orchestration.
  • Domain-first behavior: Encapsulates invariants and business rules inside entities (and supporting domain patterns) rather than spreading logic across endpoints.
  • Infrastructure as a swappable plugin: Moves EF Core, external services, and persistence implementations behind interfaces so you can replace technologies without rewriting business logic.
  • Thin API endpoints: Routes HTTP requests directly to use cases, keeping endpoints free of business logic.

Quick Start

Load this skill when you are structuring a new .NET application and want to define Domain, Application, Infrastructure, and Api layers that communicate through use cases and dependency inversion.

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 Web API project using clean architecture layers?

Structure a .NET Web API project by separating Domain rules, Application use case handlers, Infrastructure implementations, and API endpoints. This clean architecture isolates business logic from frameworks like EF Core, making the codebase easier to scale and test.

What is the best way to keep EF Core persistence from leaking into my domain layer?

The best way to prevent EF Core persistence from leaking into your domain layer is using dependency inversion. Move EF Core implementations behind interfaces in the Infrastructure layer, ensuring the Domain depends on nothing external.

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

Organize use case handlers in a clean architecture .NET application by modeling commands and queries as dedicated Application layer handlers. These handlers manage validation and orchestration, keeping API endpoints thin and free of business logic.

Where should I encapsulate business rules and domain entity behavior in clean architecture?

Encapsulate business rules and domain entity behavior inside the Domain layer. This domain-first approach keeps invariants protected within entities rather than spreading logic across API endpoints or infrastructure implementations.

Can I swap out EF Core for a different database technology without rewriting business logic?

Yes, you can swap EF Core for a different database technology without rewriting business logic by treating Infrastructure as a swappable plugin. Implement persistence behind DbContext abstractions or interfaces so technologies can be replaced cleanly.

Why does dependency inversion matter when designing maintainable .NET apps?

Dependency inversion matters when designing maintainable .NET apps because it prevents tangled dependencies. It enforces that Infrastructure and API depend on abstractions, allowing you to evolve and scale the codebase without touching core domain rules.