hexagonal-ports-adapters

hexagonal-ports-adapters is a skill for Claude Code from helmedeiros/clean-code-skills. It costs 49 tokens per session (957 once invoked), scanned A, original, MIT.

A software-architecture guide for ports and adapters, a way to keep business rules separate from databases, web services, and other technologies.

In plain words
What is it for?
Use it to define clear interfaces around application logic and connect those interfaces to specific databases, APIs, queues, or user interfaces.
Why use it?
It makes the core logic easier to test and reduces the work needed when an outside technology changes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the clean-code-skills plugin — 21 skills, 2 commands shipped together

Good fit Use it to define clear interfaces around application logic and connect those interfaces to specific databases, APIs, queues, or user interfaces.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/helmedeiros/clean-code-skills/hexagonal-ports-adapters
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add helmedeiros/clean-code-skills --skill hexagonal-ports-adapters
Clone the repo
git clone --depth 1 https://github.com/helmedeiros/clean-code-skills

Made for: Claude Code.

Or install clean-code-skills, the plugin that ships this one along with the rest of its 21 skills, 2 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for hexagonal-ports-adapters

README.md
[![agentmods](https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/hexagonal-ports-adapters/github.svg)](https://agentmods.dev/skills/helmedeiros/clean-code-skills/hexagonal-ports-adapters)
Your own site
<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/hexagonal-ports-adapters"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/hexagonal-ports-adapters/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for hexagonal-ports-adapters

Your own site · 80×15
<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/hexagonal-ports-adapters"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/hexagonal-ports-adapters.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 957 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.00957
Opus 5 $0.00024 $0.00478
Sonnet 5 $0.00010 $0.00191
Haiku 4.5 $0.00005 $0.00096

Measured 8d ago against content hash f87cc3b3cec7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

hexagonal-ports-adapters scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/hexagonal-ports-adapters/SKILL.md · 101 lines

How it starts

The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hexagonal Architecture: Ports and Adapters

Structure applications around a technology-independent domain core by defining ports (interfaces the domain exposes or requires) and adapters (implementations that connect to specific technologies).

When This Skill Applies

  • Business logic is tangled with database, HTTP, or messaging code
  • Swapping a technology (database, queue, API provider) requires rewriting business logic
  • The user mentions hexagonal architecture, ports and adapters, or clean architecture
  • Testing business logic requires spinning up infrastructure
  • The codebase has no clear boundary between domain and infrastructure

Core Principle

The domain sits at the center and defines ports — interfaces that describe what it needs from the outside world (driven ports) and what it offers to the outside world (driving ports). Adapters implement these ports for specific technologies. The domain never imports infrastructure code. All dependencies point inward.

Workflow

Step 1: Identify the Domain Core

Determine what the application does independent of any technology. Business rules, validations, calculations, and state machines belong in the domain.

Step 2: Define Driving Ports (Inbound)

These are the use cases the application offers. Define them as interfaces or service methods: PlaceOrder, RegisterUser, GenerateReport. External actors (HTTP controllers, CLI, message consumers) call these.

Step 3: Define Driven Ports (Outbound)

These are the dependencies the domain needs. Define them as interfaces: OrderRepository, PaymentGateway, NotificationSender. The domain calls these; infrastructure implements them.

Step 4: Implement Adapters

Create adapters for each port:

  • Driving adapters (inbound): HTTP controllers, GraphQL resolvers, CLI handlers, message consumers.
  • Driven adapters (outbound): PostgreSQL repository, Stripe payment gateway, SMTP email sender.

Step 5: Wire at the Composition Root

Connect adapters to ports at the application entry point. The domain never knows which concrete adapter is connected.

Read the full file on GitHub · 101 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 101 lines · 49 tokens per session scan A f87cc3b3cec7

Subscribe to this mod's changes

hexagonal-ports-adapters is a skill published in the GitHub repository helmedeiros/clean-code-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 49 tokens to every session and 957 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

drift-testing

Verifies API implementations against OpenAPI specifications using the Drift CLI, catching spec drift and supporting Bi-Directional Contract Testing (BDCT). Use when the user mentions Drift, API contract testing, provider contract testing, provider verification, spec drift, API conformance testing, OpenAPI…

pactflow/pactflow-agent-skills · 158 tokens

openapi-parser

Parses complex OpenAPI specs and generates Drift test cases from them. Use whenever the user wants to generate, write, or scaffold Drift tests from an OpenAPI spec — especially when the spec contains complex schemas: anyOf/oneOf/allOf, discriminators, polymorphism, inheritance, $ref chains, regex patterns, enums, or…

pactflow/pactflow-agent-skills · 145 tokens

demographic-modeling

This skill should be used when the user asks to "design a demographic model", "model a person/organisation/role", "design party relationships", "plan identity structures", or "work with demographic archetypes". Covers designing openEHR demographic models using the PARTY hierarchy, roles, capabilities, relationships…

Cadasto/openehr-assistant-plugin · 126 tokens

epf-bsp-init

A helper for describing a 1C external report or data processor so it can be added through the platform’s standard “Additional reports and processors” section.

IngvarConsulting/unica · 72 tokens

platform-help

A reference skill for the 1C platform and BSL, the programming language used to build 1C business applications. It helps clarify the platform’s object model, APIs, versions, and compatibility.

IngvarConsulting/unica · 50 tokens

api-design

Design and review guidance for 1C:Enterprise APIs, which are interfaces that let software components call each other. It covers public and internal interfaces, compatibility, versioning, and moving users to changed interfaces.

IngvarConsulting/unica · 83 tokens