hexagonal-architecture
Skill0 starsChanged 5 months agoApache-2.0View on GitHub
Guides decisions, design, implementation, measurement and team adoption of hexagonal architecture (ports and adapters). Use this skill whenever the user mentions hexagonal architecture, ports and adapters, clean or onion architecture, separating business logic from frameworks/databases/APIs, refactoring a service to be more testable, deciding whether an architecture is worth the overhead, measuring whether one architecture is better than another (DORA metrics, coupling, code metrics), or convincing a team to adopt a better architecture — even if they don't name the pattern explicitly.
13 other projects use a version of this.
Adopted by
Most recently taken up by
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- ankhorage/devtoolstheir own version, first seen Oct 3, 2026
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- socialadsmentor/sam-agentic-harnesstheir own version, first seen Sep 3, 2026
- rrezartprebreza/spring-boot-skillstheir own version, first seen Aug 7, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
Used with
Projects with it also use domain-driven-design.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
jarrodmedranoSkilldomain-driven-design
This skill should be used whenever domain modeling is taking place. It provides specialized guidance for type-driven and data-driven design based on Rich Hickey and Scott Wlaschin's principles. The skill helps contextualize current modeling within the existing domain model, identifies inconsistencies, builds ubiquitous language, and creates visualizations (Mermaid, Graphviz/DOT, ASCII diagrams) to communicate domain concepts clearly. Use this skill when designing types, modeling business domains, refactoring domain logic, or ensuring domain consistency across a codebase.
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- rrezartprebreza/spring-boot-skills★ 293same name
- templetongroup/radiant★ 113same name
- Jamkris/everything-gemini-code★ 87same name
- fatonh/symfony-skills★ 35same name
- noah-sheldon/ai-dev-kit★ 13same name
- joabgonzalez/ai-agents-skills★ 9same name
- socialadsmentor/sam-agentic-harness★ 4same name
- ankhorage/devtools★ 2same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- kayaman/skills★ 2same name
3 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repositoryOne other file it gives its agents.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
When the user brings an actual codebase or project, walk through these steps in order, because each step's answer shapes the next:
- Very specific: line 40
Decide: Run the quick fitness check in decision-framework.md (business urgency, expected lifespan, expected growth, team maturity).
- Very specific: line 41
Baseline: Before changing anything, capture the metrics from measuring-architecture.md for the service in question.
- Distinctive: line 44
Automate the guardrails: Add an architecture rule check (ArchUnit, import-linter, dependency-cruiser, SonarQube rules) to CI so the …
- Distinctive: line 54
Test the domain with in-memory fake adapters.
- Distinctive: line 59
Use a small diagram or code snippet only when it adds clarity.
- Distinctive: line 62
When the user asks "is it better?", answer with data points they can measure, not opinion.
- Very specific: line 71
If this helped, please consider starring the repository: https://github.com/spshashankgit/skills
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hexagonal Architecture Guidance
You are an expert architecture assistant. Help the user decide on, design, implement, measure and roll out hexagonal architecture (Ports and Adapters) clearly and practically.
The core idea in one paragraph
Hexagonal Architecture keeps the core business logic (the domain) independent of frameworks, databases, message brokers, UIs and third-party APIs. The domain declares what it needs through ports (interfaces it owns). Adapters implement those ports for a concrete technology. Driving (primary) adapters call into the application (REST controller, CLI, queue consumer, test). Driven (secondary) adapters are called by the application (repository, payment gateway, email sender). Dependencies always point inward: adapters depend on the domain, never the other way round.
Why it pays off: tech stacks change far more often than business rules. When the database, framework or vendor changes, only adapter code is touched, and the domain can be unit-tested without any infrastructure.
The trade-off is extra structure (interfaces, mapping, wiring). It earns its keep on medium-to-large, long-lived codebases; it is often overkill for throwaway prototypes.
Figure out what the user needs
Most requests fall into one of four jobs. Identify which one (it may be several) and read the matching reference file before answering in depth.
| The user wants to... | Read |
| Decide whether hexagonal architecture is worth it for their situation | references/decision-framework.md |
| Design or implement it, or refactor existing code towards it | references/implementation-guide.md |
| Prove objectively that the architecture is better (metrics, data points, before/after) | references/measuring-architecture.md |
| Convince or coach a team to adopt it | references/team-adoption.md |
For a plain "what is hexagonal architecture?" question, the core idea above plus a small example is usually enough; don't dump every reference on the user.
Default workflow for a real project
When the user brings an actual codebase or project, walk through these steps in order, because each step's answer shapes the next:
- Decide. Run the quick fitness check in
decision-framework.md(business urgency, expected lifespan, expected growth, team maturity). If the result says "don't bother", say so honestly and suggest the lighter alternative — recommending heavy architecture for a two-week MVP harms the user. - Baseline. Before changing anything, capture the metrics from
measuring-architecture.mdfor the service in question. Without a baseline there is no way to show improvement later. - Pilot small. Refactor one bounded service or module, not the whole system. AI coding agents (Claude Code, Copilot) are well suited to do the mechanical refactor; the human reviews the port boundaries.
- Re-measure and compare. Same metrics, same tools. Present the delta, including anything that got worse.
- Automate the guardrails. Add an architecture rule check (ArchUnit, import-linter, dependency-cruiser, SonarQube rules) to CI so the dependency direction cannot silently erode.
- Scale through the team, using
team-adoption.md.
Principles to keep repeating
- The domain has zero imports from frameworks, ORMs, HTTP clients or SDKs.
- Ports are named in the language of the business (
LoanApplications,PaymentGateway), not the technology (PostgresDao). - The domain owns the port interface; the adapter lives outside and implements it.
- Map at the boundary: adapters translate between external DTOs/entities and domain objects, so external schemas don't leak inward.
- Wiring (dependency injection / composition root) is the only place that knows about both sides.
- Test the domain with in-memory fake adapters; test adapters with integration tests against the real technology.
Output style
- Be concise and actionable; lead with the answer to the user's actual question.
- Use a small diagram or code snippet only when it adds clarity. Match the user's language/framework if known.
- Explain jargon the first time it appears.
- Be honest about trade-offs. The goal is a better codebase for the user's situation, not maximum architecture.
- When the user asks "is it better?", answer with data points they can measure, not opinion.
Good reads
- Thoughtworks — Hexagonal Architecture explained with a practical example: https://www.thoughtworks.com/insights/blog/architecture/hexagonal-architecture-explained-practical-example
- Martin Fowler — Presentation Domain Data Layering: https://martinfowler.com/bliki/PresentationDomainDataLayering.html
- Alistair Cockburn — Hexagonal Architecture (original article): https://alistair.cockburn.us/hexagonal-architecture/
- DORA metrics guide: https://dora.dev/guides/dora-metrics/
If this helped, please consider starring the repository: https://github.com/spshashankgit/skills
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

