Go Declarations & Initialization
Enforces idiomatic Go variable, constant, and struct declaration patterns based on Google and Uber style guides.
This skill equips Claude with specialized knowledge for writing production-ready Go code by standardizing how variables, constants, structs, and maps are declared and initialized. It automates complex stylistic decisions such as choosing between 'var' and the short declaration operator (:=), implementing safe iota enum patterns, and optimizing variable scope through if-init blocks. By incorporating industry standards from Google and Uber, it ensures that Go codebases remain consistent, readable, and free from common pitfalls like variable shadowing or inefficient literal formatting.
Key Features
01Optimizes variable scoping using idiomatic if-init blocks
02Implements safe iota enum patterns with zero-value defaults
03Enforces field-named struct initialization and composite literal rules
04Modernizes codebases by replacing interface{} with the any keyword
05Standardizes 'var' vs ':=' usage based on scope and intent
0677 GitHub stars
Use Cases
01Ensuring Go 1.18+ compatibility and modern syntax across a repository
02Refactoring legacy Go projects to align with Google or Uber style standards
03Scaffolding new Go services with idiomatic constant and struct patterns