go-code-review
WHEN: User wants an automated first-pass code review on a PR, diff, or set of changes. Also when asked "review this PR", "review my changes", or "what do you think of this code?" WHEN NOT: Full project audits (use go-code-audit), or when user just wants linting (use go-lint-audit).
What this skill does
# Go Code Review
Automated PR code review for Go projects. Provides first-pass review with inline comments, quality scoring, and breaking change detection.
## What It Does
1. **Analyzes PR diff** for code quality issues
2. **Generates inline comments** on specific lines
3. **Produces a quality score** (0-100)
4. **Flags breaking API changes**
5. **Summarizes findings** with actionable next steps
## Steps
### API Integration (Optional)
If `GOPHER_GUIDES_API_KEY` is set, verify it:
```bash
curl -s -H "Authorization: Bearer $GOPHER_GUIDES_API_KEY" \
https://gopherguides.com/api/gopher-ai/me
```
If not set, local analysis tools (go vet, staticcheck, golangci-lint) still provide comprehensive analysis. Set the key for enhanced API-powered insights. Get your key at [gopherguides.com](https://gopherguides.com).
### 1. Get the Diff
```bash
# For a PR
gh pr diff {number}
# For uncommitted changes
git diff
# For staged changes
git diff --cached
# For changes against main
git diff main...HEAD
```
### 2. Static Analysis on Changed Files
```bash
# Get list of changed Go files
CHANGED=$(git diff --name-only main...HEAD | grep '\.go$')
# Run vet on changed packages
echo "$CHANGED" | xargs -I{} dirname {} | sort -u | xargs go vet
# Run staticcheck on changed packages
echo "$CHANGED" | xargs -I{} dirname {} | sort -u | xargs staticcheck
# Run tests on affected packages
echo "$CHANGED" | xargs -I{} dirname {} | sort -u | xargs go test -race -count=1
```
### 3. Review Checklist
For each changed file, check:
**Correctness**
- [ ] Error handling on all fallible operations
- [ ] No nil pointer dereferences
- [ ] Proper resource cleanup (defer Close)
- [ ] Context propagation in concurrent code
- [ ] No data races (channels/mutexes used correctly)
**Readability**
- [ ] Clear naming following Go conventions
- [ ] Functions are focused (single responsibility)
- [ ] Comments explain "why", not "what"
- [ ] No magic numbers/strings
**Maintainability**
- [ ] Tests added/updated for changes
- [ ] No dead code introduced
- [ ] Dependencies justified
- [ ] Backward compatibility preserved (or breaking change documented)
**Performance**
- [ ] No unnecessary allocations in hot paths
- [ ] Slices pre-allocated where size is known
- [ ] No unbounded goroutine creation
### 4. Breaking Change Detection
Check for API-breaking changes in exported symbols:
```bash
# Compare exported symbols between main and current branch
# Look for removed/renamed exported functions, types, methods
git diff main...HEAD -- '*.go' | grep -E "^-func [A-Z]|^-type [A-Z]|^-var [A-Z]|^-const [A-Z]"
```
**Breaking changes include:**
- Removed exported functions/types/methods
- Changed function signatures
- Changed struct field types
- Removed interface methods (breaks implementors)
- Changed package paths
### 5. Gopher Guides API Review
> **Note:** API calls send source code to gopherguides.com for analysis. Ensure your organization's policy permits external code analysis.
For full API usage examples, see [API Usage Reference](../references/api-usage.md).
### Severity Configuration
After installation via `install.sh`, review findings use severity levels from `.github/skills/config/severity.yaml`. See the [Setup Guide](../SETUP.md) for details.
## Output Format
```markdown
## Code Review Summary
**PR:** #{number} โ {title}
**Files Changed:** {count}
**Quality Score:** {score}/100
### ๐ด Must Fix ({n})
Issues that should be addressed before merge.
1. **`file.go:{line}`** โ {issue}
```go
// suggestion
```
### ๐ก Should Fix ({n})
Issues that improve code quality.
1. **`file.go:{line}`** โ {issue}
### ๐ข Nit ({n})
Minor style or preference items.
1. **`file.go:{line}`** โ {issue}
### โ ๏ธ Breaking Changes
{list of breaking API changes, or "None detected"}
### โ
What Looks Good
{positive feedback on well-written code}
### Tests
- [ ] New tests added for new functionality
- [ ] Existing tests pass
- [ ] Edge cases covered
### Recommendation
**{APPROVE | REQUEST_CHANGES | COMMENT}**
{brief summary of overall assessment}
```
## Quality Score Rubric
| Criteria | Points | Description |
|----------|--------|-------------|
| Error Handling | 20 | All errors checked and wrapped |
| Test Coverage | 20 | New code has tests |
| Naming/Style | 15 | Idiomatic Go conventions |
| Documentation | 15 | Exported symbols documented |
| Complexity | 15 | Functions focused, readable |
| Safety | 15 | No races, leaks, or panics |
## References
- Existing gopher-ai command: `plugins/go-workflow/commands/address-review.md`
- Gopher Guides API: `plugins/gopher-guides/skills/gopher-guides/`
- [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
---
*Powered by [Gopher Guides](https://gopherguides.com) training materials.*
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations โ diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.