review-pr
Review a GitHub PR using multi-agent verification. Usage /groundwork:review-pr [PR number or URL]. Pass --no-interactive to skip all prompts and auto-publish.
etr · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add etr/groundwork --skill review-pr技能说明
name: review-pr description: Review a GitHub PR using multi-agent verification. Usage /groundwork:review-pr [PR number or URL]. Pass --no-interactive to skip all prompts and auto-publish. argument-hint: "[PR number or URL] [--no-interactive]" allowed-tools: ["Bash", "Read", "Grep", "Glob", "Agent", "AskUserQuestion", "Skill"] disable-model-invocation: true
PR Review Skill
Multi-agent PR review that runs specialized agents against PR changes and posts structured feedback to GitHub.
Non-Interactive Mode Detection
Check for non-interactive mode from either source:
- If the argument string contains
--no-interactive→ strip it from the argument before PR number parsing, setnon_interactive = true - If session context contains
GROUNDWORK_BATCH_MODE=true→ setnon_interactive = true
If either condition is met, all AskUserQuestion prompts below are replaced with their documented auto-decision — except the pre-flight model check, which always prompts.
Pre-flight: Model Recommendation
Your current effort level is {{effort_level}}.
Skip this step silently if effort is high, xhigh, or max (the scale is low < medium < high < xhigh < max, so xhigh and max are already above high) AND you are Sonnet or Opus.
If effort is low or medium (i.e. below high), you MUST show the recommendation prompt — regardless of model.
If you are not Sonnet or Opus, you MUST show the recommendation prompt - regardless of effort level.
Otherwise → always prompt (even in non-interactive mode) using AskUserQuestion:
{
"questions": [{
"question": "Do you want to switch? Multi-agent orchestration and deduplication judgment across 6-8 agents benefits from consistent reasoning.\n\nTo switch: cancel, run `/effort high` (and `/model sonnet` if on Haiku), then re-invoke this skill.",
"header": "Recommended: Sonnet or Opus at high effort",
"options": [
{ "label": "Continue" },
{ "label": "Cancel — I'll switch first" }
],
"multiSelect": false
}]
}
If the user selects "Cancel — I'll switch first": output the switching commands above and stop. Do not proceed with the skill.
Step 1: Parse PR Identifier
Extract the PR number from the user's input. Accept any of these formats:
- Numeric:
42 - With hash:
#42 - Full URL:
https://github.com/owner/repo/pull/42
If no PR identifier was provided:
- Non-interactive mode: Output an error: "No PR identifier provided. Cannot proceed in non-interactive mode." and stop.
- Interactive mode: Use
AskUserQuestionto ask for one (free-text input, no options).
Extract owner/repo by running:
gh repo view --json nameWithOwner --jq '.nameWithOwner'
Store the PR number as pr_number and the owner/repo as repo_slug.
Step 2: Fetch PR Context
Run all of these gh commands in parallel using the Bash tool:
-
PR metadata:
gh pr view <pr_number> --json title,body,baseRefName,headRefName,headRefOid,author,state,url,isCrossRepository,additions,deletions,changedFiles -
PR diff:
gh pr diff <pr_number>Store as
pr_diff. -
Changed file paths:
gh pr view <pr_number> --json files --jq '.files[].path'Store as
changed_file_paths. -
Diff stat:
gh pr diff <pr_number> --statStore as
diff_stat. -
Existing reviews:
gh api repos/<repo_slug>/pulls/<pr_number>/reviewsStore as
existing_reviews. -
Existing review comments:
gh api repos/<repo_slug>/pulls/<pr_number>/commentsStore as
existing_comments.
Validate state:
- If the PR state is not
OPEN:- Non-interactive mode: Log a warning ("PR is [state] — continuing anyway") and proceed.
- Interactive mode: Use
AskUserQuestion:
If "Cancel" → stop.{ "questions": [{ "question": "This PR is **[state]**. Continue reviewing anyway?", "header": "PR is not open", "options": [ { "label": "Yes, continue" }, { "label": "Cancel" } ], "multiSelect": false }] }
- If
isCrossRepositoryis true, rungh pr checkout <pr_number>to fetch the fork's branch. - Otherwise, checkout the PR branch:
gh pr checkout <pr_number>.
Step 3: Handle Existing Feedback
3a: Detect Previous Groundwork Reviews
Search existing_reviews for reviews whose body contains the marker <!-- groundwork-review -->.
If groundwork reviews exist:
- Non-interactive mode: Proceed with a fresh review (default).
- Interactive mode: Use
AskUserQuestion:{ "questions": [{ "question": "Previous groundwork review(s) found on this PR. How would you like to proceed?", "header": "Existing groundwork reviews detected", "options": [ { "label": "Fresh review", "description": "Post a fresh review (dismisses previous)" }, { "label": "Incremental review", "description": "Only new findings since last groundwork review" }, { "label": "Cancel" } ], "multiSelect": false }] }
If "Fresh review" → proceed normally. If "Incremental review" → store previous groundwork findings to exclude duplicates in Step 6. If "Cancel" → stop.
3b: Summarize Non-Groundwork Feedback
If non-groundwork reviews or review comments exist, produce a brief summary as existing_human_feedback. Include:
- Reviewer name and verdict (APPROVED, CHANGES_REQUESTED, COMMENTED)
- Key points raised
This summary will be passed to agents so they avoid restating already-raised points.
3c: Handle Replies on Previous Groundwork Comments
If existing_comments contain replies to previous groundwork-authored comments (detected by <!-- groundwork-review --> marker or matching author):
- Present these reply threads to the user
- Recommend responses and paths forward before proceeding with the