clean-architecture

Validate .NET project references and DI registrations against clean architecture layer rules.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents .NET projects from drifting into tangled dependencies by defining strict, enforceable clean-architecture layer boundaries and DI wiring patterns.

Core Features & Use Cases

  • Layer rule reference: Specifies what belongs in Domain, Application, Infrastructure, API/Web, and Tests, including allowed and forbidden package categories.
  • Dependency direction validation: Defines which project references are allowed (e.g., Application → Domain only) and which are forbidden (e.g., Domain referencing higher layers).
  • DI registration pattern guidance: Establishes where each registration should happen so composition root responsibilities stay in the API project.
  • Use case: When onboarding a new feature, you can apply these rules to ensure its projects, references, and service registrations follow the same architectural boundaries as the rest of your codebase.

Quick Start

Ask an agent to verify that your Domain project contains no project references and that your Application references only the Domain project, then confirm the DI composition root is wired only from the API project.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I enforce clean architecture boundaries in a .NET solution?

Enforce clean architecture in .NET by validating layer contents, dependency directions, and DI composition rules. This checks .csproj project references and package allowances per layer to prevent tangled dependencies and keep projects aligned over time.

What is the correct dependency direction for .NET clean architecture projects?

Correct .NET clean architecture dependency direction allows the Application project to reference Domain only, while strictly forbidding Domain from referencing higher layers like Infrastructure or API to maintain architectural boundaries.

How do I validate Dependency Injection registration placement in clean architecture?

Validate DI registration placement in clean architecture by establishing that service registrations happen at the composition root. Ensure Infrastructure implementations are wired consistently with Application interfaces only from the API project.

Can I check which NuGet packages are allowed in each clean architecture layer?

You can check allowed and forbidden packages per clean architecture layer by applying layer rule references. This validates package categories per layer, ensuring Domain, Application, Infrastructure, and API projects contain only permitted dependencies.

Does this clean architecture enforcement work with automated codebase reviews?

Clean architecture enforcement works with automated codebase reviews and planner-driven scaffolding. It applies architectural checks to .NET solutions, validating project references and DI composition rules to keep projects aligned over time.