go-writing-code
Installation
SKILL.md
Go Writing Code
Quick reference for writing idiomatic, production-quality Go code. Each section summarizes the key rules — reference files provide full examples and edge cases.
Go Code Idioms
Naming
- MixedCaps — Go uses
MixedCapsormixedCaps, never underscores. Exported names start with uppercase. - Short names for short scopes —
ifor loop index,rfor reader,ctxfor context. Longer names for longer scopes. - Package names — Lowercase, single word, no underscores. The package name is part of the API:
http.Client, nothttp.HTTPClient. - Interface names — Single-method interfaces use method name +
ersuffix:Reader,Writer,Stringer. - Acronyms — All caps:
HTTPClient,userID,xmlParser.
Core Idioms
Related skills