Review code for quality, run linters, check test coverage, fix issues, and enforce gates. Save the final report to ./specs/issues/003-code-review-pi/PROMPT.md. Use before committing changes.
Review code for quality, run linters, check test coverage, fix issues, and enforce gates. Save the final report to ./specs/issues/003-code-review-pi/PROMPT.md. Use before committing changes.
Code Review
Review code for quality, test coverage, and fix problems found.
The canonical output artifact for this skill is ./specs/issues/003-code-review-pi/PROMPT.md.
Only report success after writing the final review summary there.
Steps
Identify scope: Run git diff --name-only to find modified files. If there are changes, review only modified packages. If no uncommitted changes, review all packages (./...).
Run linters: Execute linters on target packages:
go vet ./...
golangci-lint run --new-from-rev=HEAD~1 ./... (if available)
Run tests and check coverage:
go test -race -count=1 -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
Identify failing tests, functions with 0% coverage, packages below 80%
Review code quality: Read target files and check for:
Fix issues in parallel using subagents: For each package needing coverage fixes, spawn a subagent to work on it concurrently:
Use the agent tool to spawn one subagent per package that needs test coverage improvement
Each subagent prompt: "Write tests for uncovered functions in package . Read the source files, identify untested functions using the coverage data, write table-driven tests covering happy path and error cases. Run go test -race ./<pkg>/... to verify. NEVER delete existing tests."
While subagents write tests, fix linter warnings and code quality issues yourself
Wait for all subagents to complete, then verify their work compiles
Verify gates: All gates must pass before reporting success:
GATE 1: go build ./... — zero errors
GATE 2: go vet ./... — zero warnings
GATE 3: go test -race ./... — all tests pass
GATE 4: go test -cover ./... — >= 80% per package
If any gate fails, fix and re-run until all pass
Report: Write the final summary to ./specs/issues/003-code-review-pi/PROMPT.md and present: