# Hexagonal architecture

> Hexagonal architecture is an open-source agent skill for developer tools. Gives the agent a layered hexagonal architecture rulebook for ports, adapters and tests. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/zerotechdebt/ffflow/tree/main/plugin/skills/hexagonal-architecture
- **Repository:** https://github.com/zerotechdebt/ffflow
- **GitHub stars:** 6
- **License:** Apache-2.0
- **Skill name:** hexagonal-architecture
- **Collection:** https://github.com/zerotechdebt/ffflow
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill is a reference rulebook for structuring code into Domain, Application and Infrastructure layers. It explains which kinds of objects belong in each layer, how ports and adapters separate business logic from external systems, and the dependency rule that keeps dependencies pointing inward.

Beyond the layer definitions, it sets out a directory layout for source, tests and Gherkin specs, plus a mapping of each layer to spec type and test strategy. Domain code is meant to be tested in isolation, application tests mock infrastructure ports, and infrastructure is covered by integration tests against real services such as testcontainers. It also lists common anti-patterns and the enforcement expected at each maturity level.

The skill is written as context for other workflows rather than a standalone tool. It is referenced by planning, issue-work and architecture audit commands in the ffflow plugin, and it expects a project to follow the layer and naming conventions it describes.

## When your agent uses it

> Domain / Application / Infrastructure layers — ports, adapters, the dependency rule, and how layers map to spec types and test strategies. L1+ reference rulebook.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/zerotechdebt/ffflow/tree/HEAD/plugin/skills/hexagonal-architecture)
- [License: Apache-2.0](https://github.com/zerotechdebt/ffflow/tree/HEAD/plugin/skills/hexagonal-architecture)

## Features

- **Layer responsibilities:** Defines what belongs in Domain, Application and Infrastructure, from entities and value objects to use cases and adapters.
- **Dependency rule:** States that domain knows nothing outward and infrastructure depends on the inner layers, with no exceptions.
- **Ports and adapters:** Explains where port interfaces live and how concrete adapters such as repositories and API clients implement them.
- **Test strategy per layer:** Maps domain, application, acceptance and infrastructure layers to spec tests, unit tests and integration tests.
- **Directory and spec layout:** Gives a folder structure for src, tests and Gherkin specs organised by context and layer.
- **Anti-pattern checklist:** Lists common mistakes such as anemic domain models, infrastructure-aware helpers in domain and mocking the domain.

## Good for

- Plan the folder structure for a new service split into domain, application and infrastructure
- Review whether a use case imports a concrete database client when it should use a port
- Decide which tests to write for a domain entity versus an infrastructure repository
- Write a port interface for an email or payment service in the application layer
- Audit an existing codebase for layer violations and misplaced adapter types

## Install

### Claude Code

This skill ships in the `fff` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add zerotechdebt/ffflow
/plugin install fff@ffflow
```

Or copy only this skill to `~/.claude/skills/hexagonal-architecture`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/hexagonal-architecture &&
cp -R "$tmp/plugin/skills/hexagonal-architecture" ~/.claude/skills/hexagonal-architecture &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/hexagonal-architecture` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/hexagonal-architecture` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/hexagonal-architecture &&
cp -R "$tmp/plugin/skills/hexagonal-architecture" ~/.agents/skills/hexagonal-architecture &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/hexagonal-architecture` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/hexagonal-architecture` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/hexagonal-architecture &&
cp -R "$tmp/plugin/skills/hexagonal-architecture" ~/.cursor/skills/hexagonal-architecture &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/hexagonal-architecture` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/zerotechdebt/ffflow.git --path plugin/skills/hexagonal-architecture
```

Or copy the folder to `~/.gemini/skills/hexagonal-architecture` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/hexagonal-architecture`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/hexagonal-architecture &&
cp -R "$tmp/plugin/skills/hexagonal-architecture" ~/.copilot/skills/hexagonal-architecture &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/hexagonal-architecture` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/zerotechdebt/ffflow.git
```

Then copy `ffflow/plugin/skills/hexagonal-architecture` into your agent's skills folder as `hexagonal-architecture`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does Hexagonal architecture run any scripts or tools?

No. It is a reference rulebook with no scripts, and it is loaded as context rather than invoked as a tool.

### Which commands use Hexagonal architecture?

The skill names plan-chat, work-issue and the /audit --type architecture command as the workflows that load it as context.

### Does Hexagonal architecture require a particular language?

The rules are language-neutral, though examples mention Python and TypeScript test tools such as Hypothesis and fast-check.

### Is Hexagonal architecture enforced automatically?

Enforcement depends on the level set in the project. It is recommended at L1, required at L2 when configured, and blocking at L3 through the architecture audit.

### How do I install Hexagonal architecture in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/hexagonal-architecture to use it in all your projects, or to .claude/skills/hexagonal-architecture in one project. Or install the fff plugin, which includes it: /plugin marketplace add zerotechdebt/ffflow, then /plugin install fff@ffflow.

### Does Hexagonal architecture run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Hexagonal architecture?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Hexagonal architecture?

The closest alternatives to Hexagonal architecture are Architecture foundation, V3 DDD Architecture, Oracle codebase design, TDD and Codebase design.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Architecture foundation](https://ai-powered.com/skills/architecture-foundation): Architecture foundation is an open-source agent skill for developer tools.
- [V3 DDD Architecture](https://ai-powered.com/skills/v3-ddd-architecture): V3 DDD Architecture is an open-source agent skill for developer tools.
- [Oracle codebase design](https://ai-powered.com/skills/oracle-codebase-design): Oracle codebase design is an open-source agent skill for developer tools.
- [TDD](https://ai-powered.com/skills/tdd): TDD is an open-source agent skill for developer tools.
- [Codebase design](https://ai-powered.com/skills/codebase-design): Codebase design is an open-source agent skill for design and media.
- [Architecture](https://ai-powered.com/skills/architecture): Architecture is an open-source agent skill for developer tools.
- [V3 Core Implementation](https://ai-powered.com/skills/v3-core-implementation): V3 Core Implementation is an open-source agent skill for developer tools.
- [Ask matt](https://ai-powered.com/skills/ask-matt): Ask matt is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/hexagonal-architecture-zerotechdebt
