Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications. Use this skill when writing, reviewing, or optimizing Go code, designing packages, writing tests, or benchmarking performance.
How this skill is triggered — by the user, by Claude, or both
Slash command
/golang-best-practices:golang-best-practicesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Comprehensive idiomatic Go patterns and best practices guide. Contains rules across 14 categories, prioritized by impact to guide automated code generation, review, and optimization.
references/_sections.mdreferences/anti-patterns.mdreferences/concurrency.mdreferences/doc-comments.mdreferences/error-handling.mdreferences/interface-design.mdreferences/memory-performance.mdreferences/package-organization.mdreferences/struct-design.mdreferences/testing-benchmarks.mdreferences/testing-http.mdreferences/testing-mocking.mdreferences/testing-patterns.mdreferences/testing-tdd.mdreferences/tool-gofix.mdreferences/tooling.mdComprehensive idiomatic Go patterns and best practices guide. Contains rules across 14 categories, prioritized by impact to guide automated code generation, review, and optimization.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Error Handling | CRITICAL | err- |
| 2 | Concurrency | CRITICAL | conc- |
| 3 | Table-Driven Tests | CRITICAL | tpat- |
| 4 | Interface Design | HIGH | iface- |
| 5 | Package Organization | HIGH | pkg- |
| 6 | Struct Design | HIGH | struct- |
| 7 | TDD Workflow | HIGH | tdd- |
| 8 | Mocking & Test Helpers | HIGH | tmock- |
| 9 | Benchmarks & Fuzzing | HIGH | tbench- |
| 10 | HTTP Handler Testing | HIGH | thttp- |
| 11 | Doc Comments | HIGH | doc- |
| 12 | Memory & Performance | MEDIUM-HIGH | perf- |
| 13 | Tooling Integration | MEDIUM | tool- |
| 14 | Anti-Patterns | MEDIUM | anti- |
Read individual rule files for detailed explanations and Go examples:
references/error-handling.md
references/concurrency.md
references/testing-patterns.md
references/_sections.md
Each rule file contains:
| Idiom | Description |
|---|---|
| Accept interfaces, return structs | Functions accept interface params, return concrete types |
| Errors are values | Treat errors as first-class values, not exceptions |
| Don't communicate by sharing memory | Use channels for coordination between goroutines |
| Make the zero value useful | Types should work without explicit initialization |
| A little copying is better than a little dependency | Avoid unnecessary external dependencies |
| Clear is better than clever | Prioritize readability over cleverness |
| Return early | Handle errors first, keep happy path unindented |
npx claudepluginhub bbaktaeho/bbaktaeho-agent-skills --plugin golang-best-practicesApplies idiomatic Go best practices for coding, PR reviews, and codebase audits. Covers errors, interfaces, concurrency, testing, organization, performance; routes to specialized skills.
Provides idiomatic Go patterns and best practices for simplicity, zero values, interfaces, error handling. Useful for writing, reviewing, refactoring, designing Go code.
Applies Go best practices for performance, modern syntax, generics, patterns, testing, error handling, and concurrency when writing or reviewing Go code.