review-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Review PR

审查 PR

Fetch a GitHub PR, check out its branch, run the review-team skill, and transform the report into copy-pasteable conventional comments.
获取 GitHub PR,检出其分支,运行 review-team skill,并将报告转换为可直接复制粘贴的规范化评论。

Path resolution

路径解析

Paths below are relative to this skill's directory (
~/.claude/skills/review-pr/
for a Claude Code install).
以下路径均相对于此 skill 的目录(对于 Claude Code 安装环境,该目录为
~/.claude/skills/review-pr/
)。

Inputs

输入

The user provides a GitHub PR URL (e.g.
https://github.com/org/repo/pull/123
). Extract
OWNER/REPO
and
PR_NUMBER
from the URL.
用户提供 GitHub PR URL(例如
https://github.com/org/repo/pull/123
)。从 URL 中提取
OWNER/REPO
和
PR_NUMBER
。

Workflow

工作流

Step 1 — Fetch PR and check out the branch

步骤 1 — 获取 PR 并检出分支

Before checkout, verify git state:
bash
git status --porcelain
If the working tree is dirty, warn the user and ask whether to proceed, stash, or use
git worktree add
for an isolated checkout.
bash
gh pr view $PR_NUMBER --repo $OWNER/$REPO --json title,body,baseRefName,headRefName,files,additions,deletions,author
gh pr checkout $PR_NUMBER --repo $OWNER/$REPO --detach
Record the previous branch/ref (
git rev-parse --abbrev-ref HEAD
before checkout if needed) so you can tell the user how to return.
If the PR has more than 50 changed files, warn the user and ask whether to proceed or narrow the scope.
在 checkout 前检查 git 状态:
bash
git status --porcelain
如果工作区有未提交更改,请警告用户,并询问是继续、stash,还是使用
git worktree add
进行隔离检出。
bash
gh pr view $PR_NUMBER --repo $OWNER/$REPO --json title,body,baseRefName,headRefName,files,additions,deletions,author
gh pr checkout $PR_NUMBER --repo $OWNER/$REPO --detach
记录之前的 branch/ref(如有需要,在 checkout 前运行
git rev-parse --abbrev-ref HEAD
),以便告知用户如何返回。
如果 PR 更改的文件超过 50 个,请警告用户,并询问是继续还是缩小审查范围。

Step 2 — Run the review-team skill

步骤 2 — 运行 review-team skill

Read and follow
../review-team/SKILL.md
using branch review mode. The checked-out PR branch is the HEAD; the base branch from
PR_META
is the comparison target.
The review-team skill handles gathering context, reading reviewer personas, launching 6 parallel reviewers, and consolidating findings into a report.
使用 分支审查模式 读取并遵循
../review-team/SKILL.md
。
已检出的 PR 分支为 HEAD;
PR_META
中的 base branch 则是比较目标。
review-team skill 负责收集上下文、读取审查者角色设定(reviewer personas)、启动 6 个并行审查者,并将发现整合为报告。

Step 3 — Transform report into conventional comments

步骤 3 — 将报告转换为规范化评论

Take the Review Team Report from Step 2 and convert each finding into a comment ready to copy-paste onto the GitHub PR.
取步骤 2 生成的 Review Team Report,将每项发现转换为可直接复制粘贴到 GitHub PR 上的评论。

Severity → conventional comment label mapping

严重程度 → 规范化评论标签映射

Report severityConventional label
Critical
issue (blocking):
Important
suggestion:
Minor
nitpick (non-blocking):
Praise (from Reviewer-Specific Notes or inline)
praise:
Use other labels when they fit better:
  • question:
    when the finding is uncertain
  • thought (non-blocking):
    for ideas worth considering
  • todo:
    for small mechanical fixes
  • polish (non-blocking):
    for quality-of-life improvements
报告严重程度规范化评论标签
Critical
issue (blocking):
Important
suggestion:
Minor
nitpick (non-blocking):
Praise(来自 Reviewer-Specific Notes 或内联评论)
praise:
如更适合,也可使用以下标签:
  • question:
    :当发现存在不确定性时使用
  • thought (non-blocking):
    :用于值得考虑的想法
  • todo:
    :用于小型机械性修复
  • polish (non-blocking):
    :用于改善使用体验的优化

Voice

语气

Read and follow
../shared/pr-review-voice-marco.md
for tone and phrasing. Replace with your own voice profile file if this repo is forked.
读取并遵循
../shared/pr-review-voice-marco.md
,以匹配语气和措辞。如果已 fork 此仓库,请将其替换为你自己的语气档案文件。

Code snippets

代码片段

Where there's a clear improvement, include a plain code snippet showing how you'd write it. These aren't GitHub suggestion blocks — they're illustrative snippets the author can adapt, since the same pattern may apply in multiple places. Keep them short (1-10 lines).
如果有明确的改进点,请附上一个普通代码片段,展示建议的写法。这些不是 GitHub suggestion blocks,而是供作者自行调整的示例片段,因为同一模式可能适用于多个位置。片段应保持简短(1-10 行)。

Step 4 — Present output

步骤 4 — 呈现输出

When the PR looks good

PR 表现良好时

If the Review Team Report has no Critical or Important findings and Minor findings are few (≤ 2):
This PR looks solid across all review perspectives (code quality,
correctness, architecture, readability, product flow, observability).
Nothing blocking — ship it 🚀
Optionally include 1-2 praise comments worth leaving on the PR.
如果 Review Team Report 中没有 Critical 或 Important 发现,且 Minor 发现很少(≤ 2):
这个 PR 从所有审查维度来看都很扎实(代码质量、正确性、架构、可读性、产品流程、可观测性)。
没有阻塞项——可以发布 🚀
也可以酌情附上 1-2 条值得留在 PR 上的赞扬评论。

When there are findings

存在审查发现时

Present each comment as a self-contained markdown block the user can copy-paste directly onto the PR. Group by file, ordered by line number. Each comment is wrapped in its own fenced code block (
```markdown
) so the user can copy the raw markdown in one shot.
Example:
📄 **file/path.ts** (line 42) — [Code Quality, Adversarial]

```markdown
suggestion: I honestly think we can simplify this a bit.

The nested ternary here is doing too much work in one expression.
Breaking it out makes the intent way more obvious:

const status = isActive
  ? StatusType.Active
  : StatusType.Inactive;
```
Format rules for each comment:
  • A header line outside the block:
    📄 **file**
    (line N) — [Reviewers]
  • A fenced block containing the full comment to copy:
    • Conventional comment label + subject (first line)
    • Discussion paragraph (optional, for context/reasoning)
    • Code snippet (optional, plain code indented or in its own block)
  • The user copies only the content inside the fenced block
将每条评论呈现为一个独立完整的 markdown 块,用户可以直接复制粘贴到 PR。按文件分组,并按行号排序。每条评论都包裹在自己的围栏代码块(
```markdown
)中,以便用户一次复制原始 markdown。
示例:
📄 **file/path.ts** (第 42 行) — [Code Quality, Adversarial]

```markdown
suggestion: 我认为这里其实可以稍微简化一下。

这个嵌套三元表达式在一个表达式中承担了太多逻辑。
拆分出来后,意图会明显得多:

const status = isActive
  ? StatusType.Active
  : StatusType.Inactive;
```
每条评论的格式规则:
  • 围栏代码块外的一行标题:
    📄 **file**
    (第 N 行) — [Reviewers]
  • 一个包含可复制完整评论的围栏代码块:
    • 规范化评论标签 + 主题内容(首行)
    • 讨论段落(可选,用于提供上下文或推理)
    • 代码片段(可选,普通代码,可缩进或放在独立代码块中)
  • 用户只复制围栏代码块内部的内容

End with a summary line

以摘要行结尾

**Summary**: X comments (Y blocking, Z suggestions, W nitpicks, V praise)
**总结**:X 条评论(Y 个阻塞项,Z 条建议,W 个非阻塞细节建议,V 条赞扬)

Edge cases

边界情况

  • PR too large (> 50 files): ask the user to confirm or narrow scope.
  • Auth failure: tell the user to run
    gh auth login
    .
  • PR already merged: still review — user may want post-merge feedback.
  • Dirty working tree: do not checkout without explicit user consent.
  • **PR 过大(> 50 个文件):**请用户确认是否继续或缩小范围。
  • **身份验证失败:**告知用户运行
    gh auth login
    。
  • **PR 已合并:**仍需审查——用户可能希望获得合并后的反馈。
  • **工作区不干净:**未经用户明确同意,不得执行 checkout。