go-hexagonal-architecture

go-hexagonal-architecture is a skill for Claude Code, Codex from makifbaysal/tasktrooper. It costs 43 tokens per session (1,053 once invoked), scanned A, original, Apache-2.0.

A guide to organising Go services with hexagonal architecture, where business rules stay separate from databases, HTTP handlers and other outside systems.

In plain words
What is it for?
Use it when adding use cases, interfaces called ports, repositories or adapters, including decisions about errors, transactions and package imports.
Why use it?
It prevents dependencies from pointing the wrong way and keeps storage or transport details from spreading through the business code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is go list -deps ./internal/domain/... ./internal/application/... | grep -E '/internal/adapter|gofiber|jackc/pgx|database/sql'.

Good fit Use it when adding use cases, interfaces called ports, repositories or adapters, including decisions about errors, transactions and package imports.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/makifbaysal/tasktrooper
agentmods
npx agentmods add skills/makifbaysal/tasktrooper/go-hexagonal-architecture

Made for: Claude Code, Codex.

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 go-hexagonal-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/go-hexagonal-architecture/github.svg)](https://agentmods.dev/skills/makifbaysal/tasktrooper/go-hexagonal-architecture)
Your own site
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/go-hexagonal-architecture"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/go-hexagonal-architecture/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 go-hexagonal-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/go-hexagonal-architecture"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/go-hexagonal-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,053 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.00043 $0.01053
Opus 5.5 $0.00017 $0.00421
Sonnet 5.5 $0.00009 $0.00211
Haiku 4.5 $0.00004 $0.00105

Measured 8d ago against content hash 6f0f83857047, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

go-hexagonal-architecture 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.

catalog/agents/backend-developer/skills/go-hexagonal-architecture/SKILL.md · 65 lines

How it starts

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

Hexagonal Architecture in Go

Detect the repo's layout first

get_repo_tree   # look for domain/port/application/adapter-named folders

Follow the repository's own names for these folders (internal/core, internal/service, whatever it already uses) — don't rename them to match this skill. Never restructure a repository that is not hexagonal in a feature task. If the repo has no layering at all, follow its existing flat/package-by-feature style instead of introducing hexagonal boundaries unasked.

Layers

  • Domain (innermost): entities, value types, domain errors. Imports nothing from the outer layers — no Fiber, no pgx, no HTTP, no JSON tags driving behavior.
  • Ports: interfaces (e.g. internal/port) describing what the application needs (repositories, clients) and offers (services).
  • Application: use-case services orchestrating domain logic through ports. Depends on domain and ports only.
  • Adapters: implementations at the edge — HTTP handlers, PostgreSQL repositories, external clients. Adapters import inward; nothing imports an adapter.

Rules

  • Dependency injection via constructors: NewService(store port.Store, ...). No globals, no init()-time wiring (Uber: "Avoid init()", "Exit in Main").
  • Cross-layer calls go through ports. A service never touches pgx directly; a handler never contains business logic.
  • New behavior starts with the port interface and its domain types, then the service, then the adapter — the test for the service uses a fake or mock of the port (mockery-suite-tests).
  • When adding a dependency, ask: does the domain need to know this exists? If yes, model it as a port; if no, keep it inside the adapter.
  • Verify interface compliance at compile time (Uber): var _ port.TaskStore = (*PGTaskStore)(nil) next to the adapter's constructor — a missing method fails the build, not a runtime wiring panic.
  • Copy slices and maps at boundaries (Uber) — a port implementation that hands back its internal slice lets the caller mutate state it doesn't own.

Read the full file on GitHub · 65 lines

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 · 65 lines · 43 tokens per session scan A 6f0f83857047

Subscribe to this mod's changes

go-hexagonal-architecture is a skill published in the GitHub repository makifbaysal/tasktrooper (113 stars, last pushed yesterday), licensed Apache-2.0. It adds 43 tokens to every session and 1,053 once invoked, about $0.0002 per session on Opus 5.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-10-05.

Related

Other skills, from other repositories

go

Use when writing, reviewing, testing, or shipping Go code and HTTP services: idioms, %w error wrapping, goroutine/context/errgroup concurrency, net/http 1.22 routing, log/slog, project layout, table-driven tests, Go hardening. NOT language-agnostic threat modeling (that is secure-coding), NOT Dockerfile/CI shipping…

ericrisco/rsc-harness · 86 tokens

go-services

Build and upgrade Go services, workers and CLI applications with context propagation and explicit ownership. Use when implementing Go HTTP/data/concurrency paths; preserve module and deployment constraints and verify race-sensitive behavior deterministically.

WrongStack/WrongStack · 43 tokens

go-add-entity

Add a full CRUD vertical slice (domain, DTO, repository, service, handler, migration, factory wiring) to an existing GOB Go microservice.

JotJunior/cstk · 35 tokens

go-add-consumer

Add a RabbitMQ event consumer to an existing GOB Go microservice.

JotJunior/cstk · 19 tokens

golang-context-patterns

Context usage patterns for Go including cancellation, timeouts, deadlines, and database transactions. Use when handling HTTP requests, database operations, or implementing cancellation and timeout logic.

codeready-toolchain/tarsy · 39 tokens

go-core

Go implementation guidance — stack-specific. Covers project structure, idiomatic patterns, testing, security, and observability for Go backend services and CLIs. Use when the user asks about Go-specific structure, error handling, concurrency, testing strategy, or production reliability. Invoke via @go-core after…

adonai-labs/agent-runway · 76 tokens