Skip to content
Back to skills

Hexagonal Architecture

ASecurity

Ports and adapters — domain core independent of frameworks and I/O, driving (inbound) and driven (outbound) ports, adapters for HTTP, queues, databases and external APIs, testing the core with fakes. Use to structure a service so business logic is isolated and testable (hexagonal, ports and adapters, adapters, dependency inversion).

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgotestingapidatabase

Works with

  • api

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add vectora-os/kit --skill hexagonal-architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Hexagonal Architecture?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Hexagonal Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectora-os-hexagonal-architecture/badge)](https://www.skillsdirectory.com/skills/vectora-os-hexagonal-architecture)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: hexagonal-architecture
description: Ports and adapters — domain core independent of frameworks and I/O, driving (inbound) and driven (outbound) ports, adapters for HTTP, queues, databases and external APIs, testing the core with fakes. Use to structure a service so business logic is isolated and testable (hexagonal, ports and adapters, adapters, dependency inversion).
metadata:
  category: design-patterns
---

# Hexagonal architecture

## Purpose

Keep business logic independent of delivery mechanisms and infrastructure.

**Use when:** services with meaningful business logic and several integrations.

**Not for:** thin glue services.

## Inputs

- Use cases, external dependencies.

## Outputs

- Port interfaces, adapter list, folder layout, test strategy.

## Read first

- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "hexagonal architecture"` for prior decisions, patterns and anti-patterns.
- [Architecture standard](../../../standards/architecture.md)
- [Folder structure standard](../../../standards/folder-structure.md)

## Steps

1. **Core.** List use cases as application services in the core.
   Done when core has no framework imports.
2. **Ports.** Define inbound ports (use case interfaces) and outbound ports (repositories, gateways).
   Done when every external dependency is behind a port.
3. **Adapters.** Implement adapters per technology.
   Done when adapters contain no business rules.
4. **Tests.** Test core with in-memory fakes; test adapters with integration tests.
   Done when core tests run without I/O.

## Best practices

- Name ports in domain language.
- Enforce dependency direction with a lint rule.

## Common mistakes

- Leaking ORM entities into the core.
- Ports mirroring vendor APIs.

## Example

`PaymentGateway` port with `StripeAdapter` and `FakeGateway`; checkout use case tested in milliseconds.

## Reusable prompt

```text
Apply the Hexagonal architecture skill (.agents/skills/hexagonal-architecture/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Define the core use cases, inbound and outbound ports, adapters and the testing split for the service.
Return: Port interfaces, adapter list, folder layout, test strategy..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.