请求代码审查
- 作者仓库星标 0
- 作者更新于 2026年8月12日 16:53
- 作者仓库 superpowers
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @obra · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
[Just completed Task 2: Add verification function]
You: Let me request code review before proceeding.
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
HEAD_SHA=$(git rev-parse HEAD)
[Dispatch code reviewer subagent]
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md
BASE_SHA: a7981ec
HEAD_SHA: 3df7661
[Subagent returns]:
Strengths: Clean architecture, real tests
Issues:
Important: Missing progress indicators
Minor: Magic number (100) for reporting interval
Assessment: Ready to proceed
You: [Fix progress indicators]
[Continue to Task 3]
# Requesting Code Review
Dispatch a code reviewer subagent to catch issues before they cascade. The reviewer gets precisely crafted context for evaluation — never your session's history.
**Core principle:** Review early, review often.
## When to Request Review
**Mandatory:**
- After each task in subagent-driven development
- After completing major feature
- Before merge to main
**Optional but valuable:**
- When stuck (fresh perspective)
- Before refactoring (baseline check)
- After fixing complex bug
## How to Request
**1. Get git SHAs:**
```bash
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
HEAD_SHA=$(git rev-parse HEAD)
```
**2. Dispatch code reviewer subagent:**
Dispatch a `general-purpose` subagent, filling the template at [code-reviewer.md](code-reviewer.md)
**Placeholders:**
- `{DESCRIPTION}` - Brief summary of what you built
- `{PLAN_OR_REQUIREMENTS}` - What it should do
- `{BASE_SHA}` - Starting commit
- `{HEAD_SHA}` - Ending commit
**3. Act on feedback:**
- Fix Critical issues immediately
- Fix Important issues before proceeding
- Note Minor issues for later
- Push back if reviewer is wrong (with reasoning)
## Example
```
[Just completed Task 2: Add verification function]
You: Let me request code review before proceeding.
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
HEAD_SHA=$(git rev-parse HEAD)
[Dispatch code reviewer subagent]
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md
BASE_SHA: a7981ec
HEAD_SHA: 3df7661
[Subagent returns]:
Strengths: Clean architecture, real tests
Issues:
Important: Missing progress indicators
Minor: Magic number (100) for reporting interval
Assessment: Ready to proceed
You: [Fix progress indicators]
[Continue to Task 3]
```
## Common Rationalizations
| Excuse | Reality |
|--------|---------|
| "I'll just review the diff myself instead of dispatching a reviewer" | You're the coordinator — reviewing the diff inline burns the context window you need to keep driving the work. Dispatch a reviewer subagent: the diff and the evaluation live in its context, and only the findings come back to you. |
| "The reviewer needs my whole session history to understand the change" | Hand it precisely crafted context, never your session's history. That keeps the reviewer on the work product, not your thought process. |
## Red Flags
**Never:**
- Skip review because "it's simple"
- Ignore Critical issues
- Proceed with unfixed Important issues
- Argue with valid technical feedback
**If reviewer wrong:**
- Push back with technical reasoning
- Show code/tests that prove it works
- Request clarification
See template at: [code-reviewer.md](code-reviewer.md)
章节与文件索引
按说明文件中的顺序排列。
何时请求审查
如何请求
常见的合理化理由
危险信号
文件/命令 -> general-purpose · {DESCRIPTION} · {PLAN_OR_REQUIREMENTS} · {BASE_SHA} · {HEAD_SHA}
内容校验值 -> c96b761df987
requesting-code-review 把「发起 code review」也变成一个独立技能——核心创新是:reviewer 不读你的对话历史,只读你精心构造的上下文。这避免 reviewer 被你思考过程里的杂念带偏,同时把你自己的 context 留给后续工作。
设计思路
作者主张「Review early, review often」——通过 subagent 在每个关键节点抓 review。reviewer 是子 agent,被分配一份「该评估什么、对照什么需求、看哪两个 SHA 之间的 diff」的任务卡,从干净状态开始评估。
工作流
① 取 SHA:
BASE_SHA=$(git rev-parse HEAD~1)/HEAD_SHA=$(git rev-parse HEAD);② 用 Task 工具调起general-purpose类型的 reviewer,按code-reviewer.md模板填四个占位符——{DESCRIPTION}(你做了什么的简述)、{PLAN_OR_REQUIREMENTS}(应该做到什么)、{BASE_SHA}/{HEAD_SHA};③ 接收 reviewer 给的 Strengths + Issues(按 Critical/Important/Minor 分级)+ Assessment;④ Critical 立即修、Important 继续之前修、Minor 记账延后、reviewer 错就带理由反驳。适合
强制:subagent-driven development 每条任务结束后;完成大功能后;合并前。可选高价值:卡住时让外部视角看一眼;重构前留一份 baseline;修完复杂 bug 后。
整合到工作流
红线
不能因「这很简单」跳过 review;不能忽略 Critical;不能带着未修的 Important 继续;不能跟正确的技术反馈吵。如果 reviewer 错了——拿技术理由反驳,给出能跑的代码 / 测试做证据,必要时让 your human partner 仲裁。
配套
receiving-code-review(reviewer 反馈过来怎么处置)、subagent-driven-development(最常配套使用的开发节奏)、verification-before-completion(review 前你自己先验过一遍)。