requesting-code-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Requesting Code Review

申请代码审查

Dispatch code-reviewer subagent to catch issues before they cascade.
Core principle: Review early, review often.
调度 code-reviewer 子Agent,在问题扩散前及时发现。
核心原则: 早审查,勤审查。

How to Request

如何申请

1. Get git SHAs:
bash
undefined
1. 获取 git SHAs:
bash
undefined

For PR/branch review (recommended):

For PR/branch review (recommended):

BASE_SHA=$(git merge-base origin/main HEAD) HEAD_SHA=$(git rev-parse HEAD)
BASE_SHA=$(git merge-base origin/main HEAD) HEAD_SHA=$(git rev-parse HEAD)

For single commit only:

For single commit only:

BASE_SHA=$(git rev-parse HEAD~1)

BASE_SHA=$(git rev-parse HEAD~1)


**2. Dispatch code-reviewer subagent:**

Use Task tool with template at [templates/code-reviewer.md](templates/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)

**2. 调度 code-reviewer 子Agent:**

使用 Task 工具,搭配 [templates/code-reviewer.md](templates/code-reviewer.md) 处的模板

**占位符:**
- `{WHAT_WAS_IMPLEMENTED}` - 你刚开发完成的内容
- `{PLAN_OR_REQUIREMENTS}` - 预期实现的需求
- `{BASE_SHA}` - 起始提交
- `{HEAD_SHA}` - 结束提交
- `{DESCRIPTION}` - 简短摘要

**3. 处理反馈:**
- 立即修复严重问题
- 继续推进前先修复重要问题
- 记录次要问题,后续处理
- 如果审查意见有误,可提出异议(需说明理由)

Example

示例

[Just completed Task 2: Add verification function]

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

[Dispatch code-reviewer subagent with references/code-reviewer.md]
  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

[Fix progress indicators, continue to Task 3]
[Just completed Task 2: Add verification function]

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

[Dispatch code-reviewer subagent with references/code-reviewer.md]
  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

[Fix progress indicators, continue to Task 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
子Agent驱动开发:
  • 每项任务完成后都进行审查
  • 在问题累积前及时发现
  • 进入下一项任务前先修复问题
执行计划时:
  • 每完成一批(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
禁止行为:
  • 不要因为「很简单」就跳过审查
  • 不要忽略严重问题
  • 不要带着未修复的重要问题继续推进
  • 不要反驳合理的技术反馈
如果审查意见有误:
  • 提供技术依据提出异议
  • 展示能证明功能正常的代码/测试用例
  • 申请澄清