pr-pair-review by anticorrelator/lore
npx skills add https://github.com/anticorrelator/lore --skill pr-pair-review用于 GitHub PR 的交互式结对审查技能。审查者评论通过一个三回合协议(呈现、丰富、讨论)来驱动议程,并强制进行知识丰富。仅进行分析——生成包含发现和待办事项的工作项,但不修改源代码。
提供的参数:$ARGUMENTS
解析参数: 第一个看起来像 PR 编号(数字)或 GitHub URL 的标记是 PR 标识符。其他所有内容都是聚焦上下文——关于审查期间应关注哪些区域的自由文本指导。
示例:
42 → PR #42,无聚焦上下文42 focus on the new turn protocol logic → PR #42,聚焦于回合协议concentrate on the knowledge enrichment pipeline → 无 PR(自动检测),提供了聚焦上下文如果没有 PR 标识符: 从当前分支检测:
gh pr list --state open --head "$(git branch --show-current)" --json number,baseRefName --jq '.[] | "#\(.number) → \(.baseRefName)"' 2>/dev/null
如果找到多个 PR: 呈现带有基础分支的列表,并询问用户要审查哪一个。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
如果未找到 PR: 向用户询问 PR 编号。如果他们提供的是基础分支,则按基础分支搜索:gh pr list --state open --base <branch> --head "$(git branch --show-current)" ...
将聚焦上下文向前传递——它会影响步骤 3 中的风险区域识别(聚焦区域列在最前面并标记为优先)和步骤 4 中的主题选择(第一轮审查应处理聚焦区域)。
使用共享脚本获取所有 PR 数据:
bash ~/.lore/scripts/fetch-pr-data.sh <PR_NUMBER>
同时收集差异和文件范围:
gh pr diff <PR_NUMBER>
gh pr view <PR_NUMBER> --json files --jq '.files[].path'
解析分组后的 JSON 输出。脚本返回 grouped_reviews(附有内联评论的审查)、unmatched_threads(未匹配到任何审查的审查线程)和 orphan_comments(一般 PR 评论)。
审查选择: 遵循 claude-md/70-review-protocol.md 中定义的审查选择协议。将获取到的审查按审查者分组呈现为批次,并让用户选择要处理哪个批次。仅处理所选批次中的评论——其他批次推迟到后续调用中处理。
如果 PR 只有一位审查者提供了反馈,则跳过选择提示,自动处理该批次。
过滤所选批次:
isOutdated: true)——过滤掉,除非该问题明显仍然适用于当前差异。后续更改代码上的线程很可能已被后续提交解决;不要视为需要处理。在审查开始前,为双方生成一个共享上下文摘要:
## PR 摘要: #<N> — <标题>
**意图:** <关于此 PR 实现了什么的一句话描述>
**范围:** <更改的文件、添加/删除的行数、涉及的子系统>
**风险区域:**
- <区域>: <为什么有风险——例如,涉及共享状态、修改公共 API、更改不变量>
**文件更改摘要:**
- <文件>: <更改的简要描述>
呈现此摘要并进入审查轮次。
阅读审查协议参考,了解丰富和升级规则:
cat ~/.lore/claude-md/70-review-protocol.md
来自所选批次的审查者评论是讨论议程。逐个呈现它们。代理进行协调——它不生成自己的审查主题。8 点检查清单(来自协议)在审查者评论处理完毕后可用作辅助工具(参见下面的可选检查清单轮次),而不是作为主要主题来源。
按此顺序处理审查者评论:
默认的交互模式是交替消息——代理和用户轮流发言。不需要显式模式切换。
当用户粘贴转录文本(例如,Slack 线程、会议记录或先前的审查讨论)时,通过诸如多个说话者姓名、姓名: ... 前缀、带归属的引用块或上下文说话者变化等指示符来检测它。解析转录文本以正确识别说话者并归属陈述,然后通过回合协议处理每个不同的观点,就像由相应方提出一样。
如果归属不明确,请询问用户澄清,而不是猜测。
每个审查者评论经过 3 个回合:
回合 1 —— 呈现: 代理呈现审查者的评论及其上下文:
suggestion —— 提出具体更改issue —— 识别需要修复的问题question —— 请求澄清或理由thought —— 分享观察或考虑nitpick —— 次要的风格或偏好点praise —— 积极的认可回合 2 —— 丰富(强制): 在用户回应之前,代理使用知识库上下文丰富评论。这是一个协议步骤,不是建议——跳过它会降低审查质量。
对于具有实质性标签(suggestion, issue, question, thought)的评论:
查询知识库:
lore search "<topic>" --type knowledge --json --limit 3
内联呈现 1-3 个简洁的引用:[knowledge: entry-title] 并附带一行相关性摘要。
如果知识条目是过时的且 PR 与之矛盾,则标记为“约定可能需要更新”——而不是“PR 错了”。
条件性调查升级: 如果知识结果不足且问题涉及跨边界不变量或跨越多个文件的架构模式,则生成一个探索代理:
Task: Investigate whether [specific concern] holds.
Scope: [files/directories to examine]
Question: [precise question to answer]
Report: Return structured observations — confirmed/refuted/uncertain with evidence.
每次审查最多 2 次调查升级。按层级优先(架构 > 逻辑 > 可维护性)。
对于 nitpick/praise 标签:跳过丰富,直接进入回合 3。
回合 3 —— 讨论 + 解决: 用户在丰富上下文的指导下进行回应。讨论持续进行,直到线程解决为以下之一:
agreed —— 双方达成一致,创建待办事项action —— 识别并确定了具体更改范围deferred —— 有效的问题,但超出此 PR 范围open —— 未解决,需要进一步讨论或升级在每个审查主题开始时,显示所选批次的进度:
[来自 @<reviewer> 审查的第 N 个点,共 M 个]
主题: <审查者评论的简要描述>
文件: <文件路径> (第 <N> 行)
解决一个主题后(回合 3 完成),显示剩余主题:
已解决: <解决方式>。剩余: <topic-2>, <topic-3>, ...
如果剩余列表超过 5 项,显示接下来的 3 项并总结:...还有 N 项。
这让双方都能看到他们在审查中的位置以及接下来是什么。如果用户接受该轮次,进度跟踪会持续到任何代理发起的检查清单审查主题。
跟踪每个线程为:
{id, topic, status, label, blocking?, knowledge_checked, round_count, linked_task}
其中:
blocking? —— 如果该发现会阻止合并,则为 trueknowledge_checked —— 回合 2 丰富完成后为 truelinked_task —— 对生成任务的引用(在步骤 5 中设置)在讨论了所有审查者评论(所选批次的所有线程都已解决、推迟或开放)之后,在进入总结之前,提供一个可选的代理发起的检查清单轮次:
已讨论 @<reviewer> 的所有观点(<resolved> 已解决,<deferred> 已推迟,<open> 未解决)。
希望我使用 8 点审查检查清单进行额外一轮检查吗?这可以检查审查者可能未涵盖的问题——语义契约违规、跨边界不变量、比例性等。
claude-md/70-review-protocol.md 中的完整 8 点检查清单应用于每个更改的文件或逻辑单元,对于任何新发现遵循相同的 3 回合协议(提出、丰富、回应)。来自检查清单轮次的发现被跟踪为代理发起的线程(initiator: "agent")。不要重新提出审查者批次中已涵盖的主题。此提议是单次提示——不要重复询问或在拒绝后坚持。
在用户明确表示要总结之前,不要进入步骤 5(创建工作项)。 这是一个硬性门控——代理永远不会自行发起总结。
在讨论了所有审查点之后(包括用户接受的任何检查清单审查发现),呈现摘要并询问:
已讨论所有 <N> 个审查点。<resolved> 已解决,<open> 仍开放,<deferred> 已推迟。
准备好总结并创建工作项,还是想继续讨论?
门控: 只有在用户明确在步骤 4 中触发总结后,才能进入此步骤。如果未得到用户确认就到达此步骤,则返回步骤 4 并询问。
收集发现并创建工作项:
/work create pr-pair-review-<PR_NUMBER>
使用以下结构编写 notes.md:
# PR 结对审查: #<N> — <标题>
> **审查级别分析。** 这些发现来自代码审查(差异级别分析)。调查代理应针对完整代码库验证假设,而不是将其视为已验证。
## 讨论摘要
按文件和行汇总讨论内容:
- **<文件>:<行>** — <审查者的关注点>。解决方式: <agreed/action/deferred/open>。<简要理由>
- ...
## 已同意的更改
仅限显而易见的修复——拼写错误、命名更正、明显错误的值。这些可以安全地实施,无需进一步调查。
- [ ] <修复描述> — <文件:行>
- ...
## 需要验证
审查者的主张或关注点,需要在行动前进行 `/spec` 调查。每个项目都包含明确的验证指令。
- [ ] 验证 <主张 X> 在 `<文件>:<函数>` 中是否成立 — <审查者的关注点和上下文>
- [ ] 验证 <模式 Y> 在 `<子系统>` 中是否一致 — <要检查什么以及为什么>
- ...
## 已推迟
明确标记为此 PR 范围之外的有效关注点。
- <关注点> — <推迟原因,什么会触发重新审视>
- ...
省略空的部分。生成任务:
/work tasks pr-pair-review-<PR_NUMBER>
评估准备情况:
## 结对审查摘要: PR #<N>
**线程:** <总计> (<已解决>, <未解决>, <已推迟>)
**阻塞性发现:** <数量>
**知识丰富:** <数量> 次查询,呈现了 <数量> 次引用
**调查升级:** <数量>
**工作项:** <slug> (<准备情况级别>)
### 解决方式细分:
- 已同意: <数量>
- 待办: <数量>
- 已推迟: <数量>
- 未解决: <数量>
### 创建的任务: <数量>
1. <任务主题> — <文件>
2. ...
/remember 来自 PR #<N> 的结对审查发现 —— 捕获:讨论中浮现的架构见解、关于代码库的已纠正误解、识别的跨边界不变量、通过知识丰富发现的约定违规。跳过:风格偏好、主观意见、一次性讨论点、任何已在工作项计划中捕获的内容。置信度:对于外部审查者见解为中等(尚未针对代码库内部进行验证)。
此步骤是自动的——不要询问是否运行它。
如果在同一 PR 上重新调用,检查是否存在现有的工作项(例如,/work list 中的 pr-pair-review-<PR_NUMBER>)。如果找到,加载 notes.md 并从上次停止的地方继续审查——将新的讨论点附加到讨论摘要,新的修复附加到已同意的更改,新的指令附加到需要验证,而不是创建重复的工作项。
gh auth login每周安装数
1
仓库
GitHub 星标数
1
首次出现
1 天前
安全审计
安装于
mcpjam1
claude-code1
replit1
junie1
windsurf1
zencoder1
Interactive pair-review skill for GitHub PRs. Reviewer comments drive the agenda through a 3-beat turn protocol (present, enrich, discuss) with mandatory knowledge enrichment. Analysis-only — produces a work item with findings and action items but does not modify source code.
Argument provided: $ARGUMENTS
Parse arguments: The first token that looks like a PR number (digits) or GitHub URL is the PR identifier. Everything else is focus context — free-text guidance about which areas to concentrate on during the review.
Examples:
42 → PR #42, no focus context42 focus on the new turn protocol logic → PR #42, focus on turn protocolconcentrate on the knowledge enrichment pipeline → no PR (auto-detect), focus context providedIf no PR identifier: Detect from current branch:
gh pr list --state open --head "$(git branch --show-current)" --json number,baseRefName --jq '.[] | "#\(.number) → \(.baseRefName)"' 2>/dev/null
If multiple PRs found: Present the list with base branches and ask the user which one to review.
If no PRs found: Ask the user for the PR number. If they provide a base branch instead, search by base: gh pr list --state open --base <branch> --head "$(git branch --show-current)" ...
Carry focus context forward — it influences risk area identification in Step 3 (focused areas are listed first and marked as priority) and topic selection in Step 4 (the first review round should address the focused area).
Fetch all PR data using the shared script:
bash ~/.lore/scripts/fetch-pr-data.sh <PR_NUMBER>
Also gather the diff and file scope:
gh pr diff <PR_NUMBER>
gh pr view <PR_NUMBER> --json files --jq '.files[].path'
Parse the grouped JSON output. The script returns grouped_reviews (reviews with inline comments attached), unmatched_threads (review threads not matched to any review), and orphan_comments (general PR comments).
Review Selection: Follow the Review Selection protocol defined in claude-md/70-review-protocol.md. Present fetched reviews as batches grouped by reviewer and let the user select which batch to work through. Only process comments from the selected batch — other batches are deferred to subsequent invocations.
If the PR has only one reviewer with feedback, skip the selection prompt and proceed with that batch automatically.
Filter the selected batch:
isOutdated: true) — filter out unless the concern clearly still applies to the current diff. Threads on subsequently-changed code are likely addressed by later commits; do not treat as needing action.Before review begins, produce a shared-context summary for both parties:
## PR Summary: #<N> — <title>
**Intent:** <one-sentence description of what this PR accomplishes>
**Scope:** <files changed, lines added/removed, subsystems touched>
**Risk areas:**
- <area>: <why it's risky — e.g., touches shared state, modifies public API, changes invariant>
**File change summary:**
- <file>: <brief description of change>
Present this summary and proceed to review rounds.
Read the review protocol reference for the enrichment and escalation rules:
cat ~/.lore/claude-md/70-review-protocol.md
The reviewer's comments from the selected batch are the discussion agenda. Present them one at a time. The agent facilitates — it does not generate its own review topics. The 8-point checklist (from the protocol) is available as a secondary tool after reviewer comments are exhausted (see optional checklist pass below), not as the primary topic source.
Process reviewer comments in this order:
The default interaction mode is alternating messages — agent and user take turns. No explicit mode switching is needed.
When the user pastes a transcript (e.g., a Slack thread, meeting notes, or prior review discussion), detect it by indicators such as multiple speaker names, Name: ... prefixes, quoted blocks with attribution, or contextual speaker changes. Parse the transcript to identify speakers and attribute statements correctly, then process each distinct point through the turn protocol as if raised by the appropriate party.
If attribution is ambiguous, ask the user to clarify rather than guessing.
Each reviewer comment proceeds through 3 beats:
Beat 1 — Present: The agent presents the reviewer's comment with context:
suggestion — proposes a specific changeissue — identifies a problem that needs fixingquestion — asks for clarification or rationalethought — shares an observation or considerationnitpick — minor style or preference pointpraise — positive acknowledgmentBeat 2 — Enrich (MANDATORY): Before the user responds, the agent enriches the comment with knowledge store context. This is a protocol step, not a suggestion — skipping it degrades review quality.
For comments with substantive labels (suggestion, issue, question, thought):
Query the knowledge store:
lore search "<topic>" --type knowledge --json --limit 3
Surface 1-3 compact citations inline: [knowledge: entry-title] with a one-line summary of relevance.
If a knowledge entry is STALE and the PR contradicts it, flag as "convention may need updating" — not "PR is wrong."
Conditional investigation escalation: If knowledge results are insufficient AND the concern involves cross-boundary invariants or architectural patterns spanning multiple files, spawn an Explore agent:
Task: Investigate whether [specific concern] holds.
Scope: [files/directories to examine]
Question: [precise question to answer]
Report: Return structured observations — confirmed/refuted/uncertain with evidence.
Maximum 2 investigation escalations per review. Prioritize by tier (architecture > logic > maintainability).
For nitpick/praise labels: skip enrichment, proceed directly to Beat 3.
Beat 3 — Discuss + Resolve: The user responds, informed by the enrichment context. Discussion continues until the thread resolves as one of:
agreed — both parties align, action item createdaction — specific change identified and scopeddeferred — valid concern but out of scope for this PRopen — unresolved, needs further discussion or escalationAt the start of each review topic, show progress through the selected batch:
[Point N of M from @<reviewer>'s review]
Topic: <brief description of the reviewer's comment>
File: <file path> (line <N>)
After resolving a topic (Beat 3 completes), show remaining topics:
Resolved: <resolution>. Remaining: <topic-2>, <topic-3>, ...
If the remaining list exceeds 5 items, show the next 3 and summarize: ...and N more.
This gives both parties visibility into where they are in the review and what's coming next. Progress tracking continues through any agent-initiated checklist review topics if the user accepts that pass.
Track each thread as:
{id, topic, status, label, blocking?, knowledge_checked, round_count, linked_task}
Where:
blocking? — true if the finding would block mergeknowledge_checked — true after Beat 2 enrichment completeslinked_task — reference to generated task (set in Step 5)After all reviewer comments have been discussed (all threads from the selected batch are resolved, deferred, or open), offer an optional agent-initiated checklist pass before proceeding to wrap-up:
All of @<reviewer>'s points discussed (<resolved> resolved, <deferred> deferred, <open> open).
Want me to do an additional pass using the 8-point review checklist? This checks for issues the reviewer may not have covered — semantic contract violations, cross-boundary invariants, proportionality, etc.
claude-md/70-review-protocol.md to each changed file or logical unit, following the same 3-beat turn protocol (raise, enrich, respond) for any new findings. Findings from the checklist pass are tracked as agent-initiated threads (initiator: "agent"). Do not re-raise topics already covered in the reviewer's batch.This offer is a single prompt — do not ask repeatedly or push back on a decline.
Do not proceed to Step 5 (work item creation) until the user explicitly says to wrap up. This is a hard gate — the agent never initiates wrap-up on its own.
After all review points are discussed (including any checklist review findings if the user accepted), present a summary and ask:
All <N> review points discussed. <resolved> resolved, <open> still open, <deferred> deferred.
Ready to wrap up and create the work item, or want to continue discussing?
Gate: Only enter this step after the user explicitly triggered wrap-up in Step 4. If this step is reached without user confirmation, return to Step 4 and ask.
Collect findings and create a work item:
/work create pr-pair-review-<PR_NUMBER>
Write notes.md with this structure:
# PR Pair-Review: #<N> — <title>
> **Review-level analysis.** These findings came from a code review (diff-level analysis). Investigation agents should verify assumptions against the full codebase, not accept them as validated.
## Discussion Summary
Per-point summaries of what was discussed, keyed by file and line:
- **<file>:<line>** — <reviewer's concern>. Resolution: <agreed/action/deferred/open>. <brief rationale>
- ...
## Agreed Changes
Trivially obvious fixes only — typos, naming corrections, clearly wrong values. These are safe to implement without further investigation.
- [ ] <fix description> — <file:line>
- ...
## Verification Needed
Reviewer claims or concerns that require `/spec` investigation before action. Each item includes an explicit verification directive.
- [ ] Verify whether <claim X> holds in `<file>:<function>` — <reviewer's concern and context>
- [ ] Verify whether <pattern Y> is consistent across `<subsystem>` — <what to check and why>
- ...
## Deferred
Valid concerns explicitly marked out of scope for this PR.
- <concern> — <why deferred, what would trigger revisiting>
- ...
Omit empty sections. Generate tasks:
/work tasks pr-pair-review-<PR_NUMBER>
Assess readiness:
## Pair-Review Summary: PR #<N>
**Threads:** <total> (<resolved>, <open>, <deferred>)
**Blocking findings:** <count>
**Knowledge enrichments:** <count> queries, <count> citations surfaced
**Investigation escalations:** <count>
**Work item:** <slug> (<readiness level>)
### Resolution breakdown:
- Agreed: <count>
- Action: <count>
- Deferred: <count>
- Open: <count>
### Tasks created: <count>
1. <task subject> — <file>
2. ...
/remember Pair-review findings from PR #<N> — capture: architectural insights surfaced during discussion, corrected misconceptions about codebase, cross-boundary invariants identified, convention violations found via knowledge enrichment. Skip: style preferences, subjective opinions, one-off discussion points, anything already captured in the work item plan. Confidence: medium for external reviewer insights (not yet verified against codebase internals).
This step is automatic — do not ask whether to run it.
If re-invoked on the same PR, check for an existing work item (e.g., pr-pair-review-<PR_NUMBER> in /work list). If found, load notes.md and continue the review from where it left off — append new discussion points to the Discussion Summary, new fixes to Agreed Changes, and new directives to Verification Needed rather than creating a duplicate work item.
gh auth loginWeekly Installs
1
Repository
GitHub Stars
1
First Seen
1 day ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
mcpjam1
claude-code1
replit1
junie1
windsurf1
zencoder1
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
111,800 周安装