Guide
What you get: The agent writes idiomatic Go: ctx first, errors wrapped with %w, no panics, consumer-side interfaces, table-driven tests with t.Run, and it runs go vet and golangci-lint before finishing. Best for Go developers who want agents to follow standard Go error, context and testing idioms..
Before you start
- A Go module
- golangci-lint installed (the rules tell the agent to run it)
- Fill test_command (we used go test ./...)
- Cursor: .cursor/rules/go.mdc. Claude Code/Codex: the same text in CLAUDE.md / AGENTS.md
Worked example (Nov 14, 2026, Claude Code 2.1.318 (claude-opus-5-5); Codex 0.151.0 (gpt-5.6-sol))
Input
A small module (inventory service + in-memory warehouse client). Task: reserve a whole order (list of SKU + qty); if any item fails, release what was already reserved and return an error naming the SKU.
Result
Claude Code: ReserveOrder(ctx, []Item) with an ItemError type (Unwrap), release via context.WithoutCancel, errors.Join for release failures. Codex: ReserveOrder with fmt.Errorf("reserve order: sku %s: %w"), releases in reverse order.Not tested in Cursor or Copilot: the rule text was saved verbatim (front matter included) as CLAUDE.md for Claude Code and AGENTS.md for Codex, the files those agents load at startup, plus a copy at its normal path. Go 1.27.4 and golangci-lint 2.15.0. Both ran go vet, go test and golangci-lint run themselves; our re-run: gofmt clean, vet clean, tests pass, golangci-lint 0 issues, no panics, table-driven tests with t.Run. Codex also renamed the existing exported Reserver interface to StockManager, which wasn't needed (a bigger diff than 'keep diffs small' suggests).
How to check it worked
- Run go vet ./..., go test ./... and golangci-lint run
- Check errors.Is still works through the new wrapping
- Look for renamed exported identifiers in the diff
Common problems
- golangci-lint not installed: the agent can't follow the last rule; it should say so
- Agents may widen or rename an existing interface when they need a new method
Log in to join the discussion.