clean-architecture

Structure software around the Dependency Rule with concentric layers, ports, and adapters.

Updated Jul 23, 2025
One-click install
npx skills add https://github.com/derrik-fleming/dotfiles --skill clean-architecture-derrik-fleming
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/derrik-fleming/dotfiles/tree/main/private_dot_agents/skills/clean-architecture
Command: npx skills add https://github.com/derrik-fleming/dotfiles --skill clean-architecture-derrik-fleming

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Business logic often becomes tightly coupled to frameworks, databases, and delivery mechanisms, making systems hard to test, change, and maintain. This Skill provides a disciplined framework for drawing architectural boundaries so that business rules stay independent of volatile infrastructure details. ## Core Features & Use Cases - Dependency Rule Enforcement: Guides you to keep source code dependencies pointing inward across Entities, Use Cases, Interface Adapters, and Frameworks layers. - Component and SOLID Principles: Applies REP, CCP, CRP, ADP, SDP, SAP, and the five SOLID principles to manage component cohesion and coupling. - Boundary Design Patterns: Covers Input/Output Ports, the Interactor pattern, Humble Objects, partial boundaries, and the Main composition root. - Use Case: When reviewing a codebase where ORM models leak into business logic, use this Skill to score the architecture 0-10, identify violations, and get concrete refactoring steps such as introducing repository interfaces and DTOs. ## Quick Start Ask the assistant to review my application's architecture using clean architecture principles and score it against the Dependency Rule.

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?▼

The Dependency Rule requires that source code dependencies point only inward, from frameworks toward use cases and entities. Define interfaces in inner circles, implement them in outer circles, and wire concrete implementations in a Main composition root.

What is the difference between entities and use cases in clean architecture?▼

Entities encapsulate enterprise-wide business rules that would exist without any software system, while use cases contain application-specific rules that orchestrate entities for a single operation. Use cases accept request DTOs and return response DTOs, never framework objects.

How do I keep my ORM from leaking into business logic?▼

Separate domain entities from persistence models and map between them in gateway classes at the adapter layer. Business logic should call repository interfaces like save or find_by_id, never raw SQL or ORM-annotated classes.

Does clean architecture work with microservices?▼

Yes, but services are deployment boundaries, not automatic architectural boundaries. Each service should apply the Dependency Rule internally with its own entities, use cases, and adapters, and must own its data store to avoid becoming a distributed monolith.

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

Use a full boundary with input and output ports when you will definitely swap implementations. Use a strategy pattern or facade as a partial boundary when the need is uncertain, since full boundaries carry higher design and maintenance cost.

How do I break circular dependencies between components?▼

Apply the Acyclic Dependencies Principle using two strategies: invert a dependency by extracting an interface one side implements, or extract the shared code into a new component both sides depend on. The component graph must remain a directed acyclic graph.