go-patterns

go-patterns is a skill for Claude Code, Codex from kouroshez/coding-os. It costs 62 tokens per session (726 once invoked), scanned A, original, Apache-2.0.

Project guidance for building backend services in Go, including HTTP handlers, business logic, request contexts, error handling, and table-driven tests.

In plain words
What is it for?
Use it when editing Go web handlers, services, standard-library routers, concurrency code, or backend tests.
Why use it?
It helps code return useful errors instead of crashing and keeps the service layers easier to test and maintain.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: reads .claude/ paths.

Good fit Use it when editing Go web handlers, services, standard-library routers, concurrency code, or backend tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kouroshez/coding-os/go-patterns
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.

Any agent
npx skills add kouroshez/coding-os --skill go-patterns
Clone the repo
git clone --depth 1 https://github.com/kouroshez/coding-os

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-patterns

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/kouroshez/coding-os/go-patterns"><img src="https://agentmods.dev/badge/skills/kouroshez/coding-os/go-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 726 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.00062 $0.00726
Opus 5 $0.00031 $0.00363
Sonnet 5 $0.00012 $0.00145
Haiku 4.5 $0.00006 $0.00073

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

Security

Grade A, and why

go-patterns 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 5d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/new_endpoint.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

src/templates/go/skills/go-patterns/SKILL.md · 69 lines

How it starts

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

REQUIRED BACKGROUND: You MUST also follow the clean-code skill (.claude/skills/clean-code/SKILL.md). That skill covers universal principles (fail-closed errors, self-documenting code, edge cases, error path tests). This skill adds Go-specific patterns on top.

Pre-Code Checklist

  • Read docs/engineering/go-rules.md — canonical backend policy
  • If touching HTTP handlers: read docs/playbooks/go-service.md
  • Confirm Go version (≥ 1.22 recommended for range-over-func)
  • Search the repo with Grep/Glob for existing code before creating a new file

1. Project layout

src/backend/
├── cmd/<app>/main.go        # entry point, wire dependencies
├── internal/
│   ├── http/                # handlers, middleware
│   ├── service/             # business logic (no net/http types)
│   ├── repo/                # data access
│   └── model/               # domain types
└── pkg/                     # optional: packages intended for external reuse

2. Error handling

  • Return errors, don't panic. Panic is for programming errors, not runtime conditions.
  • Wrap with fmt.Errorf("operation: %w", err) to preserve the chain.
  • Define sentinel errors for the domain: var ErrNotFound = errors.New("not found").
  • Check with errors.Is / errors.As, never with string matching.

3. Context

  • First argument of every function that crosses a service boundary: ctx context.Context.
  • Never store context in struct fields.
  • Propagate cancellation through service → repo → DB driver.

4. Concurrency

  • Goroutines need a clear owner and a way to stop. No fire-and-forget unless the lifetime is the process.
  • Use sync.WaitGroup + context.Context cancellation, or errgroup.Group.
  • Channels ≠ shared memory. Prefer simple mutex + struct when the data is small and fast.

5. Testing

  • Table-driven tests. Subtests via t.Run(tc.name, ...).
  • testing.T.TempDir() for filesystem fixtures.
  • Race detector in CI: go test -race ./....
  • Coverage target: ≥ 80%.

Read the full file on GitHub · 69 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 5d ago First seen · 69 lines · 62 tokens per session scan A c2290788f071

Subscribe to this mod's changes

go-patterns is a skill published in the GitHub repository kouroshez/coding-os (6 stars, last pushed yesterday), licensed Apache-2.0. It adds 62 tokens to every session and 726 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-09-03.

Related

Other skills, from other repositories

printing-press

Set up a new integration, connector, or CLI binding for any API. Wrap or generate a ship-ready Go CLI from an OpenAPI, HAR, or Postman spec via the lean research -> generate -> build -> shipcheck loop. Use when the user says build a CLI, wrap this API, set up a new integration, add a connector, integrate with a…

mvanhorn/cli-printing-press · 86 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

chi

Chi lightweight Go HTTP router. Covers routing, middleware, context, and patterns. Use for idiomatic, stdlib-compatible Go APIs. USE WHEN: user mentions "chi", "go-chi", "lightweight go router", "stdlib go router", asks about "chi middleware", "chi router", "chi context", "idiomatic go api", "net/http compatible…

claude-dev-suite/claude-dev-suite · 119 tokens

echo

Echo Go web framework. Covers routing, middleware, binding, context, and WebSocket. Use for high-performance, minimalist Go APIs. USE WHEN: user mentions "echo", "labstack echo", "go echo framework", asks about "echo middleware", "echo context", "echo binding", "echo websocket", "high performance go api", "echo…

claude-dev-suite/claude-dev-suite · 112 tokens

gin

Gin Go web framework. Covers routing, middleware, binding, validation, and rendering. Use for fast, minimalist Go APIs. USE WHEN: user mentions "gin", "gin-gonic", "go web framework", "go rest api", asks about "gin middleware", "gin binding", "gin validation", "gin router", "fast go api", "gin context" DO NOT USE FOR…

claude-dev-suite/claude-dev-suite · 114 tokens

fiber

Fiber Go web framework inspired by Express. Covers routing, middleware, context, WebSocket, and prefork. Use for Express-like Go development. USE WHEN: user mentions "fiber", "gofiber", "express-like go", "fasthttp go", asks about "fiber middleware", "fiber context", "fiber prefork", "fiber websocket", "go express"…

claude-dev-suite/claude-dev-suite · 120 tokens