Clean Architecture Principles
This skill provides language-agnostic Clean Architecture principles for designing maintainable, testable software systems.
When to Use This Skill
- •Designing new feature architecture
- •Reviewing layer boundaries and dependencies
- •Evaluating dependency injection approaches
- •Making decisions about abstraction placement
Core Concepts
Clean Architecture aims to create systems where:
- •Business rules are independent of frameworks
- •UI, database, and external services are interchangeable
- •The system is testable without external dependencies
Quick Reference
Layer Structure (Inside → Outside)
- •Domain Layer - Business rules, entities, value objects (no dependencies)
- •Application Layer - Use cases, application services, ports
- •Presentation Layer - UI, controllers, view models
- •Infrastructure Layer - Frameworks, databases, external APIs
Dependency Rule
Dependencies point inward only. Outer layers depend on inner layers, never the reverse.
code
Infrastructure → Presentation → Application → Domain
↑ ↑ ↑ ↑
(outer) (inner)
Key Principles
- •Dependency Inversion: Depend on abstractions, not concretions
- •Interface Segregation: Small, focused interfaces
- •Single Responsibility: Each layer has one reason to change
Resources
Read these in order for comprehensive understanding:
- •
resources/dependency-inversion.md- Dependency Inversion Principle - •
resources/layer-separation.md- Layer responsibilities and boundaries - •
resources/reference-rules.md- Abstract reference rules for any language
Integration with Other Skills
- •good-test-principles: Testability through proper layer separation
- •code-review-guideline: Architecture compliance checking
- •For language-specific implementation, see app-level skills