pr-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePR Review Workflow
PR审核工作流
Review a pull request systematically before merge.
在合并前系统性地审核拉取请求。
Usage
使用方法
/pr-review <PR number or URL>/pr-review <PR编号或URL>Steps
步骤
- Fetch PR details
gh pr view <number> --json title,body,files,commits
gh pr diff <number>- Understand the change
- Read the PR description — what problem does it solve?
- Look at the commit history — is the story coherent?
- Identify the scope: which files changed, what's the blast radius?
- Review the diff For each changed file:
- Does the change match the stated intent?
- Are there edge cases not handled?
- Any security issues? (injection, auth bypass, data leak)
- Any performance concerns? (N+1 queries, unbounded loops, missing indexes)
- Dead code, unused imports, debug prints left behind?
- Tests added or updated for the change?
- Run tests locally
git fetch origin pull/<number>/head:pr-<number>
git checkout pr-<number>- Run the full test suite
- Try to break the new code with edge case inputs
- Report findings Present as a structured report:
undefined- 获取PR详情
gh pr view <number> --json title,body,files,commits
gh pr diff <number>- 理解变更内容
- 阅读PR描述——它解决了什么问题?
- 查看提交历史——提交逻辑是否连贯?
- 确定变更范围:哪些文件被修改,影响范围有多大?
- 审核代码差异 针对每个被修改的文件:
- 变更内容是否符合预期目标?
- 是否有未处理的边缘情况?
- 存在任何安全问题吗?(注入攻击、权限绕过、数据泄露)
- 存在性能隐患吗?(N+1查询、无限循环、缺失索引)
- 是否遗留了死代码、未使用的导入或调试打印语句?
- 是否为变更添加或更新了测试用例?
- 本地运行测试
git fetch origin pull/<number>/head:pr-<number>
git checkout pr-<number>- 运行完整测试套件
- 尝试用边缘用例输入破坏新代码
- 反馈审核结果 以结构化报告形式呈现:
undefinedPR Review: #<number> — <title>
PR审核:#<number> — <title>
Summary
摘要
[1-2 sentences on what the PR does]
[1-2句话说明PR的作用]
Findings
审核结果
Critical (must fix)
严重问题(必须修复)
- ...
- ...
Important (should fix)
重要问题(建议修复)
- ...
- ...
Suggestions (nice to have)
优化建议(可选)
- ...
- ...
Tests
测试情况
- Suite: [pass/fail count]
- Coverage: [new code covered? y/n]
- 测试套件:[通过/失败数量]
- 覆盖率:[新代码是否被覆盖?是/否]
Verdict: [Approve / Request Changes / Needs Discussion]
审核结论:[批准 / 请求修改 / 需要讨论]
6. **Clean up**git checkout main && git branch -d pr-<number>
undefined
6. **清理本地分支**git checkout main && git branch -d pr-<number>
undefinedRules
规则
- Be specific — cite file:line for every finding
- Verify findings — if you suspect a bug, prove it with a test or trace
- Don't nitpick style unless it hurts readability
- Security and correctness issues are always Critical
- 具体明确——每个问题都要标注文件:行号
- 验证问题——如果怀疑存在bug,用测试或追踪结果证明
- 除非影响可读性,否则不要对代码风格吹毛求疵
- 安全和正确性问题始终属于严重问题