golang-clean-architecture

golang-clean-architecture is a skill for Claude Code, Codex from saifoelloh/golang-best-practices-skill. It costs 41 tokens per session (1,532 once invoked), scanned A, original, MIT.

A review guide for Go services that checks whether code follows Clean Architecture. This approach separates the interface, business workflows, data access, and core business rules so they can change independently.

In plain words
What is it for?
Use it when reviewing or planning Go services with gRPC, HTTP, use-case, repository, and domain layers, including refactoring and dependency-injection work.
Why use it?
It helps find misplaced business logic and dependencies that make a service harder to test, change, or maintain.

Skill for Claude CodeCodex

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

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is - [golang-design-patterns](../design-patterns/SKILL.md) - For refactoring large usecases.

Good fit Use it when reviewing or planning Go services with gRPC, HTTP, use-case, repository, and domain layers, including refactoring and dependency-injection work.

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/saifoelloh/golang-best-practices-skill
agentmods
npx agentmods add skills/saifoelloh/golang-best-practices-skill/clean-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 golang-clean-architecture

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/saifoelloh/golang-best-practices-skill/clean-architecture"><img src="https://agentmods.dev/badge/skills/saifoelloh/golang-best-practices-skill/clean-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,532 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.00041 $0.01532
Opus 5 $0.00020 $0.00766
Sonnet 5 $0.00008 $0.00306
Haiku 4.5 $0.00004 $0.00153

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

Security

Grade A, and why

golang-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 12d 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.

clean-architecture/SKILL.md · 206 lines

How it starts

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

Golang Clean Architecture

Audit Go services for Clean Architecture compliance. Ensures proper layering, dependency rules, and separation of concerns in gRPC → Usecase → Repository → Domain architectures.

When to Apply

Use this skill when:

  • Auditing service architecture
  • Reviewing new features for layer violations
  • Refactoring toward Clean Architecture
  • Code review for dependency rules
  • Planning service structure
  • Migrating to layered architecture
  • Ensuring testability through dependency injection

Architecture Layers

┌─────────────────────────────────────┐
│  Delivery (gRPC/HTTP/GraphQL)       │ ← Thin, no business logic
├─────────────────────────────────────┤
│  Usecase (Business Logic)           │ ← Orchestration
├─────────────────────────────────────┤
│  Repository (Data Access)           │ ← CRUD only
├─────────────────────────────────────┤
│  Domain (Entities/Interfaces)       │ ← Pure business logic
└─────────────────────────────────────┘

Dependency Rule: Dependencies point INWARD only (toward domain).

Rules Covered (9 total)

High-Impact Patterns (4)

  • high-business-logic-handler - Keep delivery layer thin
  • high-business-logic-repository - No business logic in data layer
  • high-constructor-creates-deps - Inject dependencies, don't create
  • high-transaction-in-repository - Transactions belong in usecase

Architecture Rules (5)

  • arch-domain-import-infra - Domain must not import infrastructure
  • arch-concrete-dependency - Depend on interfaces, not concrete types
  • arch-repository-business-logic - Repositories do CRUD only
  • arch-usecase-orchestration - Usecases orchestrate, entities decide
  • arch-interface-segregation - Small, consumer-defined interfaces

Common Violations

❌ Business Logic in Handler

// gRPC handler doing calculations
func (h *Handler) CreateOrder(ctx context.Context, req *pb.Request) (*pb.Response, error) {
    total := req.Price * req.Quantity // BAD: calculation in handler
    discount := total * 0.1           // BAD: business rules in delivery layer
    
    order := &domain.Order{
        Total: total - discount,
    }
    return h.orderRepo.Save(ctx, order)
}

Read the full file on GitHub · 206 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. 12d ago First seen · 206 lines · 41 tokens per session scan A 49715669ec93

Subscribe to this mod's changes

golang-clean-architecture is a skill published in the GitHub repository saifoelloh/golang-best-practices-skill (15 stars, last pushed 6mo ago), licensed MIT. It adds 41 tokens to every session and 1,532 once invoked, about $0.0002 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-30.