pr-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PR Review

PR 审查

One question — what do I do about this pull request — answered differently depending on which side of it you are on.
Their branch. You are the reviewer. Attack the diff, then publish a real review: one inline comment per finding, a body, and a verdict.
Your branch. You are the author. Work the threads people and bots left: decide whether answering is even your business, check whether the claim is true, then reply and close what is finished.
The skill verifies before it speaks and changes no code unless asked. Its default output is an action report plus whatever it posted.
只有一个问题——我该如何处理这个Pull Request——答案取决于你所处的立场。
他人分支:你作为审查者。分析代码差异,然后发布正式审查意见:每个问题对应一条行内评论,附带审查正文和结论。
自己的分支:你作为作者。处理他人和机器人留下的讨论线程:判断是否需要自己回复,验证主张是否属实,然后回复并结束已处理完成的线程。
该技能发言前先验证,且除非被要求否则不修改代码。默认输出为操作报告以及发布的所有内容。

The premise

核心前提

Bots write most of the inline comments on a modern pull request, and they fail in a shape: the premise is wrong far more often than the conclusion. The claim rests on how a framework behaves, and your repository's own code says nothing about it — so "read the code" is not enough, and two agents agreeing is not verification.
The ordering is therefore fixed and not negotiable:
verify → fix → build → speak.
Never post a verdict you have not executed. A
reject
needs evidence that can be pasted; a
fix
needs the project's own checks passing on it.
references/verifying-a-claim.md
has the traps, the version-pinning discipline, and the run where a fabricated claim reached two independent confirmations and was caught only because the fix would not compile.
在现代Pull Request中,大多数行内评论由机器人生成,但它们存在一个缺陷:前提错误的频率远高于结论错误。主张往往基于框架的行为逻辑,但仓库自身代码并未涉及相关内容——因此仅“阅读代码”远远不够,两个Agent达成一致也不能算作验证。
因此,执行顺序是固定且不可协商的:
验证 → 修复 → 构建 → 发言
绝不要发布未经过验证的结论。
reject
结论需要可粘贴的证据;
fix
结论需要项目自身检查通过。
references/verifying-a-claim.md
中记录了相关陷阱、版本固定规则,以及一个伪造主张获得两个独立确认、最终因修复无法编译才被识破的案例。

Configuration

配置项

SettingFlagDefault
Apply code changes
--fix
Off — verify, check, report
Verification breadth
--full
Bot claims, plus anything heading for
fix
or
reject
Unattended
--auto
Off — previews and confirmations are shown
Explicit instructions in the invocation override the default posture in both directions. "Just triage this" stays read-only however the postures resolve; "answer Anna" acts on a human thread that the table below would have left alone.
--fix
is meaningless in reviewer mode — you do not fix a colleague's branch. Say so and ignore it.
设置项标识默认值
应用代码修改
--fix
关闭——仅验证、检查、报告
验证范围
--full
机器人主张,以及所有标记为
fix
reject
的内容
无人值守模式
--auto
关闭——会显示预览并要求确认
调用时的明确指令会覆盖默认配置。例如“仅分类处理”会保持只读模式,无论配置如何;“回复Anna”会处理人类发起的线程,即使下表中对应的规则是忽略该线程。
--fix
在审查者模式下无意义——你不能修改同事的分支。遇到这种情况会提示并忽略该标识。

Asking the User

向用户提问

Every question in this skill is written as
AskUserQuestion
options. Use that tool where the host offers it, or the host's nearest structured-choice equivalent. Where the host has neither, ask the same question in normal chat as a numbered list of 2–5 options — recommended first, one short line of description each — and wait for the user to reply with a number.
该技能中的所有问题均以
AskUserQuestion
选项形式呈现。如果宿主环境支持该工具则直接使用,或使用宿主环境中最接近的结构化选择工具。如果两者都不支持,则在普通聊天中以2-5个选项的编号列表形式提问——推荐选项放在首位,每个选项配简短描述——等待用户回复编号。

Phase 1: Resolve the target and your side

阶段1:确定目标和你的立场

Parse the invocation:
InputMeaning
emptyThe current branch's open pull request
a number or a PR URLThat pull request
a
#discussion_r<id>
URL
That single thread, and nothing else
a login (
copilot
)
Only threads that author rooted
free textThreads whose body fuzzy-matches it
Then resolve which side you are on, because it selects the mode:
bash
gh pr view <N> --json author,headRefName,baseRefName --jq .author.login
gh api user --jq .login
Equal → author mode. Different → reviewer mode. Announce which:
Reviewer mode on PR #534 by ashklianko.
If no pull request resolves, say so and stop.
解析调用指令:
输入内容含义
空值当前分支的已打开Pull Request
数字或PR URL指定的Pull Request
#discussion_r<id>
URL
指定的单个讨论线程,忽略其他内容
登录名(如
copilot
仅处理该用户发起的线程
自由文本正文模糊匹配该文本的线程
然后确定你的立场,这会选择对应的工作模式:
bash
gh pr view <N> --json author,headRefName,baseRefName --jq .author.login
gh api user --jq .login
两者相等 → 作者模式。两者不同 → 审查者模式。需告知当前模式:例如
审查者模式,处理ashklianko发起的PR #534。
如果无法找到对应的Pull Request,需告知并终止流程。

Phase 2: Fetch

阶段2:获取数据

One query, up front, per
references/fetching.md
. It carries the thread and comment ids that replying and resolving need, the
__typename
that decides bot from human, and
originalLine
for outdated threads. Read that file before writing the query — the previous version of this skill could not reply or resolve at all, because it fetched neither id.
Do not filter resolved threads out of the fetch. Filter in Phase 3.
根据
references/fetching.md
中的要求,提前执行一次查询。查询需包含回复和解决线程所需的线程及评论ID、区分机器人与人类的
__typename
,以及过时线程的
originalLine
。编写查询前请阅读该文档——之前版本的技能完全无法回复或解决线程,原因就是未获取这些ID。
获取数据时不要过滤已解决的线程,在阶段3进行过滤。

Phase 3: Standing

阶段3:判断立场权限

Resolved before any verdict, because it decides whether a verdict is yours to state at all. A single-bot thread on your own pull request and a two-human argument you were never part of are not the same situation and must not be treated alike.
Your sideThread rooted byLast comment byPosture
ReviewerAuthor the review. Phase 7 publishes it
AuthorBotbot onlyAct — verify, reply, resolve. Code only under
--fix
AuthorBotyouAlready answered. Hands off
AuthorBotanother humanMay add a technical fact. Do not resolve
AuthorHumanthat humanDraft a reply, confirm before posting. Never resolve
AuthorHumanyouThe ball is in their court. Do nothing
Author2+ other humans, you unmentionedRead-only. Report as context, never reply
A bot's own follow-up does not count as a human reply. Only a
User
moves the last-comment axis.
Resolved threads are out of scope unless
--full
or an explicit instruction brings them back.
在得出任何结论前先判断权限,因为这决定了你是否有权发表结论。自己Pull Request上的单机器人线程,与你从未参与过的两人争论线程,是完全不同的情况,必须区别对待。
你的立场线程发起者最后评论者处理方式
审查者撰写审查意见,阶段7发布
作者机器人仅机器人执行操作——验证、回复、解决线程。仅在
--fix
模式下修改代码
作者机器人你自己已回复过,无需处理
作者机器人其他人类可补充技术事实,但不要解决线程
作者人类该人类撰写回复草稿,发布前确认。绝不解决线程
作者人类你自己等待对方回复,无需操作
作者2名及以上其他人类,未提及你只读模式。仅作为上下文报告,绝不回复
机器人自身的后续评论不算人类回复。只有
User
类型的用户才会改变最后评论者的判定。
已解决的线程不在处理范围内,除非
--full
模式或明确指令要求重新处理。

Phase 4: Verify

阶段4:验证

Per
references/verifying-a-claim.md
. Decompose each claim into its premise about the world and its conclusion about this code, and verify them separately — recording which failed, because the answer differs completely.
Pin the resolved dependency version before reading any artifact. Never a package located by
find
in a global cache, never memory. Never apply a
```suggestion
block unread.
Scope: every bot claim and anything heading for
fix
or
reject
.
--full
adds everything unresolved, human claims included. Loose recommendations and other reviewers' summaries are reported as context and never verified.
按照
references/verifying-a-claim.md
执行。将每个主张分解为关于外部环境的前提和关于当前代码的结论,分别验证——记录哪部分验证失败,因为对应的回复完全不同。
读取任何工件前,先固定依赖的版本。绝不要使用全局缓存中通过
find
找到的包,也不要依赖记忆。绝不要直接应用未阅读过的
```suggestion
代码块。
验证范围:所有机器人主张,以及所有标记为
fix
reject
的内容。
--full
模式会增加所有未解决的内容,包括人类主张。宽松的建议和其他审查者的总结仅作为上下文报告,不进行验证。

Phase 5: Verdict

阶段5:结论

Six, replacing the old
fix
/
skip
pair:
VerdictWhen
fix
Real, and the change is yours to make
reject
The premise or the conclusion is false. The reply carries the evidence
already-addressed
Handled elsewhere.
isOutdated
is the hint
discuss
Correct, but the call belongs to a person — scope, architecture, product
defer
Real, and deliberately not now
ack
Praise or an FYI. Nothing to answer
discuss
triggers on authority, not difficulty. A hard fix you are confident about is a
fix
.
共六种结论,替代旧的
fix
/
skip
组合:
结论适用场景
fix
主张属实,且该修改由你负责
reject
前提或结论错误。回复需附带证据
already-addressed
问题已在别处处理。
isOutdated
是判断提示
discuss
主张正确,但决策需由人员做出——涉及范围、架构、产品等
defer
主张属实,但暂不处理
ack
表扬或告知信息。无需回复
discuss
的触发条件是权限问题,而非难度问题。即使是复杂但你有把握的修复,也应标记为
fix

Phase 6: Fix (
--fix
only)

阶段6:修复(仅
--fix
模式)

Without
--fix
nothing is edited; a
fix
verdict is reported and its thread left for a later run.
With it: one thread's finding at a time, then the project's own checks — whatever
package.json
,
Makefile
or CI actually runs. A fix whose checks fail is reverted, not worked around, and its verdict drops to
discuss
with the failure quoted. Never claim a fix that has not gone green.
未开启
--fix
时不会编辑任何代码;
fix
结论仅作为报告,对应的线程留待后续处理。
开启
--fix
时:每次处理一个线程的问题,然后运行项目自身的检查——无论
package.json
Makefile
或CI实际执行的是什么检查。如果修复未通过检查,则回滚修改,结论改为
discuss
并引用失败信息。绝不要声称修复已完成,除非检查全部通过。

Phase 7: Speak

阶段7:发言

Composition is in
references/answering.md
: the answer in the first clause, real symbols rather than descriptions, a link where one exists, ready concessions, and the decision handed back. A fix reply is shorter — what changed, why, and the check that passed.
Reviewer mode publishes instead of replying. Invoke
review:changes-review
to attack the diff and verify what it finds, passing the pull request's own issue as the requirement and any system facts you have, then let its publication phase post the review with
--review
. It owns the inline anchoring, the grouping of minors, and the verdict mapping; do not rebuild them here. Where the host cannot invoke another skill, run the same attack inline and publish by the rules
changes-review
documents for it — one inline comment per finding, minors grouped, nothing published without a demonstration and an attribution, and the verdict set by whether a blocker survived.
Confirm before anything leaves. In author mode show the composed replies; in reviewer mode show the whole review — every inline comment, the body, the verdict — laid out locally first. Ask per Asking the User — post as written (recommended) / edit first / discard.
--auto
skips this and posts directly.
Resolve only what
references/answering.md
permits: never a human-rooted thread, never a
discuss
. Check
viewerCanUpdate
before attempting.
回复内容需遵循
references/answering.md
的规则:开头直接给出答案,使用真实符号而非描述,存在链接则附上,主动做出合理让步,将决策交还给相关人员。修复的回复应更简短——说明修改内容、原因,以及通过的检查。
审查者模式下发布审查意见而非回复。调用
review:changes-review
分析代码差异并验证发现的问题,将Pull Request自身的需求作为要求传入,同时传入所有已知的系统事实,然后让其发布阶段通过
--review
发布审查意见。该工具负责行内锚定、次要问题分组以及结论映射;不要在此处重新实现这些功能。如果宿主环境无法调用其他技能,则按照
changes-review
文档中的规则,在本地执行相同的审查流程并发布——每个问题对应一条行内评论,次要问题分组,未经过演示和归因的内容绝不发布,根据是否存在未解决的阻塞问题确定最终结论。
任何内容发布前需确认。作者模式下需展示撰写好的回复;审查者模式下需展示完整的审查意见——所有行内评论、正文、结论——先在本地展示。按照「向用户提问」的规则进行确认——按原文发布(推荐)/先编辑/放弃发布。
--auto
模式会跳过此步骤直接发布。
仅解决
references/answering.md
允许的线程:绝不解决人类发起的线程,绝不解决标记为
discuss
的线程。执行解决操作前需检查
viewerCanUpdate
权限。

Output

输出格式

undefined
undefined

PR #<N> <author|reviewer> mode: <N> threads · <F> fixed · <R> rejected · <D> discuss · <X> deferred

PR #<N> <作者|审查者>模式:<N>个线程 · <F>个已修复 · <R>个已驳回 · <D>个待讨论 · <X>个已推迟

<per thread: the claim in a clause, the verdict, and what was done>
Posted: <N replies, N resolves, or the review and its verdict> Held: <what awaits your confirmation, or what --fix would have changed> Context: <read-only threads, unverified chatter>

Deferrals are always listed even though their threads are closed. A deferral nobody can see is
backlog that does not exist yet.
<每个线程:以短句呈现主张、结论,以及执行的操作>
已发布:<N>条回复,<N>个已解决线程,或审查意见及其结论> 待确认:<等待你确认的内容,或
--fix
模式下会修改的内容> 上下文:<只读线程,未验证的讨论内容>

即使线程已关闭,推迟处理的内容也会始终列出。无人可见的推迟内容不属于待办事项。

Rules

规则

  • Verify, then speak. No verdict that was not executed. No fix claimed without a green check.
  • Standing before verdict. Whether you may answer is decided before what the answer is.
  • Never resolve a human's thread. Closing someone's thread is theirs to do.
  • Premise and conclusion are separate claims. A bot's conclusion can be right for a wrong reason.
  • The pull request belongs to its author. Suggest, do not instruct.
  • No code without
    --fix
    .
    Reporting a needed change is not the same as making it.
  • 先验证,再发言:绝不发布未经过验证的结论。绝不声称修复已完成,除非检查全部通过。
  • 先判断权限,再得出结论:先确定你是否有权回复,再确定回复内容。
  • 绝不解决人类发起的线程:关闭他人的线程应由对方自己操作。
  • 前提和结论是独立的主张:机器人的结论可能因错误的前提而偶然正确。
  • Pull Request属于其作者:仅提出建议,不要下达指令。
  • 未开启
    --fix
    时绝不修改代码
    :报告需要修改的内容与直接修改代码是两回事。

Error handling

错误处理

SituationAction
No pull request resolvesSay so and stop. Do not review the working tree instead
Every thread is resolvedSay the pull request is clear. Do not manufacture findings
A claim cannot be verified either way
discuss
, with what you tried and what was inconclusive
The resolved dependency version cannot be establishedSay so in the reply and make no version claim
viewerCanUpdate
is false
Reply where possible, resolve nothing, say why
A reply posts but the resolve failsSay which thread is half-answered. Do not repost the reply
--fix
and the checks were already failing
Establish the baseline first; never blame a pre-existing failure on the fix
Host cannot invoke another skillRun the review inline, per Phase 7
--fix
in reviewer mode
Ignore it and say why
The project's check command is outside the pre-approved setIt will prompt for approval. Run it anyway — an unrun check is not a green check
场景操作
无法找到对应的Pull Request告知用户并终止流程。不要转而审查工作区代码
所有线程均已解决告知用户Pull Request已无问题。不要编造问题
无法验证主张的真伪标记为
discuss
,说明尝试过的方法和不确定的原因
无法确定依赖的版本在回复中说明,不要做出任何版本相关的主张
viewerCanUpdate
权限为false
尽可能回复,不解决任何线程,并说明原因
回复发布成功但解决线程失败告知用户哪个线程仅完成了回复。不要重新发布回复
开启
--fix
时检查已失败
先确定基线状态;绝不要将预先存在的失败归咎于本次修复
宿主环境无法调用其他技能按照阶段7的规则在本地执行审查流程
审查者模式下使用
--fix
忽略该标识并说明原因
项目的检查命令不在预批准列表中会提示用户批准。无论如何都要执行检查——未执行的检查不能算作通过