go-uber-style-guide/SKILL.md
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.
npx skillsauth add metalagman/agent-skills go-uber-style-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in Go programming, specializing in the Uber Go Style Guide. Your goal is to help users write code that is clean, safe, and follows the absolute idiomatic patterns established by Uber.
These are the fundamental, non-negotiable rules for correctness and safety. For the complete style guide, consult references/style.md.
panic in production. Return errors instead. panic is only for truly irrecoverable states (e.g., nil dereference) or program initialization (aborting at startup).os.Exit or log.Fatal* only in main(). Prefer calling it at most once. All other functions must return errors.value, ok := interface{}.(Type)) for type assertions.fmt.Errorf with %w to wrap errors for the caller to match, or %v to obfuscate. Avoid "failed to" prefixes.init(): init() functions must not spawn goroutines. Manage background tasks via objects with explicit lifecycle methods.go.uber.org/atomic for type-safe atomic operations.error, string, make, new) as names. go vet should be clean.init(): Avoid init() unless necessary and deterministic. It must not perform I/O, manipulation of global/env state, or depend on ordering.MyStruct{Field: value}). (Exception: test tables with <= 3 fields).nil for empty slices. Check len(s) == 0 for emptiness. var declared slices are immediately usable.These are recommended practices for readability, maintenance, and performance.
var _ Interface = (*Type)(nil) to verify compliance at compile time where appropriate.sync.Mutex and sync.RWMutex are valid in their zero-value state. Do not use pointers to mutexes. Use non-pointer fields in structs.sync.WaitGroup for multiple goroutines, or chan struct{} (closed when done) for a single one.time Package: Always use the "time" package for all time operations.time.Time for instants and time.Duration for periods.time.Time/time.Duration with external systems. If not possible, use int/float64 with unit in the name (e.g., Millis), or RFC 3339 strings for timestamps..AddDate for calendar days, .Add for absolute 24-hour periods.strconv over fmt: Use strconv for primitive-to-string conversions.[]byte once and reuse.make() for maps and slices where possible to minimize reallocations.import, const, var, and type declarations. Group variables in functions if declared adjacently.if/else where a variable is set in both with a single update if possible._ for unexported top-level var/const (exception: err prefix on unexported errors).:= for explicit values, var for default zero-values. Minimize scope./* paramName */ for clarity. Use custom types instead of bool where appropriate.`) for multi-line or quoted strings.tests slice and tt case variable. Use give/want prefixes. Avoid complex logic inside subtests.Option interface and an unexported options struct.go tool <toolname> for invoking project-local tools.golangci-lint as the runner. Use the configuration in assets/.golangci.yml as a baseline.go.uber.org/goleak for goroutine leaks.const outside of Printf calls for go vet analysis.f.development
Use this skill to design, document, and structure AI agent skills for Gemini, Claude, and Codex. It provides architectural rules, directory standards, and writing best practices.
development
Use this skill to initialize, configure, and run omnidist release workflows for Go projects (`init`, `ci`, `build`, `stage`, `verify`, `publish`) including npm and uv publishing setup.
development
Use this skill to install and use the upstream powerman/golangci-lint-strict config for an exact golangci-lint version by fetching the versioned config file unchanged.
tools
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.