Use to review code implementations for quality, correctness, and best practices
Two-phase review: First analyze and document findings, then apply approved fixes.
Preset Configuration:
src-tauri/src/calculations.rs or HEAD~3..HEAD)If git range provided:
git diff --stat {BASE}..{HEAD}
git diff {BASE}..{HEAD}
If file path provided:
npm run test:backend
Note test status for review context (pass/fail). Do NOT fix yet.
Create _code-review.md in project root or task folder:
# Code Review
**Target:** {TARGET}
**Reference:** {REFERENCE}
**Started:** YYYY-MM-DD
**Status:** In Progress
**Focus:** Quality, correctness, best practices
**Baseline Test Status:** [Pass / N failures]
## Iteration 1
### Findings
[To be filled by review agent]
For each iteration (max 4):
Spawn Review Agent:
Task tool (superpowers:code-reviewer):
Use template from requesting-code-review/code-reviewer.md
WHAT_WAS_IMPLEMENTED: {description from reference}
PLAN_OR_REQUIREMENTS: {REFERENCE}
BASE_SHA: {BASE or N/A}
HEAD_SHA: {HEAD or current}
IMPORTANT: Document findings only. Do not apply fixes.
Update Review Document: Append findings to _code-review.md:
## Iteration N
### New Findings
- [Critical] Issue description - `file:line` - Suggested fix
- [Important] Issue description - `file:line` - Suggested fix
- [Minor] Issue description - `file:line` - Suggested fix
### Test Gaps
[Any missing test coverage noted]
### Coverage Assessment
[Areas reviewed / Areas remaining]
Commit Review Only:
git add _code-review.md
git commit -m "review(code): iteration N findings for {TARGET}"
Quality Gate: Exit when no new findings for 1 iteration (review is comprehensive).
Update _code-review.md with summary:
## Review Summary
**Status:** Ready for User Review
**Iterations:** N
**Total Findings:** X Critical, Y Important, Z Minor
**Test Status:** [Pass / Fail]
### All Findings (Consolidated)
#### Critical
1. [ ] Issue - `file:line` - Suggested fix
#### Important
1. [ ] Issue - `file:line` - Suggested fix
#### Minor
1. [ ] Issue - `file:line` - Suggested fix
### Test Gaps
- [ ] Missing test for X
- [ ] Edge case Y not covered
### Recommendation
[Ready to merge / Needs fixes / Major issues]
Commit:
git add _code-review.md
git commit -m "review(code): complete findings for {TARGET}"
Inform user:
Code review complete.
Please review
_code-review.mdfor findings.After your review, let me know:
- Which findings to fix
- Which to skip (with reason)
- Any questions about findings
STOP and wait for user direction.
Only proceed after user approval.
For each user-approved finding:
_code-review.md: [x]npm run test:backend
If tests fail:
git add -A
git commit -m "fix: address code review findings
Addressed:
- [list of fixed issues]"
Update _code-review.md:
## Resolution
**Addressed:** N findings
**Skipped:** M findings (user decision)
**Test Status:** All passing
**Status:** Complete
### Applied Fixes
- Finding 1: [how resolved]
- Finding 2: [how resolved]
### Skipped Items
- Finding X: [user's reason]
Review should verify:
User: /code-review src-tauri/src/suggestions.rs against _tasks/19-feature/02-plan.md
Claude: [Executes Phase 1 - runs tests, creates _code-review.md, iterates until comprehensive]
Claude: Code review complete. Please review _code-review.md for findings.
User: Fix all Critical issues. Skip the Minor style suggestions.
Claude: [Executes Phase 2 - applies approved fixes, runs tests, commits]