← ClaudeAtlas

go-naminglisted

Go naming conventions for packages, functions, methods, variables, constants, and receivers from Google and Uber style guides. Use when naming any identifier in Go code—choosing names for types, functions, methods, variables, constants, or packages—to ensure clarity, consistency, and idiomatic style.
dwana1/golang-skills · ★ 0 · AI & Automation · score 72
Install: claude install-skill dwana1/golang-skills
# Go Naming Conventions > **Normative**: Core naming rules (MixedCaps, no underscores) are required per > Google's canonical Go style guide. Advisory guidance provides best practices > for clarity and maintainability. ## Core Principle Names should: - Not feel repetitive when used - Take context into consideration - Not repeat concepts that are already clear Naming is more art than science—Go names tend to be shorter than in other languages. --- ## MixedCaps (Required) > **Normative**: All Go identifiers must use MixedCaps. Go uses `MixedCaps` or `mixedCaps` (camel case), never underscores (snake case). ```go // Good MaxLength // exported constant maxLength // unexported constant userID // variable URLParser // type with initialism // Bad MAX_LENGTH // no snake_case max_length // no underscores User_Name // no underscores in names ``` ### Exceptions for Underscores Names may contain underscores only in these cases: 1. **Test functions**: `TestFoo_InvalidInput`, `BenchmarkSort_LargeSlice` 2. **Generated code**: Package names only imported by generated code 3. **OS/cgo interop**: Low-level libraries matching OS identifiers (rare) **Note**: Filenames are not Go identifiers and may contain underscores. --- ## Package Names > **Normative**: Packages must be lowercase with no underscores. Package names must be: - Concise and lowercase only - No underscores (e.g., `tabwriter` not `tab_writer`) - Not likely to shadow common variables ```go //