Agent skill

Hexagonal Architecture

by PackmindHub in PackmindHub/packmind

Describes the hexagonal architecture (ports and adapters) used across the Packmind monorepo.

Apache-2.0Auto-check passedDevelopment

Install Hexagonal Architecture

skills CLI
$ npx skills add PackmindHub/packmind --skill hexagonal-architecture -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PackmindHub/packmind hexagonal-architecture --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PackmindHub/packmind.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/.agents/skills/hexagonal-architecture .claude/skills/hexagonal-architecture && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
hexagonal-architecture
GitHub stars
317
Token cost
~2.3k tokens
SKILL.md length
722 words
Files
14
Skills in repo
35
Repo updated
First seen
Licence
Apache-2.0

At a glance

Describes the hexagonal architecture (ports and adapters) used across the Packmind monorepo.

  • Works in 2 steps: Synchronous - Via ports injected through… → Asynchronous - Via domain events emitted…
  • Tasks that involve Monorepo tooling
  • SKILL.md covers Architecture Map, Layer Details, Component Reference and Dependency Flow, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Hexagonal Architecture is an agent skill from PackmindHub/packmind. Describes the hexagonal architecture (ports and adapters) used across the Packmind monorepo. This skill should be used when creating new domain packages, use cases, services, repositories, domain error classes, or any architectural component to follow established patterns, including how a failure raised in a use case becomes an HTTP response.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 15 other files (for example `components/adapter.md`, `components/contract.md` and `components/event.md`).

It sits in Development, covering Monorepo tooling. The repository describes itself as: Packmind seamlessly captures your engineering playbook and turns it into AI context, guardrails, and governance. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Monorepo tooling

Example prompts

  • “Use the hexagonal-architecture skill to describe the hexagonal architecture (ports and adapters) used across the Packmind monorepo”
  • “/hexagonal-architecture”

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Synchronous - Via ports injected through the HexaRegistry during initialize().
  2. Asynchronous - Via domain events emitted through PackmindEventEmitterService.

What it can do on your machine

Read from SKILL.md and the folder at commit 8a10541. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Hexagonal Architecture loads about 2.3k tokens when it runs. Until then it costs about 92 tokens; SKILL.md has 722 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PackmindHub/packmind at commit 8a10541, republished under its Apache-2.0 licence (© PackmindHub). 722 words, ~2,329 tokens.

Download SKILL.mdSave it as .claude/skills/hexagonal-architecture/SKILL.md (or your agent's skills folder). This skill also uses 13 other files; get the full folder from GitHub.
name
hexagonal-architecture
description
Describes the hexagonal architecture (ports and adapters) used across the Packmind monorepo. This skill should be used when creating new domain packages, use cases, services, repositories, domain error classes, or any architectural component to follow established patterns, including how a failure raised in a use case becomes an HTTP response.

Hexagonal Architecture - Packmind Monorepo

Architecture Map

Every domain package follows a three-layer hexagonal (ports & adapters) architecture. Dependencies flow inward only: Infrastructure -> Application -> Domain.

packages/{domain}/src/
├── domain/                          # Pure business logic, zero dependencies
│   ├── entities/                    # Domain entities and value objects
│   ├── repositories/                # Repository interfaces (ports)
│   ├── jobs/                        # Delayed job definitions
│   ├── errors/                      # Domain-specific error classes
│   ├── utils/                       # Domain-specific utility functions
│   └── types/                       # Domain-specific type definitions
│
├── application/                     # Orchestration & coordination
│   ├── useCases/{name}/             # One folder per use case
│   │   └── {name}.usecase.ts
│   ├── services/                    # Domain services + service aggregator
│   ├── adapter/                     # Outbound adapter (implements port)
│   ├── listeners/                   # Domain event listeners
│   └── jobs/                        # Delayed job implementations
│
├── infra/                           # Concrete implementations
│   ├── repositories/                # Repository implementations (TypeORM)
│   ├── schemas/                     # TypeORM EntitySchema definitions
│   └── jobs/                        # Job factories
│
└── index.ts                         # Package exports + {Domain}Hexa facade

Layer Details

LayerDepends OnPurposeDetails
DomainNothing (pure TS + @packmind/types)Business rules, entity definitions, port interfacesdomain-layer.md
ApplicationDomainUse case orchestration, services, adapters, eventsapplication-layer.md
InfrastructureDomain + ApplicationPersistence, schemas, job queuesinfrastructure-layer.md

Component Reference

Each component type has its own detailed guide with templates and examples:

ComponentLayerFile PatternGuide
Use CaseApplicationapplication/useCases/{name}/{name}.usecase.tsusecase.md
ServiceApplicationapplication/services/{Name}Service.tsservice.md
AdapterApplicationapplication/adapter/{Domain}Adapter.tsadapter.md
PortTypes packagepackages/types/src/{domain}/ports/I{Domain}Port.tsport.md
ContractTypes packagepackages/types/src/{domain}/contracts/{UseCaseName}.tscontract.md
Repository (interface)Domaindomain/repositories/I{Entity}Repository.tsrepository.md
Repository (impl)Infrastructureinfra/repositories/{Entity}Repository.tsrepository.md
SchemaInfrastructureinfra/schemas/{Entity}Schema.tsschema.md
ListenerApplicationapplication/listeners/{Domain}Listener.tslistener.md
EventTypes packagepackages/types/src/events/{EventName}.tsevent.md
Hexa FacadeRoot{Domain}Hexa.ts + index.tshexa-facade.md

Dependency Flow

  API (NestJS controllers)
         │
         ▼
  ┌─────────────┐
  │ HexaRegistry │  ── Central DI container
  └──────┬──────┘
         │ getAdapter<IXxxPort>(portName)
         ▼
  ┌─────────────┐
  │ {Domain}Hexa │  ── Facade: wires repos, services, adapter
  └──────┬──────┘
         │
    ┌────┴────┐
    ▼         ▼
 Adapter   Services  ── Application layer
    │         │
    ▼         ▼
 Use Cases ──► Domain entities + Repository interfaces
    │
    ▼
 Infra Repositories ── Concrete persistence (TypeORM)

Cross-Domain Communication

Domains talk to each other through two mechanisms:

  1. Synchronous - Via ports injected through the HexaRegistry during initialize(). Example: StandardsAdapter calls IGitPort.commitToGit().

  2. Asynchronous - Via domain events emitted through PackmindEventEmitterService. Example: StandardCreatedEvent triggers DeploymentsListener.handleStandardCreated().

See event.md and adapter.md for patterns.

Error Handling

A failure raised in a use case becomes an HTTP response through DomainExceptionFilter, registered globally as an APP_FILTER. The filter recognises an error by its kind. packages/types/src/errors/ declares three interfaces that carry one — DomainError, InternalError and UpstreamError — whose kind values do not overlap. They partition failures by fault: the caller's (DomainError), ours (InternalError), a third party's (UpstreamError). Fault is the axis, not the HTTP status class — classify by whose fault it is, then read the status off the table:

kindHTTPLog levelMessage returnedFrontend retries
not_found404warnyesno
forbidden403warnyesno
invalid_input400warnyesno
conflict409warnyesno
internal (PackmindInternalError)500error + stackno, generic bodyyes, once
upstream_unavailable (PackmindUpstreamError)502warnyesyes, once
upstream_rate_limited (PackmindUpstreamError)429warnyes, plus Retry-Afterno

Two rows look wrong until you read them by fault, so leave them alone. upstream_unavailable answers 502, not 503: a 503 claims we are unavailable, while it is the thing behind us that failed. upstream_rate_limited answers a 4xx and is still not a DomainErrorKind: the caller did not misuse the API — our shared credential hit someone else's quota, and waiting, not a corrected request, is the remedy. When the provider said how long to wait, the error carries retryAfterSeconds and the filter emits it as the Retry-After header.

Never throw new Error(...) from a use case or a service. A bare Error carries no kind, so it reaches Nest's ExceptionsHandler and answers 500 with a full stack logged at error level — even when the correct answer was a 404.

Show full SKILL.md (285 more words)Show less

Controllers propagate; they never translate. No instanceof plus throw new NotFoundException(...) — the filter is the only place kind maps to a status.

They also never log. A catch block that does logger.error(msg, { error: error.message }) and then throw error; records an expected, caller-correctable failure at error level, throws away the stack and the typed context, and leaves the filter to log the same failure a second time at warn. Two records of one event, and the louder carries less. Delete the catch — the filter records it once, with more.

Listeners run outside the HTTP request scope, so the filter never sees their exceptions: a listener logs a domain error at warn, an upstream error at warn too, and an internal error at error with its stack.

Full rules, including the non-leaking cross-tenant rule, are in the domain-error-handling standard. See domain-layer.md for the class shape.

Key Base Classes (from @packmind/node-utils, error bases from @packmind/types)

ClassPurpose
BaseHexa<TOpts, TPort>Hexagon lifecycle (construct -> initialize -> destroy)
HexaRegistryCentral dependency injection container
AbstractMemberUseCase<C, R>Use case with org member authorization
AbstractSpaceMemberUseCase<C, R>Use case with org + space member authorization
AbstractAdminUseCase<C, R>Use case with admin authorization
AbstractRepository<T>Base TypeORM repository with soft delete support
PackmindListener<TAdapter>Event subscription base class
UserAccessErrorReference shape for a domain error: kind + literal reason union + typed context + fixed message
PackmindInternalError (@packmind/types)Base for a broken invariant: reason + context + message; the message is for the log only, never returned
PackmindUpstreamError (@packmind/types)Base for a third-party failure: same shape plus a kind and an optional retryAfterSeconds; unlike PackmindInternalError, its message is returned to the caller
DomainExceptionFilterGlobal APP_FILTER; holds the only kind -> HTTP status mapping, for domain and upstream kinds alike (@packmind/node-utils/filters)
PackmindEventEmitterServiceEvent bus for domain events

© PackmindHub, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 13 other files in packages/.agents/skills/hexagonal-architecture of PackmindHub/packmind.

  • SKILL.md
  • components/adapter.md
  • components/contract.md
  • components/event.md
  • components/hexa-facade.md
  • components/listener.md
  • components/port.md
  • components/repository.md
  • components/schema.md
  • components/service.md
  • components/usecase.md
  • layers/application-layer.md
  • layers/domain-layer.md
  • layers/infrastructure-layer.md

Open the folder on GitHubat commit 8a10541

Compare with similar skills

Hexagonal Architecture next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Hexagonal Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Hexagonal Architecture this skillPackmindHub/packmind317—~2.3kAutomated safety check: PassApache-2.0
Nx Importnrwl/nx29k6 repos~3.5kAutomated safety check: PassMIT
Nx Workspacenomcopter/react-mosaic4.8k8 repos~1.9kAutomated safety check: PassCustom licence
Electron Multi-Process ArchitectureiOfficeAI/AionUi33k1 repos~1.8kAutomated safety check: PassApache-2.0
Nx Run Tasksnomcopter/react-mosaic4.8k8 repos~613Automated safety check: PassCustom licence
Astro Developerwithastro/astro63k1 repos~1.5kAutomated safety check: PassCustom licence

Similar skills

  • Nx Import

    nrwl/nx

    Import, merge, or combine repositories into an Nx workspace using nx import.

    29k GitHub starsUsed in 6 repos~3.5k tokens
    DevelopmentAuto-check passed
  • Nx Workspace

    nomcopter/react-mosaic

    Explore and understand Nx workspaces. An agent skill from nomcopter/react-mosaic.

    4.8k GitHub starsUsed in 8 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Tells the agent where new code belongs in an Electron multi-process project and which APIs each process may use, with rules for new bridges, services, agents and workers.

    33k GitHub starsUsed in 1 repo~1.8k tokens
    DevelopmentAuto-check passed
  • Nx Run Tasks

    nomcopter/react-mosaic

    Helps with running tasks in an Nx workspace. An agent skill from nomcopter/react-mosaic.

    4.8k GitHub starsUsed in 8 repos~613 tokens
    DevelopmentAuto-check passed
  • Astro Developer

    withastro/astro

    Official

    Comprehensive guide for developing in the Astro monorepo. An agent skill from withastro/astro.

    63k GitHub starsUsed in 1 repo~1.5k tokens
    DevelopmentAuto-check passed
  • Moves a package from another TryGhost repository into Ghost as an internal workspace package while keeping its Git history, with checkpoints for the steps that need an administrator.

    55k GitHub stars~3.8k tokensUpdated today
    DevelopmentAuto-check passed

More from PackmindHub/packmind

All 35 skills in this repo
  • Michel CLI Demo Recorder

    PackmindHub/packmind

    Produce proof-of-execution demos of the Packmind CLI (packmind-cli) as terminal-styled images (colors and formatting preserved exactly), for embedding in a GitHub PR.

    317 GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Michel UI Demo Recorder

    PackmindHub/packmind

    Record polished UI demo videos and screenshots of a running web app using Playwright MCP — for client deliverables, release notes, feature walkthroughs, or bug repros.

    317 GitHub stars~6.4k tokensUpdated today
    Auto-check passed
  • Packmind Create Skill

    PackmindHub/packmind

    Guide for creating effective skills. An agent skill from PackmindHub/packmind.

    317 GitHub stars~3.5k tokensUpdated today
    Auto-check: notes
  • Doc Audit

    PackmindHub/packmind

    Audit Packmind end-user documentation (apps/doc/) for broken links, outdated CLI references, non-existent concepts, misleading information, and missing coverage.

    317 GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Feature Sprint

    PackmindHub/packmind

    Execute the implementation plan produced by /feature-spec. An agent skill from PackmindHub/packmind.

    317 GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Review an implemented GitHub issue the way a senior Packmind engineer would — the human-judgment checks that ESLint, the TypeScript compiler, and e2e tests cannot catch (authorization scoping…

    317 GitHub stars~2.7k tokensUpdated today
    Auto-check passed

Categories

Questions about Hexagonal Architecture

What does Hexagonal Architecture do?

Describes the hexagonal architecture (ports and adapters) used across the Packmind monorepo. Hexagonal Architecture is an agent skill from PackmindHub/packmind. Describes the hexagonal architecture (ports and adapters) used across the Packmind monorepo.

When should I use Hexagonal Architecture?

Hexagonal Architecture fits situations like: tasks that involve Monorepo tooling.

How do I install Hexagonal Architecture in Claude Code?

Run `npx skills add PackmindHub/packmind --skill hexagonal-architecture -a claude-code`. Or copy the skill folder (packages/.agents/skills/hexagonal-architecture in PackmindHub/packmind) into .claude/skills/hexagonal-architecture in your project. Claude Code loads it when a task matches its description.

How do I install Hexagonal Architecture in Codex?

Run `npx skills add PackmindHub/packmind --skill hexagonal-architecture -a codex`. Or copy the skill folder (packages/.agents/skills/hexagonal-architecture in PackmindHub/packmind) into .agents/skills/hexagonal-architecture in your project. Codex loads it when a task matches its description.

Can I use Hexagonal Architecture in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PackmindHub/packmind --skill hexagonal-architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/hexagonal-architecture, .gemini/skills/hexagonal-architecture, .github/skills/hexagonal-architecture and .opencode/skills/hexagonal-architecture in your project.

What does Hexagonal Architecture need to run?

SKILL.md names no scripts, command-line tools or credentials: Hexagonal Architecture is instructions for the agent only.

Does Hexagonal Architecture access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Hexagonal Architecture safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Hexagonal Architecture use?

Hexagonal Architecture is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Hexagonal Architecture use?

About 2.3k tokens (SKILL.md is roughly 9.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Hexagonal Architecture?

Skills that share tags, products or a category with Hexagonal Architecture: Nx Import (nrwl/nx, 29k stars), Nx Workspace (nomcopter/react-mosaic, 4.8k stars), Electron Multi-Process Architecture (iOfficeAI/AionUi, 33k stars) and Nx Run Tasks (nomcopter/react-mosaic, 4.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Hexagonal Architecture?

PackmindHub (a GitHub organization) maintains it in PackmindHub/packmind, which has 317 GitHub stars. The repository holds 35 skills in this directory. The repository was last updated on October 8, 2026.

Source: PackmindHub/packmind on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.