← ClaudeAtlas

clean-architecturelisted

Use when business logic is entangled with frameworks or databases. Covers hexagonal architecture (ports and adapters), layer diagram, dependency direction rules, and violation symptoms.
andr-ca/agentharness · ★ 1 · AI & Automation · score 70
Install: claude install-skill andr-ca/agentharness
# Clean Architecture (Hexagonal / Ports & Adapters) **Core rule:** business logic must not depend on infrastructure. Infrastructure depends on business logic. ``` ┌─────────────────────────────────────────┐ │ Infrastructure │ │ (HTTP, DB, Queue, Email, S3, ...) │ │ │ │ ┌───────────────────────────┐ │ │ │ Application Layer │ │ │ │ (Use cases, Commands) │ │ │ │ │ │ │ │ ┌─────────────────┐ │ │ │ │ │ Domain Layer │ │ │ │ │ │ (Entities, │ │ │ │ │ │ Value Objects, │ │ │ │ │ │ Domain Events) │ │ │ │ │ └─────────────────┘ │ │ │ └───────────────────────────┘ │ └─────────────────────────────────────────┘ Dependencies only point INWARD → ``` --- ## Layers ### Domain (innermost) - Entities: objects with identity and lifecycle (`Order`, `User`) - Value Objects: immutable, defined by value (`Money`, `Email`) - Domain Events: things that happened (`OrderPlaced`, `PaymentFailed`) - Domain Services: stateless logic that spans entities - **Zero infrastructure imports** — no SQLAlchemy, FastAPI, Stripe, etc. ### Application - Use cases / handlers: orchestrate domain objects - Input/output ports (interfaces): what the use case needs from outside -