clean-architecture

Reviews and guides software design against four-layer Clean Architecture principles.

Updated Jun 23, 2026
One-click install
npx skills add https://github.com/j5ik2o/marp-ai-base --skill clean-architecture-j5ik2o
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/j5ik2o/marp-ai-base/tree/main/.agents/skills/clean-architecture
Command: npx skills add https://github.com/j5ik2o/marp-ai-base --skill clean-architecture-j5ik2o

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Teams adopting Clean Architecture often misplace components, such as putting repository implementations in the infrastructure layer or leaking external dependencies into the domain layer. This Skill provides design guidance and review checkpoints based on a strict four-layer structure (Domain, Use Case, Interface Adapters, Infrastructure) to keep dependencies pointing inward. ## Core Features & Use Cases - Layer Responsibility Guidance: Defines exactly what belongs in each of the four layers, including the rule that persistence and RPC implementations live in the Interface Adapters layer, not Infrastructure. - Review Checkpoints: Supplies concrete checks such as detecting external dependencies in the domain layer, verifying repository implementation placement, and preventing infrastructure layer bloat. - Detailed Reference: Includes a per-layer breakdown of responsibilities with a dependency inversion example in TypeScript. - Use Case: When reviewing a pull request in a Clean Architecture project, ask the AI to verify that a new repository implementation is placed in the Interface Adapters layer and that the domain layer contains no database or HTTP client code. ## Quick Start Review this codebase according to Clean Architecture and check whether the repository implementations and layer dependencies are placed correctly.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
Where should repository implementations go in Clean Architecture?▼

Repository implementations belong in the Interface Adapters layer, while their interfaces (Output Ports) are defined in the Use Case layer. The Infrastructure layer should only contain cross-cutting concerns like logging and configuration, not persistence code.

How do I review code against Clean Architecture principles?▼

Check four points: the domain layer has no external dependencies like DB connections or HTTP clients, repository implementations sit in the Interface Adapters layer, the infrastructure layer is not bloated with persistence code, and dependencies only point inward.

What belongs in the Infrastructure layer of Clean Architecture?▼

Only cross-cutting concerns: logging mechanisms, configuration management, metrics and tracing, common error handling, DI container setup, and environment variable loading. Repository implementations and external API gateways must go to the Interface Adapters layer instead.

Does this Clean Architecture guidance apply to Hexagonal or Onion architectures?▼

No, this guidance is explicitly scoped to projects adopting Clean Architecture only. It should not be applied to Hexagonal, Onion, or plain layered architectures, and it does not trigger on generic design review requests.

Why is my domain layer considered contaminated in Clean Architecture?▼

A domain layer is contaminated when it contains DB connections, SQL, HTTP or gRPC clients, framework-dependent code, or logging implementations. The domain layer should only hold entities, value objects, domain services, domain events, and factory interfaces.