requesting-code-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

请求代码审查

Request Code Review

派遣 superpowers:code-reviewer 子代理来在问题扩散之前发现它们。审查者获得的是精心组织的评估上下文——绝不是你的会话历史。这样可以让审查者专注于工作成果而非你的思考过程,同时保留你自己的上下文以便继续工作。
核心原则: 早审查,勤审查。
Dispatch the superpowers:code-reviewer sub-agent to catch issues before they spread. Reviewers receive a well-organized evaluation context—never your session history. This allows reviewers to focus on work results rather than your thought process, while preserving your own context to continue working.
Core Principle: Review early, review often.

何时请求审查

When to Request a Review

必须审查:
  • 子代理驱动开发中每个任务完成后
  • 完成重要功能后
  • 合并到 main 之前
可选但有价值:
  • 卡住时(换个视角)
  • 重构之前(建立基线)
  • 修复复杂 bug 之后
Mandatory Review:
  • After completing each task in sub-agent-driven development
  • After implementing important features
  • Before merging into main
Optional but Valuable:
  • When stuck (gain a different perspective)
  • Before refactoring (establish a baseline)
  • After fixing complex bugs

如何请求

How to Request

1. 获取 git SHA:
bash
BASE_SHA=$(git rev-parse HEAD~1)  # 或 origin/main
HEAD_SHA=$(git rev-parse HEAD)
2. 派遣 code-reviewer 子代理:
使用 Task 工具,指定 superpowers:code-reviewer 类型,填写
code-reviewer.md
中的模板
占位符说明:
  • {WHAT_WAS_IMPLEMENTED}
    - 你刚完成的内容
  • {PLAN_OR_REQUIREMENTS}
    - 预期功能
  • {BASE_SHA}
    - 起始提交
  • {HEAD_SHA}
    - 结束提交
  • {DESCRIPTION}
    - 简要说明
3. 处理反馈:
  • Critical 问题立即修复
  • Important 问题在继续之前修复
  • Minor 问题记录下来稍后处理
  • 如果审查者有误,用技术理由反驳
1. Get git SHA:
bash
BASE_SHA=$(git rev-parse HEAD~1)  # or origin/main
HEAD_SHA=$(git rev-parse HEAD)
2. Dispatch the code-reviewer sub-agent:
Use the Task tool, specify the superpowers:code-reviewer type, and fill in the template in
code-reviewer.md
Placeholder Explanation:
  • {WHAT_WAS_IMPLEMENTED}
    - What you just completed
  • {PLAN_OR_REQUIREMENTS}
    - Expected features
  • {BASE_SHA}
    - Starting commit
  • {HEAD_SHA}
    - Ending commit
  • {DESCRIPTION}
    - Brief description
3. Handle Feedback:
  • Fix Critical issues immediately
  • Fix Important issues before proceeding
  • Record Minor issues for later handling
  • If the reviewer is wrong, refute with technical reasons

示例

Example

[刚完成任务 2:添加验证功能]

你:让我在继续之前请求代码审查。

BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
HEAD_SHA=$(git rev-parse HEAD)

[派遣 superpowers:code-reviewer 子代理]
  WHAT_WAS_IMPLEMENTED: 会话索引的验证和修复功能
  PLAN_OR_REQUIREMENTS: docs/superpowers/plans/deployment-plan.md 中的任务 2
  BASE_SHA: a7981ec
  HEAD_SHA: 3df7661
  DESCRIPTION: 添加了 verifyIndex() 和 repairIndex(),支持 4 种问题类型

[子代理返回]:
  优点:架构清晰,测试真实
  问题:
    Important:缺少进度指示器
    Minor:报告间隔使用了魔法数字 (100)
  评估:可以继续

你:[修复进度指示器]
[继续任务 3]
[Just completed Task 2: Add validation functionality]

You: Let me request a code review before proceeding.

BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
HEAD_SHA=$(git rev-parse HEAD)

[Dispatch superpowers:code-reviewer sub-agent]
  WHAT_WAS_IMPLEMENTED: Session index verification and repair functionality
  PLAN_OR_REQUIREMENTS: Task 2 in docs/superpowers/plans/deployment-plan.md
  BASE_SHA: a7981ec
  HEAD_SHA: 3df7661
  DESCRIPTION: Added verifyIndex() and repairIndex(), supporting 4 types of issues

[Sub-agent returns]:
  Pros: Clear architecture, realistic tests
  Issues:
    Important: Missing progress indicator
    Minor: Magic number (100) used for report interval
  Evaluation: Can proceed

You: [Fix progress indicator]
[Proceed to Task 3]

与工作流的集成

Integration with Workflow

子代理驱动开发:
  • 每个任务完成后审查
  • 在问题叠加之前发现它们
  • 修复后再进入下一个任务
执行计划:
  • 每批(3 个任务)后审查
  • 获取反馈,修复,继续
临时开发:
  • 合并前审查
  • 卡住时审查
Sub-agent-driven Development:
  • Review after each task
  • Catch issues before they accumulate
  • Fix before moving to the next task
Execution Plan:
  • Review after each batch (3 tasks)
  • Get feedback, fix, continue
Ad-hoc Development:
  • Review before merging
  • Review when stuck
Red Lines
Never:
  • Skip review because it's "simple"
  • Ignore Critical issues
  • Proceed with unfixed Important issues
  • Argue against reasonable technical feedback
If the reviewer is wrong:
  • Refute with technical reasons
  • Show code/tests proving it works
  • Ask for clarification
See template: requesting-code-review/code-reviewer.md

红线

绝不要:
  • 因为"很简单"就跳过审查
  • 忽略 Critical 问题
  • 带着未修复的 Important 问题继续推进
  • 对合理的技术反馈进行争辩
如果审查者有误:
  • 用技术理由反驳
  • 展示证明其可行的代码/测试
  • 要求澄清
参见模板:requesting-code-review/code-reviewer.md