← ClaudeAtlas

hexagonal-architecturelisted

Design and refactor systems using Ports & Adapters (Hexagonal Architecture). Use when starting a new service, untangling framework-coupled business logic, supporting multiple delivery mechanisms (HTTP + queue + CLI), swapping infrastructure (Postgres → Mongo, REST → gRPC) without touching domain code, or planning long-lived enterprise systems where framework churn is a real risk. Covers Go+Fiber, Python+FastAPI, and React Native client adaptations.
kouroshez/coding-os · ★ 6 · API & Backend · score 77
Install: claude install-skill kouroshez/coding-os
# Hexagonal Architecture — Ports & Adapters A practical playbook for building business-logic-first systems where the domain is shielded from frameworks, transports, and persistence. Pattern by Alistair Cockburn (2005); proven across two decades of Java, .NET, Go, Python, and TypeScript codebases. ## When to Use This Skill Invoke this skill **before** writing the first business-logic file in a new service, **or** when you find yourself: - Writing tests that mock five frameworks just to assert one business rule - Wanting to add a CLI / cron / queue-consumer entry point but every code path threads through HTTP request/response objects - Replacing PostgreSQL with another store and discovering business code imports `sqlalchemy` directly - Asking "where does the *real* logic live?" and finding the answer is "scattered across controllers" - Planning a long-lived system where the current framework will be obsolete in 5 years **Skip** for: throwaway scripts, one-off scrapers, CRUD-only admin tools where the framework IS the application. ## The Three Layers ``` ┌─────────────────────────────────────────────────────────────┐ │ ADAPTERS (infrastructure + delivery) │ │ ┌─────────────┐ ┌─────────────┐ ┌──────────────┐ │ │ │ HTTP route │ │ CLI command │ │ Queue worker │ │ ← inbound │ └──────┬──────┘ └──────┬──────┘ └──────┬───────┘ │ │ │ │ │ │ │ ▼ ▼