hexagonal-architecturecommit d29cf65SKILL.md · Architecture
Hexagonal Architecture
Designs, implements and refactors Ports & Adapters systems so business logic stays independent of frameworks, transport and persistence.
npx skills add affaan-m/ECC --skill hexagonal-architectureCommand selected. Copy it manually.
- Permissions
- read-repo
- write-files
- shell
- network
- Compatible with
- Claude Code, Codex, Cursor, Copilot, OpenCode
- GitHub
- 294.3k
- Source
- Community · Affaan Mustafa
- Status
- Scan passed
- License
- MIT
- Category
- Architecture
Core rule
Dependencies always point inward: the domain depends on nothing external, and adapters implement ports at the edges.
Execution Phases
Phase 01Model a use case boundary
Define one use case with clear input and output DTOs, keeping transport details like req or GraphQL context outside.
Phase 02Define outbound ports first
Model every side effect, such as persistence, external calls, logging or clock, as a port that describes a capability, not a technology.
Phase 03Orchestrate the use case
The use case receives ports via constructor or arguments, validates invariants, coordinates domain rules and returns plain data.
Phase 04Adapters and wiring
Build inbound and outbound adapters at the edge with mapping kept inside them, and wire everything in a single composition root.
Phase 05Test per boundary
Unit test use cases with fake ports and adapters against real infrastructure; migrate existing systems slice by slice, never as a big-bang rewrite.
Permissions (summarised from SKILL.md)
| Capability | Needed | Details |
|---|---|---|
| File writes | Required | Creates or refactors domain, use case, port, adapter, composition root and test code. |
| Command execution | Not required | The skill does not call for running commands. |
| Network outbound | Not required | No network access. |
SKILL.md frontmatter (YAML)
---
name: hexagonal-architecture
description: Design, implement, and refactor Ports & Adapters systems with clear domain boundaries, dependency inversion, and testable use-case orchestration across TypeScript, Java, Kotlin, and Go services. Use when introducing or refactoring toward Ports and Adapters, or when domain logic has become entangled with I/O.
metadata:
origin: ECC
---