clean-architecture

Enforce layered architecture dependency rules across Domain, Application, Infrastructure, and Api.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/bbolek-ap/new-ai-native --skill clean-architecture-bbolek-ap
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/bbolek-ap/new-ai-native/tree/main/.claude/skills/clean-architecture
Command: npx skills add https://github.com/bbolek-ap/new-ai-native --skill clean-architecture-bbolek-ap

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use when creating or modifying service layers (Domain → Application → Infrastructure → Api). Describes the dependency rules, per-layer responsibilities. Load from Solution Spec Writer, Execution Planner, and Implementation agents whenever a feature adds or modifies code in any service layer.

Core Features & Use Cases

  • Layer sequence enforcement: Domain → (no dependencies); Application → Domain; Infrastructure → Application, Domain; Api → Application, Domain, Infrastructure.
  • Layer responsibilities: Domain (rich domain model, no framework), Application (handlers, validators, DTOs, interfaces), Infrastructure (EF Core, repositories, external clients, DI module), Api (minimal endpoints, module composition, program bootstrap).
  • Use Case: Ensure features are implemented within the correct layer boundaries to prevent cross-layer leakage.

Quick Start

Review the layer rules and apply them to new or modified service components using the Solution Spec Writer and Execution Planner.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I enforce layered architecture rules to prevent cross-layer coupling?

Enforce layered architecture by verifying dependencies follow permitted paths: Domain has none, Application depends on Domain, Infrastructure on both, and Api on all lower layers. This prevents cross-layer coupling during feature development and code placement.

What are the dependency rules for domain and application layers in clean architecture?

Clean architecture dependency rules state the Domain layer has zero dependencies, while the Application layer depends solely on the Domain layer. This ensures handlers, validators, and DTOs remain decoupled from infrastructure frameworks.

How do I ensure features are implemented within correct layer boundaries?

To ensure features are implemented within correct layer boundaries, apply governance rules during feature development to verify dependencies follow permitted paths and match layer responsibilities like rich domain models or repository implementations.

Does clean architecture allow the domain layer to depend on infrastructure frameworks?

Clean architecture does not allow the domain layer to depend on infrastructure frameworks. The domain layer must contain a rich domain model with no framework dependencies, keeping infrastructure concerns isolated in external clients and DI modules.

What is the best way to structure service layers when adding new features?

The best way to structure service layers is using Solution Spec Writer and Execution Planner to load governance rules. This verifies new features follow the Domain, Application, Infrastructure, and Api dependency sequence to prevent leakage.

When should I not use a strict layered architecture approach?

Avoid strict layered architecture when features require direct cross-layer access outside permitted dependency paths, or when application complexity does not justify separate Domain, Application, Infrastructure, and Api boundary enforcement overhead.