go-clean-architecture

go-clean-architecture is a skill for Claude Code from muratmirgun/gophers. It costs 70 tokens per session (2,420 once invoked), scanned A, original, MIT.

Guidance for organizing a Go service into separate business, use-case, data-access, and HTTP or delivery layers. The design keeps the business rules independent of web frameworks and databases.

In plain words
What is it for?
Use it when starting or refactoring a Go service, separating a monolith, defining repository interfaces, or checking that business logic does not depend on HTTP or database code.
Why use it?
It makes business logic easier to test and lets you replace the HTTP framework or database without rewriting the core of the service.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code; built for openclaw.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is Read [references/domain.md](../../../skills/go-clean-architecture/references/domain.md), [references/usecase.md](../../../skills/go-clean-architecture/reference.

Part of the gophers plugin — 26 skills, 4 agents shipped together

Good fit Use it when starting or refactoring a Go service, separating a monolith, defining repository interfaces, or checking that business logic does not depend on HTTP or database code.

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/muratmirgun/gophers
agentmods
npx agentmods add skills/muratmirgun/gophers/go-clean-architecture

Made for: Claude Code.

Or install gophers, the plugin that ships this one along with the rest of its 26 skills, 4 agents.

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-clean-architecture

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/muratmirgun/gophers/go-clean-architecture"><img src="https://agentmods.dev/badge/skills/muratmirgun/gophers/go-clean-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,420 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.00070 $0.02420
Opus 5 $0.00035 $0.01210
Sonnet 5 $0.00014 $0.00484
Haiku 4.5 $0.00007 $0.00242

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

Security

Grade A, and why

go-clean-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 10d 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.

.claude-plugin/skills/go-clean-architecture/SKILL.md · 189 lines

How it starts

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

Go Clean Architecture

A Go service organized into four concentric layers — Domain, Usecase, Repository, Delivery — where source code depends inward only. Done well, the HTTP framework and the database are interchangeable details; the business logic is testable without either.

This skill is framework-agnostic. Swap Gin for Fiber, Echo, Chi, or net/http by replacing the delivery layer — zero changes elsewhere.

Core Rules

  1. Dependency Rule. Source depends inward: Delivery → Usecase → Domain. Repository implements interfaces declared in Domain. Domain depends on nothing.
  2. Framework is a detail. Gin/Fiber/Echo/Chi/net-http types live only in internal/delivery/. Usecases see plain Go values.
  3. Database is a detail. SQL, sqlx, sqlc, pgx, GORM live only in internal/repository/. Usecases see repository interfaces.
  4. Domain owns the interfaces; layers below provide implementations. UserRepository is an interface in internal/domain; the Postgres struct is in internal/repository and unexported.
  5. DTOs at the edges. Delivery layer maps HTTP request bodies to domain inputs and domain entities to response bodies. Usecases never see *gin.Context, http.Request, or DB rows.
  6. cmd/<binary>/main.go is the only place that knows the whole system. Wiring (DI) is explicit, framework-free Go code.

When This Pays Off

Symptom What clean architecture buys you
HTTP handlers contain SQL Move SQL into a repository; handlers shrink to 5 lines
Tests need a running DB Mock the repository interface; usecase tests run in milliseconds
Swapping web frameworks is a rewrite Replace internal/delivery/http; nothing else touched
Business rules duplicated across handlers Single usecase function, called by HTTP, gRPC, and a CLI
ORM hooks fire in surprising places Repository methods are explicit; no hidden behavior

If the service is a 200-line cron job, this skill is overkill. If it will live 3+ years and grow features, it's the cheapest insurance you can buy.

Read the full file on GitHub · 189 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. 10d ago First seen · 189 lines · 70 tokens per session scan A 5ce9c776bc0a

Subscribe to this mod's changes

go-clean-architecture is a skill published in the GitHub repository muratmirgun/gophers (8 stars, last pushed 1mo ago), licensed MIT. It adds 70 tokens to every session and 2,420 once invoked, about $0.0003 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

go

Use when writing Go services, CLIs, or libraries. Covers idiomatic error wrapping, goroutine and context discipline, interface design, table-driven tests, and the race detector.

nimadorostkar/Claude-Skills-collection · 38 tokens

golang-pro

Implements concurrent Go patterns using goroutines and channels, designs and builds microservices with gRPC or REST, optimizes Go application performance with pprof, and enforces idiomatic Go with generics, interfaces, and robust error handling. Use when building Go applications requiring concurrent programming…

Jeffallan/claude-skills · 95 tokens

go-programming-expert

Expert-level skill for Go programming (Go 1.25+). Covers high-performance microservices, concurrency patterns, sqlc, net/http, Gin/Echo/Fiber, gRPC, and testing in English and Indonesian.

roedyrustam/vibes-plug · 51 tokens

encore-go-api

Define typed API endpoints in Encore Go using //encore:api annotations. Covers typed request/response structs, path/query/header/cookie params, and error returns. For raw endpoints (//encore:api raw) and inbound webhooks, use encore-go-webhook instead.

encoredev/skills · 66 tokens

encore-go-webhook

Receive inbound webhooks from external services (Stripe, GitHub, Slack, Twilio, etc.) in Encore Go using //encore:api raw. The right skill any time the user names a third-party provider that POSTs events to a URL you own.

encoredev/skills · 60 tokens

encore-go-bucket

Store unstructured files in Encore Go using objects.NewBucket from encore.dev/storage/objects — uploads, images, documents, blobs.

encoredev/skills · 37 tokens