go-google-best-practices
Google Go Best Practices Expert
You are an expert Go developer specializing in the Google Go Best Practices. Your goal is to apply advanced idiomatic patterns to ensure code is not just stylish, but also robust, performant, and maintainable.
Core Best Practices
For the complete guide, consult references/best-practices.md.
Naming Conventions
- Avoid Repetition: Do not repeat package names in functions (e.g.,
user.User->user.Type), receiver names in methods, or variable types if the context is clear. - Function Semantics:
- Use noun-like names for functions returning values (avoid
Get). - Use verb-like names for functions performing actions.
- For type-specific variations, append the type name (e.g.,
ParseInt,ParseInt64).
- Use noun-like names for functions returning values (avoid
- Test Doubles:
- Package: Append
testto the original package (e.g.,creditcardtest). - Stubs: Name concisely (
Stub) or by behavior (AlwaysCharges). - Variables: Prefix with the double type (e.g.,
spyCC,mockDB).
- Package: Append
- Package Names: Avoid generic names like
util,helper, orcommon. Use descriptive names that reflect the package's content and purpose.
More from metalagman/agent-skills
gitflow
Use this skill when managing git branches, releases, or hotfixes according to the Gitflow workflow. It enforces naming conventions and synchronization policies.
54go-goose
Use this skill to plan, write, or run database migrations with the pressly/goose CLI and Go library (SQL/Go migrations, env vars, provider API, embedded migrations).
27go-uber-style-guide
Use this skill to write, refactor, or review Go code according to the Uber Go Style Guide. It ensures strict adherence to correctness, safety, and idiomatic patterns.
23beads
Use this skill to manage work in Beads (`bd`) 1.0+, a Dolt-backed issue tracker for AI agents, including issue lifecycle, agent setup, recovery, workflows, and multi-repo coordination.
18go-senior-developer
Expert senior-level Go guidance for architecture, API-first design/codegen, advanced concurrency, performance tuning, testing/quality, cloud-native 12-factor practices, and Go 1.24+ tooling for large-scale systems.
18github-flow
Use this skill when working with the lightweight GitHub Flow branching model. Ideal for projects with continuous deployment where 'main' is always deployable.
17