agent-reviews
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAutomatically review, fix, and respond to findings from PR review bots on the current PR. Uses a deterministic two-phase workflow: first fix all existing issues, then poll once for new ones.
Path note: All references below are relative to this skill's directory (next to this SKILL.md file). Run them with .
scripts/agent-reviews.jsnode自动审查、修复并回复当前PR中PR审查机器人发现的问题。采用确定性的两阶段工作流:首先修复所有现有问题,然后轮询检查新问题。
路径说明: 以下所有对的引用均相对于本skill的目录(与SKILL.md文件同级)。使用运行这些脚本。
scripts/agent-reviews.jsnodePhase 1: FETCH & FIX (synchronous)
阶段1:获取并修复(同步)
Step 1: Identify Current PR
步骤1:确定当前PR
bash
gh pr view --json number,url,headRefNameIf no PR exists, notify the user and exit.
bash
gh pr view --json number,url,headRefName如果不存在PR,通知用户并退出。
Step 2: Fetch All Bot Comments (Expanded)
步骤2:获取所有机器人评论(展开详情)
Run
scripts/agent-reviews.js --bots-only --unanswered --expandedThis shows only unanswered bot comments with full detail: complete comment body (no truncation), diff hunk (code context), and all replies. Each comment shows its ID in brackets (e.g., ).
[12345678]If zero comments are returned, print "No unanswered bot comments found" and skip to Phase 2.
运行
scripts/agent-reviews.js --bots-only --unanswered --expanded该命令仅显示未回复的机器人评论的完整详情:完整评论内容(无截断)、代码差异块(代码上下文)以及所有回复。每条评论的ID会显示在方括号中(例如)。
[12345678]如果未返回任何评论,打印“未找到未回复的机器人评论”并跳至阶段2。
Step 3: Process Each Unanswered Comment
步骤3:处理每条未回复的评论
For each comment from the expanded output:
针对展开输出中的每条评论:
A. Evaluate the Finding
A. 评估问题
Read the referenced code and determine:
- TRUE POSITIVE - A real bug that needs fixing
- FALSE POSITIVE - Not actually a bug (intentional behavior, bot misunderstanding)
- UNCERTAIN - Not sure; ask the user
Likely TRUE POSITIVE:
- Code obviously violates stated behavior
- Missing null checks on potentially undefined values
- Type mismatches or incorrect function signatures
- Logic errors in conditionals
- Missing error handling for documented failure cases
Likely FALSE POSITIVE:
- Bot doesn't understand the framework/library patterns
- Code is intentionally structured that way (with comments explaining why)
- Bot is flagging style preferences, not bugs
- The "bug" is actually a feature or intentional behavior
- Bot misread the code flow
When UNCERTAIN — use :
AskUserQuestion- The fix would require architectural changes
- You're genuinely unsure if the behavior is intentional
- The "bug" relates to business logic you don't fully understand
- Multiple valid interpretations exist
- The fix could have unintended side effects
查看引用的代码并判断:
- 真实问题 - 需要修复的实际bug
- 误报 - 并非实际bug(有意的行为、机器人误解)
- 不确定 - 无法确定;询问用户
可能为真实问题的情况:
- 代码明显违反既定行为规范
- 对可能未定义的值缺少空值检查
- 类型不匹配或函数签名错误
- 条件语句中的逻辑错误
- 针对文档记录的失败场景缺少错误处理
可能为误报的情况:
- 机器人不理解框架/库的模式
- 代码是有意按该结构编写的(并有注释说明原因)
- 机器人标记的是风格偏好,而非bug
- 所谓的“bug”实际上是一个功能或有意的行为
- 机器人误读了代码流程
当不确定时 — 使用:
AskUserQuestion- 修复需要进行架构变更
- 你确实无法确定该行为是否是有意的
- 该“bug”与你不完全理解的业务逻辑相关
- 存在多种合理的解释
- 修复可能会产生意外的副作用
B. Act on Evaluation
B. 根据评估结果执行操作
If TRUE POSITIVE: Fix the code. Track the comment ID and a brief description of the fix.
If FALSE POSITIVE: Do NOT change the code. Track the comment ID and the reason it's not a real bug.
If UNCERTAIN: Use . If the user says skip, track it as skipped.
AskUserQuestionDo NOT reply to comments yet. Replies happen after the commit (Step 5).
如果是真实问题: 修复代码。记录评论ID和修复的简要描述。
如果是误报: 不要修改代码。记录评论ID和不是真实bug的原因。
如果是不确定: 使用。如果用户说跳过,将其标记为已跳过。
AskUserQuestion暂时不要回复评论。回复操作在提交(步骤5)后进行。
Step 4: Commit and Push
步骤4:提交并推送
After evaluating and fixing ALL unanswered comments:
- Run your project's lint and type-check
- Stage, commit, and push:
bash
git add -A git commit -m "fix: address PR review bot findings {List of bugs fixed, grouped by bot}" git push - Capture the commit hash from the output.
在评估并修复所有未回复的评论后:
- 运行项目的代码检查和类型校验
- 暂存、提交并推送:
bash
git add -A git commit -m "fix: address PR review bot findings {List of bugs fixed, grouped by bot}" git push - 从输出中获取提交哈希值。
Step 5: Reply to All Comments
步骤5:回复所有评论
Now that the commit hash exists, reply to every processed comment:
For each TRUE POSITIVE:
Run
scripts/agent-reviews.js --reply <comment_id> "Fixed in {hash}. {Brief description of the fix}"For each FALSE POSITIVE:
Run
scripts/agent-reviews.js --reply <comment_id> "Won't fix: {reason}. {Explanation of why this is intentional or not applicable}"For each SKIPPED:
Run
scripts/agent-reviews.js --reply <comment_id> "Skipped per user request"DO NOT start Phase 2 until all replies are posted.
现在已有提交哈希值,回复每条已处理的评论:
针对每个真实问题:
运行
scripts/agent-reviews.js --reply <comment_id> "Fixed in {hash}. {Brief description of the fix}"针对每个误报:
运行
scripts/agent-reviews.js --reply <comment_id> "Won't fix: {reason}. {Explanation of why this is intentional or not applicable}"针对每个已跳过的问题:
运行
scripts/agent-reviews.js --reply <comment_id> "Skipped per user request"在所有回复发布完成前,不要开始阶段2。
Phase 2: POLL FOR NEW COMMENTS (loop until quiet)
阶段2:轮询新评论(循环直至无新评论)
The watcher exits immediately when new comments are found (after a 5s grace period to catch batch posts). This means you run it in a loop: start watcher, process any comments it returns, restart watcher, repeat until the watcher times out with no new comments.
当发现新评论时(在5秒宽限期后捕获批量发布的评论),监控器会立即退出。这意味着你需要循环运行它:启动监控器,处理它返回的任何评论,重启监控器,重复此过程直到监控器超时且未发现新评论。
Step 6: Start Watcher Loop
步骤6:启动监控器循环
Repeat the following until the watcher exits with no new comments:
6a. Launch the watcher in the background:
Run as a background task.
scripts/agent-reviews.js --watch --bots-only6b. Use to wait for the watcher to complete (blocks up to 12 minutes).
TaskOutput6c. Check the output:
-
If new comments were found (output contains):
EXITING WITH NEW COMMENTS- Use to read each new comment's full detail
--detail <id> - Process them exactly as in Phase 1, Steps 3-5 (evaluate, fix, commit, push, reply)
- Go back to Step 6a to restart the watcher
- Use
-
If no new comments (output contains): Stop looping and move to the Summary Report.
WATCH COMPLETE
重复以下步骤,直到监控器退出且未发现新评论:
6a. 在后台启动监控器:
将作为后台任务运行。
scripts/agent-reviews.js --watch --bots-only6b. 使用等待监控器完成(最多阻塞12分钟)。
TaskOutput6c. 检查输出:
-
如果发现新评论(输出包含):
EXITING WITH NEW COMMENTS- 使用查看每条新评论的完整详情
--detail <id> - 完全按照阶段1的步骤3-5处理它们(评估、修复、提交、推送、回复)
- 回到步骤6a重启监控器
- 使用
-
如果未发现新评论(输出包含): 停止循环并生成总结报告。
WATCH COMPLETE
Summary Report
总结报告
After both phases complete, provide a summary:
undefined在两个阶段完成后,提供总结:
undefinedPR Review Bot Resolution Summary
PR审查机器人问题处理总结
Results
结果
- Fixed: X bugs
- Already fixed: X bugs
- Won't fix (false positives): X
- Skipped per user: X
- 已修复:X个bug
- 已自动修复:X个bug
- 不修复(误报):X个
- 按用户要求跳过:X个
By Bot
按机器人分类
cursor[bot]
cursor[bot]
- BUG-001: {description} - Fixed in {commit}
- BUG-002: {description} - Won't fix: {reason}
- BUG-001: {description} - Fixed in {commit}
- BUG-002: {description} - Won't fix: {reason}
Copilot
Copilot
- {description} - Fixed in {commit}
- {description} - Fixed in {commit}
Status
状态
✅ All findings addressed. Watch completed.
undefined✅ 所有问题已处理。监控完成。
undefinedImportant Notes
重要说明
Response Policy
回复策略
- Every finding gets a response - No silent ignores
- Responses help train bots and document decisions
- "Won't fix" responses prevent the same false positive from being re-raised
- 每个问题都要回复 - 不要默默忽略
- 回复有助于训练机器人并记录决策
- “不修复”的回复可以防止相同的误报被再次提出
User Interaction
用户交互
- Use when uncertain about a finding
AskUserQuestion - Don't guess on architectural or business logic questions
- It's better to ask than to make a wrong fix or wrong dismissal
- 当对问题不确定时使用
AskUserQuestion - 不要猜测架构或业务逻辑相关的问题
- 与其做出错误的修复或错误的驳回,不如询问用户
Best Practices
最佳实践
- Verify findings before fixing - bots have false positives
- Keep fixes minimal and focused - don't refactor unrelated code
- Ensure type-check and lint pass before committing
- Group related fixes into a single commit
- Copilot blocks often contain ready-to-use fixes
suggestion
- 在修复前验证问题 - 机器人会产生误报
- 保持修复最小化且聚焦 - 不要重构无关代码
- 在提交前确保类型校验和代码检查通过
- 将相关修复合并到一个提交中
- Copilot的块通常包含可直接使用的修复方案
suggestion