go-arch-auditor

go-arch-auditor is an agent for Claude Code from muratmirgun/gophers. It costs 88 tokens per session (2,144 once invoked), scanned A, original, MIT.

A coding agent that checks whether a Go service follows clean architecture, an arrangement that keeps business rules separate from delivery code, databases, and frameworks.

In plain words
What is it for?
Use it to inspect import relationships in services organised with cmd/ and internal/ layers, report violations with file and line references, and guide refactoring.
Why use it?
It exposes tangled dependencies, such as HTTP or database details leaking into core business logic, before they make testing and future changes harder.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; mentions subagents.

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

Good fit Use it to inspect import relationships in services organised with cmd/ and internal/ layers, report violations with file and line references, and guide refactoring.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/muratmirgun/gophers/go-arch-auditor
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.

Clone the repo
git clone --depth 1 https://github.com/muratmirgun/gophers

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-arch-auditor

README.md
[![agentmods](https://agentmods.dev/badge/agents/muratmirgun/gophers/go-arch-auditor.svg)](https://agentmods.dev/agents/muratmirgun/gophers/go-arch-auditor)
Your own site
<a href="https://agentmods.dev/agents/muratmirgun/gophers/go-arch-auditor"><img src="https://agentmods.dev/badge/agents/muratmirgun/gophers/go-arch-auditor.svg" alt="Measured on agentmods" height="20"></a>
Per session 88 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,144 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.00088 $0.02144
Opus 5 $0.00044 $0.01072
Sonnet 5 $0.00018 $0.00429
Haiku 4.5 $0.00009 $0.00214

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

Security

Grade A, and why

go-arch-auditor 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 7d 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.

agents/go-arch-auditor.md · 175 lines

How it starts

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

go-arch-auditor

A subagent that walks a Go module's import graph against the layering rules in the go-clean-architecture skill. It reports violations; it does not rewrite code.

When to Dispatch

Dispatch when:

  • A service has grown past ~3 packages and the layering is unclear
  • Tests need a live database (signal that mocks-via-interface is missing)
  • The team is planning a framework swap (Gin → Echo, sqlx → pgx)
  • A code review surfaces "this looks tangled" without specifics
  • Onboarding a new service to the gophers convention set

Do not dispatch when:

  • The project is < 200 LoC or a single-package CLI (overkill)
  • The project is not organised under cmd/ + internal/ (different convention — audit not applicable)
  • The author already knows the violations and is mid-refactor

Input Contract

Input Format Example
module_root path to module ./ or /abs/path/to/myapp
layout (optional) standard | custom defaults to standard (internal/domain, internal/usecase, internal/repository, internal/delivery)
custom_layers (optional) JSON map {"domain": "pkg/core", "usecase": "pkg/app"}
strictness (optional) strict | lenient strict flags interface returns from constructors; lenient accepts them

Process

  1. Load the underlying skill. Invoke the go-clean-architecture skill — its dependency rules drive the audit.
  2. Detect the layout.
    • Run go list -f '{{.ImportPath}}' ./... to enumerate packages
    • Verify the four layer roots exist (internal/domain, internal/usecase, internal/repository, internal/delivery)
    • If missing, report "layer-missing" and stop
  3. Compute per-package import sets.
    go list -deps -f '{{.ImportPath}} {{range .Imports}}{{.}} {{end}}' ./...
    
  4. Check each layer's allowed-import rules:
    • domain — only standard library
    • usecase — only domain (and stdlib + tiny helpers like cmp, slices)
    • repositorydomain + DB driver (database/sql, pgx, gorm.io/...)
    • deliverydomain + usecase + the framework (gin/echo/fiber/chi/net-http)
  5. Check constructor return types:
    • Every NewX in usecase and repository should return a domain interface, not a concrete type (only in strict mode)
  6. Check wiring location:
    • internal/repository should only be imported by cmd/*/main.go, never by internal/delivery/...
  7. Check for framework leak:
    • internal/usecase and internal/domain must not import gin, echo, fiber, chi, net/http, database/sql, gorm, pgx, sqlx
  8. Check for DTO leak:
    • Domain entities should not have HTTP/JSON-only fields (heuristic: binding: or form: struct tags in internal/domain/*.go)
  9. Group findings by severity:
    • Must Fix — domain imports a framework or driver; delivery imports repository concrete type; usecase imports *sql.DB
    • Should Fix — constructor returns concrete type instead of interface; ORM types cross repository boundary
    • Nit — wiring split across multiple init() funcs instead of main.go

Read the full file on GitHub · 175 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. 7d ago First seen · 175 lines · 88 tokens per session scan A 5a3f32516ac3

Subscribe to this mod's changes

go-arch-auditor is an agent published in the GitHub repository muratmirgun/gophers (8 stars, last pushed 27d ago), licensed MIT. It adds 88 tokens to every session and 2,144 once invoked, about $0.0004 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 agents, from other repositories

go-reviewer

Run Go static analysis tools and generate a categorized review report. Use before committing or creating PRs for Go code.

NYTC69/review-loop · 27 tokens

go-backend

Go Backend Execution Agent.

PlanVault/ai-engineering-playbook · 8 tokens

go-reviewer

Expert Go code reviewer specializing in idiomatic Go, concurrency patterns, error handling, and performance. Use for all Go code changes. MUST BE USED for Go projects.

sjarmak/coding-agent-workflows · 37 tokens

agent-sdk-verifier-py

Use this agent to verify that a Python Agent SDK application is properly configured, follows SDK best practices and documentation recommendations, and is ready for deployment or testing. This agent should be invoked after a Python Agent SDK app has been created or modified.

anthropics/claude-plugins-official · 55 tokens

java-refactor-expert

Expert Java and Spring Boot code refactoring specialist. Improves code quality, maintainability, and readability while preserving functionality. Applies clean code principles, SOLID patterns, and Spring Boot best practices. Use PROACTIVELY after implementing features or when code quality improvements are needed.

giuseppe-trisciuoglio/developer-kit · 61 tokens

go-concurrency-reviewer

Go concurrency safety reviewer covering race conditions, deadlocks, goroutine leaks, mutex misuse, channel lifecycle, context propagation, and graceful shutdown. Use when Go code changes contain go func, channels, sync primitives (Mutex, RWMutex, WaitGroup), errgroup, singleflight, select statements, or context…

johnqtcg/awesome-skills · 85 tokens