clean-architecture

Enforce clean architecture boundaries with inward dependencies across software layers.

Updated Dec 18, 2025
One-click install
npx skills add https://github.com/malston/diego-capacity-analyzer --skill clean-architecture-malston
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/malston/diego-capacity-analyzer/tree/main/.devcontainer/claude-config/.library/skills/clean-architecture
Command: npx skills add https://github.com/malston/diego-capacity-analyzer --skill clean-architecture-malston

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Clean Architecture provides a clear blueprint for organizing software into concentric layers with dependencies that point inward, making systems easier to maintain, test, and scale.

Core Features & Use Cases

  • Layered structure: Domain, Use Cases, Interface Adapters, Frameworks & Drivers with strict dependency direction.
  • Separation of concerns: Business rules live in the Domain and Use Cases, while interfaces adapt to external systems.
  • Refactoring guidance: Helps teams restructure existing codebases to improve testability and replaceable components.
  • Use Case example: Reorganize a legacy service into well-defined entities and interactors to enable parallel development and safer changes.

Quick Start

Start by identifying core domain entities and defining use cases that represent user-centric actions. Map each use case to repository interfaces and boundary boundaries, then implement adapters against those interfaces.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I enforce clean architecture boundaries during software refactoring?

To enforce clean architecture boundaries during refactoring, you must ensure dependencies point inward across the Domain, Application, Interface Adapters, and Frameworks layers. This keeps business rules isolated from external systems, making the software maintainable and testable.

What is the dependency rule in clean architecture?

The dependency rule in clean architecture states that source code dependencies must point inward toward the Domain and Use Cases layers. Outer layers like Frameworks and Drivers can depend on inner layers, but inner layers must never depend on outer ones.

How do I structure code using use cases and interface adapters?

Structure code by placing business rules in Domain entities and user-centric actions in Use Case interactors. Map each use case to repository interfaces, then implement interface adapters to convert data between these boundaries and external frameworks or drivers.

Can I use clean architecture to refactor a legacy codebase into testable layers?

Yes, you can refactor a legacy codebase into testable layers by reorganizing existing services into well-defined entities, interactors, and boundary interfaces. This separation of concerns enables parallel development and safer changes by isolating business rules from external systems.

When do I need clean architecture for my software design?

You need clean architecture for software design when your system requires strict separation of concerns, high testability, and replaceable external components. It is particularly useful for organizing complex systems into concentric layers to enable parallel development and safer modifications.

What is the best way to separate business rules from frameworks in clean architecture?

The best way to separate business rules from frameworks is to apply the dependency rule, placing business logic in the inner Domain and Application layers. Interface adapters then act as boundaries, adapting external framework requests to inner layer formats without inward dependencies.