What problem does it solve?
Go codebases often suffer from inconsistent style, fragile concurrency, unclear error handling, and poor package organization; this Skill provides concise, idiomatic patterns and practical guidance to make Go code predictable, maintainable, and efficient.
Core Features & Use Cases
- Idiomatic Patterns: Guidance on zero-value design, accepting interfaces and returning structs, small focused interfaces, and clear naming.
- Error Handling: Best practices for wrapping errors with context, using sentinel and custom error types, and checking errors with errors.Is and errors.As.
- Concurrency & Stability: Patterns for worker pools, context-based cancellation and timeouts, errgroup coordination, and avoiding goroutine leaks.
- Package & Tooling: Recommendations for standard project layouts, avoiding package-level state, functional options, embedding, and integrating gofmt, goimports, linters, and static analysis.
- Use Case: Perform a code review of a legacy HTTP service to replace global state with dependency injection, add proper context timeouts, and enforce linting and formatting rules.
Quick Start
Use the golang-patterns skill to review my Go package and recommend idiomatic refactors, concurrency safeguards, and linter configurations.