-
Checkout the PR Branch
Use the git-worktrees skill to create an isolated checkout of the PR branch:
Pass the branch name to check out. The worktree will be created at
.worktrees/<branch-name>. All subsequent steps operate from within
that worktree path.
-
Determine Review Scope
-
From within the worktree, run git diff --name-only origin/HEAD...HEAD to identify changed files
-
Check if specific aspects were requested; default to all
-
Prepare the output file and capture metadata:
$DOTFILES/config/agents/skills/review-pr/scripts/review-meta.sh
Read the JSON output directly from the tool result:
outfile, repo, branch, commit_id, pr_number.
-
Gather Requirements Context
Run the requirements-gathering script:
$DOTFILES/config/agents/skills/review-pr/scripts/gather-requirements.sh
Read the JSON output: source, issue_ref, requirements.
-
If source is "none", use AskUserQuestion:
I couldn't find linked requirements for this PR.
Please paste the requirements, acceptance criteria,
or issue description — or type skip to omit the spec review.
-
If jira_attempted is true and source is "none",
mention the Jira key that was tried
and ask the user to paste the ticket description.
Store the collected requirements text as REQUIREMENTS.
If the user types skip, omit the spec review from the run.
-
Determine Applicable Reviews
Based on changes:
- Always: requirements-verifier, code-reviewer
- If
_test.go or test files changed: test-analyzer
- If comments/docs added or modified: docs-analyzer
- If error handling changed: silent-failure-hunter
- If types added/modified: type-design-analyzer
- After passing review: code-simplifier
Skip requirements-verifier only if REQUIREMENTS is empty (user typed skip).
-
Launch Review Agents
Default: sequential (one at a time, easier to act on).
If user requests parallel, launch all simultaneously.
Requirements-verifier — use spec-reviewer subagent type.
Pass the following context in the prompt:
REQUIREMENTS text collected in step 3
- Changed files list from
git diff --name-only origin/HEAD...HEAD
- Full code diff from
git diff origin/HEAD...HEAD
-
Aggregate Results
# PR Review Summary
## Critical Issues (X found)
- [agent]: description [file:line]
## Important Issues (X found)
- [agent]: description [file:line]
## Suggestions (X found)
- [agent]: suggestion [file:line]
## Recommended Action
1. Fix critical issues first
2. Address important issues
3. Consider suggestions
4. Re-run review after fixes
-
Persist Results
Write findings to the outfile path from step 2 using this schema:
{
"version": 1,
"timestamp": "<ISO 8601 UTC>",
"repo": "<owner/repo from gh repo view>",
"branch": "<current branch>",
"commit_id": "<HEAD sha>",
"pr_number": <number or null>,
"aspects": ["<aspects that were run>"],
"findings": [
{
"severity": "critical | important | suggestion",
"agent": "<agent name>",
"file": "<relative file path or null>",
"line": <line number or null>,
"description": "<finding text>"
}
],
}
Report the output path to the user.
-
Offer to Post Review to GitHub
Use AskUserQuestion to ask:
Would you like to post these findings as a GitHub PR review?
If yes, invoke the github-post-pr-review skill.