clean-architecture

Structure software around the Dependency Rule with layered boundaries and SOLID principles.

1|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/matrixNeo76/rustcopy --skill clean-architecture-matrixneo76
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/matrixNeo76/rustcopy/tree/main/.agents/skills/clean-architecture
Command: npx skills add https://github.com/matrixNeo76/rustcopy --skill clean-architecture-matrixneo76

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Business logic often becomes entangled with frameworks, databases, and delivery mechanisms, making systems untestable and forcing rewrites when infrastructure changes. This Skill applies Robert C. Martin's Clean Architecture to keep business rules independent of volatile technical details. ## Core Features & Use Cases - Dependency Rule Enforcement: Organize code into concentric circles (Entities, Use Cases, Adapters, Frameworks) where all source dependencies point inward. - Component Design Guidance: Apply cohesion principles (REP, CCP, CRP) and coupling principles (ADP, SDP, SAP) with instability and abstractness metrics to design deployable components. - Boundary Patterns: Implement full or partial boundaries, the Humble Object pattern, and plugin architectures with a Main composition root. - Use Case: When reviewing a codebase where business rules live in controllers and ORM models, use this Skill to diagnose violations with the 7-question Quick Diagnostic, score the architecture 0-10, and get the specific dependency inversion needed to fix each failure. ## Quick Start Review my project structure and tell me which Clean Architecture layers my code belongs in and how to decouple business logic from the database.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I apply Clean Architecture to an existing codebase?▼

Start with the Quick Diagnostic: check whether business rules can be tested without a database or framework and whether dependencies point inward. For each violation, define an interface in the inner circle, move the concrete implementation outward, and wire it in the Main composition root.

What is the Dependency Rule in Clean Architecture?▼

The Dependency Rule states that source code dependencies must only point inward, from frameworks toward use cases and entities. Nothing in an inner circle may reference names, classes, or data formats from an outer circle; dependency inversion through interfaces enforces this.

What is the difference between entities and use cases?▼

Entities encapsulate enterprise-wide business rules that would exist without software, while use cases contain application-specific rules orchestrating data flow to and from entities. Each use case is a single operation like PlaceOrder, implemented as an Interactor with input and output ports.

Should domain entities be ORM models?▼

No. Keep domain entities free of ORM annotations and database concerns, and maintain a separate persistence model in the adapter layer. Gateways map between the two, so schema changes never force business rule rewrites.

Do microservices automatically create clean architecture boundaries?▼

No. A microservice with a shared database or shared data model is a distributed monolith. Services are deployment boundaries; each service still needs its own internal concentric circles following the Dependency Rule to be a genuine architectural boundary.

When should I use a partial boundary instead of a full one?▼

Use a partial boundary, such as a strategy pattern or facade, when the anticipated need to swap implementations does not justify the cost of reciprocal ports and DTOs. Reserve full boundaries for points of likely volatility like persistence and external services.