Dispatch a code reviewer subagent to catch issues before they compound. The reviewer gets precisely crafted context for evaluation - never your session history. This keeps the reviewer focused on the work product, not your thought process, while preserving your own context for continued work.
Core Principle: Review early, review often.
When to Request Review
Mandatory:
- After each task in subagent-driven development
- After completing major features
- Before merging to main
Optional but valuable:
- When stuck (to get a fresh perspective)
- Before refactoring (baseline check)
- After fixing complex bugs
How to Request
1. Get git SHAs:
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
HEAD_SHA=$(git rev-parse HEAD)
2. Dispatch a code reviewer subagent:
Use the general-purpose type's Task tool, fill in the template in code-reviewer.md template in
Placeholders:
{DESCRIPTION}- A brief summary of what you built{PLAN_OR_REQUIREMENTS}- What it should do{BASE_SHA}- Starting commit{HEAD_SHA}- Ending commit
3. Handle feedback:
- Fix Critical issues immediately
- Fix Important issues before continuing
- Record Minor issues for later handling
- If the reviewer is wrong, push back (with reasoning)
Example
[刚完成 Task 2:添加验证函数]
你:继续之前,我先请求代码审查。
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
HEAD_SHA=$(git rev-parse HEAD)
[分派代码审查者子代理]
DESCRIPTION: 添加了 verifyIndex() 和 repairIndex(),包含 4 种问题类型
PLAN_OR_REQUIREMENTS: docs/superpowers/plans/deployment-plan.md 中的 Task 2
BASE_SHA: a7981ec
HEAD_SHA: 3df7661
[子代理返回]:
Strengths: 架构干净,测试真实
Issues:
Important: 缺少进度指示器
Minor: 报告间隔使用魔法数字 (100)
Assessment: 可以继续
你:[修复进度指示器]
[继续 Task 3]
Integration with Workflow
Subagent-Driven Development:
- Review after every task
- Catch issues before they accumulate
- Fix before moving to the next task
Executing Plans:
- Review after every task or at natural checkpoints
- Get feedback, apply, continue
Ad-Hoc Development:
- Review before merging
- Review when stuck
Red Flags
Never:
- Skip review because "it's simple"
- Ignore Critical issues
- Continue with unfixed Important issues
- Argue with valid technical feedback
If the reviewer is wrong:
- Push back with technical reasoning
- Show code/tests that prove it works
- Request clarification
See template: requesting-code-review/code-reviewer.md