bonfire-review-pr
npx skills add https://github.com/vieko/bonfire --skill bonfire-review-pr
Agent 安装分布
Skill 文档
Review Pull Request
Review a GitHub PR in an isolated worktree, then post inline comments on findings.
Git root: !git rev-parse --show-toplevel
Step 1: Parse Arguments
Extract PR number from $ARGUMENTS:
333or#333â PR number 333- Empty â Show usage and abort
Usage: /bonfire-review-pr <pr-number>
If no PR number provided:
“Usage:
/bonfire-review-pr <pr-number>Example:
/bonfire-review-pr 333“
Step 2: Fetch PR Metadata
Get PR details:
gh pr view <number> --json number,title,headRefName,baseRefName,headRefOid,url,body,files
If PR not found: Abort with “PR # not found in this repository.”
Extract and store:
headRefName– PR branch namebaseRefName– Target branch (usually main)headRefOid– Commit SHA for inline commentstitle– PR titleurl– PR URLfiles– Changed files list
Step 3: Compute Worktree Path
Compute worktree path: <git-root>/../<repo-name>-pr-<number>-review
Example: /Users/vieko/dev/gtm â /Users/vieko/dev/gtm-pr-333-review
Step 4: Create Worktree
Create isolated worktree for PR branch:
git fetch origin <headRefName>
git worktree add <worktree-path> origin/<headRefName>
On failure (branch conflict, dirty state, etc.):
- Check error message
- If worktree already exists: Ask user “Worktree already exists. Remove and recreate?”
- Yes:
git worktree remove <worktree-path> --forcethen retry - No: Abort
- Yes:
- If other error: Report error and abort with suggestion to check
git worktree list
Step 5: Get PR Diff
Get the diff for context:
git -C <worktree-path> diff origin/<baseRefName>...HEAD --stat
Get changed files:
git -C <worktree-path> diff origin/<baseRefName>...HEAD --name-only
Step 6: Run Review (Subagent)
Progress: Tell the user “Reviewing PR for blindspots and gaps…”
Use the Task tool to invoke the bonfire:work-reviewer subagent.
Provide the review context:
Review this pull request for blindspots, gaps, and improvements.
**Scope**: PR #<number> - <title>
**PR Description**:
<body from PR>
**Files changed**:
<list of changed files>
**Worktree path**: <worktree-path>
Read the changed files from the worktree to understand the actual changes.
Return categorized findings with severity, effort, and specific file:line references.
Wait for the subagent to return findings before proceeding.
The subagent runs in isolated context (sonnet model), preserving main context for comment posting.
Review Validation
After the subagent returns, validate the response:
Valid response contains:
- Findings with file:line references where applicable
- Severity categorization
On subagent failure: Fall back to in-context review using the diff.
Step 7: Present Findings
Present the findings grouped by severity:
For each finding, show:
- File and line number (if applicable)
- Severity (critical/moderate/minor)
- Description
Step 8: Batch Comment Selection
Ask user: “Which findings should I post as PR comments?”
Use AskUserQuestion with options:
- “All” – post all findings
- “Select” – user will specify which ones (e.g., “1, 3, 5”)
- “None” – skip commenting
If “Select” chosen, ask which finding numbers to post.
Step 9: Post Comments
For each selected finding with a file:line reference, post an inline comment:
gh api repos/{owner}/{repo}/pulls/<number>/comments \
-f body="**Review Finding**
<finding description>
*Severity: <severity> | Effort: <effort>*" \
-f commit_id="<headRefOid>" \
-f path="<file-path>" \
-f line=<line-number>
For findings without line numbers, post as general PR comment:
gh pr comment <number> --body "**Review Finding**
<finding description>
*Severity: <severity> | Effort: <effort>*"
Note: GitHub only allows inline comments on files that are part of the PR diff. If a finding references a file not in the diff, post it as a general PR comment instead.
Step 10: Cleanup Worktree
After commenting, ask: “Review complete. Remove worktree?”
If yes:
git worktree remove <worktree-path>
Report: “Worktree cleaned up. PR review complete.”
Step 11: Confirm
Summarize:
- PR reviewed: # –
- Findings: total, posted as comments
- PR URL for reference
- Worktree status (cleaned up or retained)