review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

review

变更评审

Review one change set in one mode and return a decision-led report.

在指定模式下评审单个变更集,并返回以决策为核心的评审报告。

Guardrails

约束规则

  • Require an explicit mode:
    pr
    or
    local
    .
  • Do not implement or modify code.
  • Do not commit, merge, push, or delete branches.
  • Do not update PRD/todo tracking files here.
  • Update
    tasks/memory.md
    only for durable review outcomes (recurring risks, release-critical gotchas, or confirmed follow-up decisions).
  • Do not invent test results; run checks or call out missing evidence.

  • 必须指定明确的模式:
    pr
    local
  • 不得实现或修改代码。
  • 不得执行提交、合并、推送或删除分支的操作。
  • 不得在此处更新PRD/待办事项跟踪文件。
  • 仅当存在需长期记录的评审结果(如重复出现的风险、发布关键问题、已确认的后续决策)时,才更新
    tasks/memory.md
  • 不得编造测试结果;需运行检查或指出缺失的验证依据。

Inputs

输入参数

  • review mode:
    • pr
      : PR URL/number (preferred)
    • local
      : base branch (default: repository default branch resolved from
      origin/HEAD
      ; ask if unclear)
  • optional PRD path (if scope validation is needed)

  • 评审模式:
    • pr
      :PR的URL或编号(优先推荐)
    • local
      :基准分支(默认值:从
      origin/HEAD
      解析的仓库默认分支;若不明确需询问用户)
  • 可选的PRD路径(若需要验证变更范围)

Workflow

工作流程

  1. Confirm mode and target.
  2. Collect context:
    • pr
      mode:
      • Preferred (
        gh
        available):
        • gh pr view --json url,number,title,body,state,isDraft,baseRefName,headRefName,files,additions,deletions
        • gh pr diff
        • gh pr checks
      • Fallback (
        gh
        unavailable/auth fails):
        • ask for base/head branch names if not already provided
        • git fetch origin "<base>" "<head>"
        • git diff "origin/<base>...origin/<head>"
        • git log "origin/<base>..origin/<head>" --oneline
        • mark CI/check status as
          Missing evidence
          unless the user provides CI artifacts
    • local
      mode:
      • git diff "<base>...HEAD"
      • git log "<base>..HEAD" --oneline
      • git status --short
  3. Compare the change set against required behaviour:
    • correctness and edge cases
    • security risks and data handling
    • test depth and regression risk
    • scope control (especially if PRD path is provided)
      • Compare diff vs PRD 'In scope' and completed user stories; flag any diff not attributable to a PRD requirement.
  4. Classify findings:
    • blockers (must fix)
    • suggestions (optional improvements)
    • missing evidence (tests/checks not run, unclear behaviour)
      • If unable to run checks (CI-only, permissions), mark as 'Missing evidence' and request the specific artifact (CI link, log, or command for user to run).
  5. Produce the report with a clear recommendation:
    • pr
      mode:
      Ready to accept PR: Yes
      or
      Ready to accept PR: No
    • local
      mode:
      Good to commit: Yes
      or
      Good to commit: No
    • if decision is
      No
      , include explicit fix items and ask the user to address them before rerunning
      review
      in the same mode
  6. Evaluate memory-worthy review outcomes and update
    tasks/memory.md
    inline when needed:
    • systemic risks likely to recur
    • key security or data-handling decisions
    • durable follow-up decisions that affect future work
    • if no durable outcome exists, mark memory as skipped with reason in the report

  1. 确认评审模式及目标对象。
  2. 收集上下文信息:
    • pr
      模式:
      • 优先方式(
        gh
        工具可用时):
        • gh pr view --json url,number,title,body,state,isDraft,baseRefName,headRefName,files,additions,deletions
        • gh pr diff
        • gh pr checks
      • 备选方式(
        gh
        工具不可用或认证失败时):
        • 若未提供基准/头部分支名称,需向用户询问
        • git fetch origin "<base>" "<head>"
        • git diff "origin/<base>...origin/<head>"
        • git log "origin/<base>..origin/<head>" --oneline
        • 除非用户提供CI工件,否则将CI/检查状态标记为「缺失验证依据」
    • local
      模式:
      • git diff "<base>...HEAD"
      • git log "<base>..HEAD" --oneline
      • git status --short
  3. 将变更集与要求的行为进行对比:
    • 正确性及边缘场景
    • 安全风险与数据处理
    • 测试覆盖深度与回归风险
    • 范围控制(若提供了PRD路径则需重点检查)
      • 对比代码差异与PRD中「在范围」的内容及已完成的用户故事;标记任何无法归因于PRD需求的代码差异。
  4. 对评审发现进行分类:
    • 阻塞项(必须修复)
    • 建议项(可选优化)
    • 缺失验证依据(未运行测试/检查,或行为不明确)
      • 若无法运行检查(仅CI可执行、权限不足),标记为「缺失验证依据」并请求用户提供特定工件(CI链接、日志或需用户执行的命令)。
  5. 生成包含明确建议的报告:
    • pr
      模式:
      Ready to accept PR: Yes
      Ready to accept PR: No
    • local
      模式:
      Good to commit: Yes
      Good to commit: No
    • 若决策为「No」,需列出明确的修复项,并要求用户解决后以相同模式重新运行
      review
  6. 评估是否有需长期记录的评审结果,必要时内联更新
    tasks/memory.md
    • 可能重复出现的系统性风险
    • 关键的安全或数据处理决策
    • 会影响未来工作的长期后续决策
    • 若无需长期记录的结果,需在报告中标记跳过记录并说明原因

Review Checklist

评审检查清单

  • Correctness:
    • empty/null/error paths
    • boundary values and state transitions
    • ordering/concurrency/time assumptions (if applicable)
  • Security:
    • authn/authz behaviour
    • input validation and output encoding
    • secret/PII handling and logging safety
    • dependency risk for newly introduced packages
  • Tests and verification:
    • happy path + key failure paths
    • regression coverage in touched areas
    • manual verification steps when automation is missing
  • Maintainability:
    • naming clarity and control-flow simplicity
    • comments/docs for non-obvious decisions only

  • 正确性:
    • 空值/空输入/错误路径处理
    • 边界值与状态转换
    • 排序/并发/时间相关假设(若适用)
  • 安全性:
    • 认证/授权行为
    • 输入验证与输出编码
    • 密钥/PII数据的处理与日志安全
    • 新引入依赖包的风险
  • 测试与验证:
    • 正常流程 + 关键异常流程
    • 受影响代码区域的回归覆盖
    • 自动化缺失时的手动验证步骤
  • 可维护性:
    • 命名清晰性与控制流简洁性
    • 仅对非直观决策添加注释/文档

Report Template

报告模板

text
PR Mode Report
Mode: pr
Decision:
- Ready to accept PR: Yes | No

Blockers (must fix):
- …

Suggestions (nice to have):
- …

Missing evidence:
- …

Security notes:
- …

Regression risks / watch-outs:
- …

Memory updates:
- Updated: <summary> | Skipped: <reason>

Recommended next step:
- If Ready to accept PR=No: ask user to fix blockers, then rerun `review` in `pr` mode.
- If Ready to accept PR=Yes: run `commit` in `finalise` mode.
text
Local Mode Report
Mode: local
Decision:
- Good to commit: Yes | No

Blockers (must fix):
- …

Suggestions (nice to have):
- …

Missing evidence:
- …

Security notes:
- …

Regression risks / watch-outs:
- …

Memory updates:
- Updated: <summary> | Skipped: <reason>

Recommended next step:
- If Good to commit=No: ask user to fix blockers, then rerun `review` in `local` mode.
- If Good to commit=Yes: run `commit` in `commit` mode.

text
PR模式评审报告
模式: pr
决策:
- Ready to accept PR: Yes | No

阻塞项(必须修复):
- …

建议项(可选优化):
- …

缺失验证依据:
- …

安全注意事项:
- …

回归风险/注意点:
- …

记录更新:
- Updated: <摘要> | Skipped: <原因>

建议下一步操作:
- 若Ready to accept PR=No: 请用户修复阻塞项,然后以`pr`模式重新运行`review`。
- 若Ready to accept PR=Yes: 以`finalise`模式运行`commit`。
text
本地模式评审报告
模式: local
决策:
- Good to commit: Yes | No

阻塞项(必须修复):
- …

建议项(可选优化):
- …

缺失验证依据:
- …

安全注意事项:
- …

回归风险/注意点:
- …

记录更新:
- Updated: <摘要> | Skipped: <原因>

建议下一步操作:
- 若Good to commit=No: 请用户修复阻塞项,然后以`local`模式重新运行`review`。
- 若Good to commit=Yes: 以`commit`模式运行`commit`。

Output

输出要求

  • Return the review report with explicit memory update status.
  • Keep the decision explicit and unambiguous.
  • End with a short status block:
    • Files changed: list of created/updated files
    • Key decisions: any assumptions or choices made (if any)
    • Next step: recommended next skill or action
  • 返回包含明确记录更新状态的评审报告。
  • 决策需明确且无歧义。
  • 结尾需包含简短的状态块:
    • 文件变更: 列出创建/更新的文件
    • 关键决策: 做出的任何假设或选择(若有)
    • 下一步操作: 推荐的后续技能或操作