go-code-review
Auto-review Go code for 100+ common mistakes when analyzing .go files, discussing Go patterns, or reviewing PRs with Go code. Checks error handling, concurrency, interfaces, performance, testing, and stdlib usage.
When & Why to Use This Skill
The Go Code Review skill is an automated static analysis tool for Claude designed to identify over 100 common Go programming pitfalls. By analyzing .go files and pull requests, it provides structured feedback on concurrency safety, error handling, interface design, and performance, ensuring your codebase follows idiomatic Go patterns and industry best practices.
Use Cases
- Automated Pull Request Audits: Streamline the peer review process by automatically catching critical issues like data races, unclosed resources, and ignored errors before merging code.
- Technical Debt Reduction: Scan legacy Go repositories to identify and refactor 'interface pollution', inefficient string concatenations, or improper goroutine lifecycles.
- Developer Onboarding and Mentoring: Use the skill as a real-time tutor for junior developers to learn idiomatic Go patterns and avoid the '100 common mistakes' during the coding process.
- Performance and Reliability Optimization: Detect subtle concurrency bugs and memory leaks in high-performance Go services by analyzing mutex usage and resource management patterns.
| name | go-code-review |
|---|---|
| description | Auto-review Go code for 100+ common mistakes when analyzing .go files, discussing Go patterns, or reviewing PRs with Go code. Checks error handling, concurrency, interfaces, performance, testing, and stdlib usage. |
| allowed-tools | Read,Grep |
Go Code Review Skill
Auto-triggers when reviewing Go code to catch common mistakes from https://100go.co/
Review Process
- Read Go file(s) mentioned
- Check against patterns in [[knowledge-base.md]]
- Report issues with:
- Severity (Critical/Major/Minor)
- Location (file:line)
- Mistake # from knowledge base
- Suggested fix
- Code example if applicable
Priority Checks
Critical (must fix):
- Error handling (#48-54): ignored errors, incorrect wrapping/comparison
- Concurrency (#58, 69, 70, 74): data races, mutex misuse, sync type copying
- Resource leaks (#26, 28, 76, 79): unclosed resources, memory leaks
Major (should fix):
- Interface design (#5-7): pollution, wrong side, returning interfaces
- Goroutine lifecycle (#62, 63): no stop mechanism, loop var capture
- Testing (#83, 86): no race flag, sleep in tests
Minor (consider):
- Code organization (#1, 2, 15): shadowing, nesting, missing docs
- Performance (#21, 27, 39): unoptimized init, string concat
Reference Knowledge Base
See [[knowledge-base.md]] for full 100 Go mistakes reference.
Example Output
**Issue**: Error not wrapped with context
**Severity**: Major
**Location**: handler.go:42
**Mistake**: #49 - Ignoring When to Wrap an Error
**Fix**: Use `fmt.Errorf("fetch user: %w", err)` instead of returning raw error
**Pattern**: Always wrap errors for context/traceability