go-patterns

go-patterns is a skill for Claude Code, Codex from kouroshez/coding-os. It costs 62 tokens per session (718 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 718 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.00718
Opus 5.5 $0.00025 $0.00287
Sonnet 5.5 $0.00012 $0.00144
Haiku 4.5 $0.00006 $0.00072

Measured 8d ago against content hash 632207ae3af8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 8d 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. 8d ago Changed 632207ae3af8
  2. 3mo 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 (7 stars, last pushed 4d ago), licensed Apache-2.0. It adds 62 tokens to every session and 718 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-09-03.

Related

go-patterns compared with skills from other repositories

go-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
go-patternskouroshez/coding-osSkill74d agoApache-2.0A62Claude Code, Codex
api-clienteSlider/2dphSkill323d agoMITA0Claude Code, Codex
golang-proJeffallan/claude-skillsSkill13kyesterdayMITA95Claude Code
golang-graphqlsamber/cc-skills-golangSkill4.1k3d agoMITA77Claude Code
platform-constrained-handlerclidey/whodbSkill5.1kyesterdayApache-2.0A26Claude Code, Codex
golang-grpcsamber/cc-skills-golangSkill4.1k3d agoMITA72Claude Code
golang-swaggersamber/cc-skills-golangSkill4.1k3d agoMITA146Claude Code