Go code review
Skill Gisellesleeveless396/go-agent-skills/skills/(code-quality)/go-code-review
Provide Go agent skills for cleaner, idiomatic code across Claude Code, Cursor, Copilot, and more with one install
npx -y skills add Gisellesleeveless396/go-agent-skills --skill go-code-reviewAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Comprehensive code review checklist for Go projects. Evaluates code quality, idiomatic patterns, error handling, naming, package structure, and test coverage. Use when reviewing Go code, PRs, or before merging changes. Trigger examples: "review this code", "check this PR", "code review", "review Go file". Do NOT use for security-specific audits (use go-security-audit) or performance-specific analysis (use go-performance-review).
SKILL.md
4.3 KB, as published. Nobody here has run it
Go Code Review
Structured code review process for Go. Reviews should be constructive, specific, and cite the relevant principle behind each finding.
Review Process
Execute these steps in order. For each finding, classify severity:
- π΄ BLOCKER β Must fix before merge. Correctness, data loss, security.
- π‘ WARNING β Should fix. Maintainability, idiomatic Go, clarity.
- π’ SUGGESTION β Consider improving. Style, naming, documentation.
1. Correctness & Safety
Error Handling
- Every error is checked. No blank identifier
_discarding errors silently. - Errors are wrapped with context:
fmt.Errorf("fetch user %d: %w", id, err). - Error values compared with
errors.Is()/errors.As(), never==. - No
panicoutside ofinit()or truly unrecoverable situations. - Errors handled exactly once β no log-and-return patterns.
Nil Safety
- Pointer receivers checked before dereference when nil is a valid state.
- Map reads guarded or use comma-ok idiom.
- Channel operations consider closed/nil channels.
- Slice operations check bounds where relevant.
Concurrency
- Shared mutable state protected by
sync.Mutexor channels. - No goroutine leaks β every goroutine has a clear termination path.
- Context propagation: all blocking calls accept and respect
context.Context. sync.WaitGrouporerrgroup.Groupused for goroutine lifecycle.
2. API Design
- Exported functions have doc comments starting with the function name.
- Accept interfaces, return concrete types.
- Use functional options (
WithTimeout(d)) over config structs for optional params. - Context is always the first parameter:
func Foo(ctx context.Context, ...). - Return
erroras the last return value. - Avoid
boolparameters β prefer named types or options.
3. Idiomatic Go
- Uses
:=for local variables,varfor zero-value intent. - No unnecessary
elseafter return/continue/break. - Guard clauses and early returns reduce nesting.
deferused for cleanup, placed right after resource acquisition.rangeused over manual index iteration where appropriate.- Struct literals use field names.
- Interfaces defined at consumer, not producer.
4. Package Structure
- Package names are short, lowercase, singular nouns.
- No circular dependencies between packages.
internal/used for non-public packages.cmd/contains main packages, one per binary.- Clear separation of concerns β no god packages.
5. Testing
- Test functions follow
TestXxxnaming convention. - Table-driven tests used for multiple input/output combinations.
- Test helpers use
t.Helper()for clean stack traces. - No test logic in
init()β useTestMainwhen needed. - Tests use
testify/assertortestify/requireconsistently, or stdlib only. - Edge cases covered: empty input, nil, zero values, max values.
t.Parallel()used where safe.
6. Documentation
- All exported types, functions, and constants have doc comments.
- Doc comments start with the name of the entity.
- Package-level doc comment in
doc.gofor non-trivial packages. - Complex algorithms or business logic have inline comments explaining why.
7. Dependencies
go.modhas no replace directives in committed code (except monorepos).- No unused dependencies.
- Dependencies are from well-maintained, reputable sources.
- Indirect dependencies are understood and acceptable.
Review Output Format
## Code Review Summary
**Files reviewed:** <list>
**Overall assessment:** APPROVE | REQUEST CHANGES | COMMENT
### Findings
#### π΄ BLOCKER: <title>
- **File:** `path/to/file.go:42`
- **Issue:** <what is wrong>
- **Why:** <which principle or guideline>
- **Fix:** <concrete suggestion>
#### π‘ WARNING: <title>
...
#### π’ SUGGESTION: <title>
...
### What's Done Well
<genuine positive observations β always include at least one>