Claude Rules for Go

CLAUDE.md rules for Go development. Enforces idiomatic Go patterns, proper error handling, naming conventions, and Go module conventions.

12 rules matching Go

Go CLAUDE.md Rules

Go's idiomatic style is famously opinionated — `gofmt` settles formatting, the standard library is preferred over third-party alternatives, errors are values not exceptions, and interfaces are kept small and defined at the point of use. Claude Code knows Go well, but it doesn't always know your project's specific take on the idiomatic question: do you prefer the standard `errors` package or `pkg/errors`? Do you use generics or stick to the pre-generic style? How do you structure packages and what's your test-naming convention? Go-focused CLAUDE.md rules pin those project-level decisions so Claude stops second-guessing. The community CLAUDE.md examples below come from Go projects across the spectrum — CLI tools, infrastructure utilities, agent runtimes, web servers — and they're a useful starting point for the conventions you should encode in your own file. If you're writing a Go CLAUDE.md from scratch, prioritize the error-handling pattern and the package layout: they're where Claude makes the most consequential framework-shaped mistakes.

Why add Go rules to your CLAUDE.md?

Go has strong idioms that Claude sometimes misses — especially around error handling, interface design, and package naming. CLAUDE.md rules for Go projects typically enforce explicit error returns rather than panics, require using standard library packages over third-party alternatives where possible, and set expectations around how interfaces should be kept small and defined at the point of use.