clean-architecture

Structure software around the Dependency Rule with layered entities, use cases, and adapters.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/HafidJoss/Lummy --skill clean-architecture-hafidjoss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/HafidJoss/Lummy/tree/main/agent/skills/clean-architecture
Command: npx skills add https://github.com/HafidJoss/Lummy --skill clean-architecture-hafidjoss

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 principles to keep business rules independent of volatile technical details. ## Core Features & Use Cases - Dependency Rule Enforcement: Organize code into concentric circles (Entities, Use Cases, Interface Adapters, Frameworks) where source dependencies always point inward. - Component and SOLID Guidance: Apply REP, CCP, CRP, ADP, SDP, SAP component principles plus the five SOLID principles with concrete code examples. - Architecture Scoring and Diagnostics: Score an architecture 0-10 using a seven-row diagnostic and get specific inversion fixes for each failure. - Use Case: When reviewing a codebase where business rules live in controllers and ORM models, use this Skill to identify outward dependencies, define boundary interfaces, and restructure into testable use case interactors. ## Quick Start Review my project structure and tell me which layers violate the Dependency Rule and how to fix each violation.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I apply the Dependency Rule in my project?

Organize code into concentric circles with entities innermost, then use cases, adapters, and frameworks. Ensure all source code imports point inward, and use dependency inversion with interfaces defined in inner circles and implemented in outer ones.

What is the difference between an entity and a use case?

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 or CancelOrder.

How do I keep my ORM models out of business logic?

Maintain two models: pure domain entities with business methods and no ORM annotations, plus separate persistence models mapped to database tables. Gateways in the adapter layer map between the two, so schema changes never touch business rules.

Does clean architecture work with microservices?

Yes, but services are deployment boundaries, not automatic architectural boundaries. Each service needs its own internal concentric circles; a microservice sharing a database or data model with others is a distributed monolith.

When should I use a full boundary versus a partial one?

Use full boundaries with reciprocal input and output ports when you will definitely swap implementations. Use partial boundaries like the strategy pattern or facade when the need is uncertain, since full boundaries carry higher structural cost.

How do I break a circular dependency between components?

Apply the Acyclic Dependencies Principle using two strategies: invert one dependency by extracting an interface via DIP, or extract the shared classes into a new component that both original components depend on.