requesting-code-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Requesting Code Review

发起代码评审

Dispatch superpowers:code-reviewer subagent to catch issues before they cascade.
Core principle: Review early, review often.
调用superpowers:code-reviewer子代理在问题扩大前发现它们。
核心原则: 尽早评审,经常评审。

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
强制场景:
  • 子代理驱动开发中完成每个任务后
  • 完成主要功能后
  • 合并到main分支前
可选但有价值的场景:
  • 遇到瓶颈时(获取新视角)
  • 重构前(基线检查)
  • 修复复杂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:
Use Task tool with superpowers:code-reviewer type, fill template at
code-reviewer.md
Placeholders:
  • {WHAT_WAS_IMPLEMENTED}
    - What you just built
  • {PLAN_OR_REQUIREMENTS}
    - What it should do
  • {BASE_SHA}
    - Starting commit
  • {HEAD_SHA}
    - Ending commit
  • {DESCRIPTION}
    - Brief summary
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)
1. 获取git哈希值:
bash
BASE_SHA=$(git rev-parse HEAD~1)  # or 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)问题留待后续处理
  • 如果评审者有误,可提出异议(需附上理由)

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 superpowers:code-reviewer subagent]
  WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
  PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
  BASE_SHA: a7981ec
  HEAD_SHA: 3df7661
  DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types

[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]
[刚完成任务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/plans/deployment-plan.md的任务2
  BASE_SHA: a7981ec
  HEAD_SHA: 3df7661
  DESCRIPTION: 新增verifyIndex()和repairIndex()函数,支持4种问题类型

[子代理返回结果]:
  优势:架构清晰,包含真实测试
  问题:
    重要:缺少进度指示器
    次要:报告间隔使用了魔法数字(100)
  评估:可继续推进

你:[修复进度指示器]
[继续执行任务3]

Integration with Workflows

与工作流集成

Subagent-Driven Development:
  • Review after EACH task
  • Catch issues before they compound
  • Fix before moving to next task
Executing Plans:
  • Review after each batch (3 tasks)
  • Get feedback, apply, continue
Ad-Hoc Development:
  • Review before merge
  • Review when stuck
子代理驱动开发:
  • 完成每个任务后进行评审
  • 在问题复杂化前发现它们
  • 推进到下一个任务前修复问题
执行计划:
  • 每完成一批(3个任务)后进行评审
  • 获取反馈,应用后继续
临时开发:
  • 合并前进行评审
  • 遇到瓶颈时进行评审

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: requesting-code-review/code-reviewer.md
绝对不要:
  • 因为“功能简单”而跳过评审
  • 忽略严重(Critical)问题
  • 带着未修复的重要(Important)问题推进
  • 对合理的技术反馈进行争执
如果评审者有误:
  • 附上技术理由提出异议
  • 展示可证明功能正常的代码/测试
  • 请求澄清
查看模板:requesting-code-review/code-reviewer.md