go-conventionslisted
Install: claude install-skill tmj-90/gaffer
# Write idiomatic Go
Add Go that reads as idiomatic, handles every error explicitly, and matches the repo's
existing patterns — simple and correct, the Go way.
## Steps
1. **Read the lore first.** Call `search_lore` (Memory MCP) for the repo's Go
conventions and respect `go.mod` (module path, Go version), the linter config
(`golangci-lint`), and any architecture ADRs. Keep packages cohesive and named for
what they provide.
2. **Find a sibling package** and copy its patterns — package layout, error handling,
how interfaces are defined and consumed, and how tests are organised.
3. **Handle every error explicitly.** Never discard an `error` with `_` unless it is
genuinely ignorable and commented why. **Wrap with context** using `fmt.Errorf("doing
X: %w", err)` so the chain is inspectable with `errors.Is`/`errors.As`. Return early
on error; avoid deep nesting.
4. **Keep interfaces small** and **define them at the consumer**, not the producer.
Accept interfaces, return concrete types. Don't add an interface speculatively.
5. **Pointer-receiver rules:** be consistent within a type. Use a pointer receiver when
the method mutates the receiver, the struct is large, or any method needs a pointer
receiver (so the method set stays consistent); use value receivers for small immutable
value types.
6. **Concurrency with care.** Pass `context.Context` as the first argument to anything
that blocks or spans a request; never store a `Context` in a struct.