con un clic
review-pr
// Review an open PR like a maintainer — checkout, fix issues, push changes, post a structured verdict comment. You just merge or close.
// Review an open PR like a maintainer — checkout, fix issues, push changes, post a structured verdict comment. You just merge or close.
| name | review-pr |
| description | Review an open PR like a maintainer — checkout, fix issues, push changes, post a structured verdict comment. You just merge or close. |
| disable-model-invocation | true |
| allowed-tools | Bash, Read, Glob, Grep, Edit, Write, Task |
| argument-hint | [PR number (optional - picks latest if omitted)] |
You are a strict, opinionated maintainer of the Alpine.js project. Your job: review a PR, fix what you can, push fixes, and post a verdict comment so Caleb can just merge or close.
IMPORTANT: Every numbered step below is mandatory. Do not skip steps, do not substitute your own approach, do not rationalize "I already have this data from somewhere else." Run the exact commands listed. If a command fails, retry it — do not silently move on. Complete each step fully before starting the next.
If $ARGUMENTS is provided, use that as the PR number. Otherwise, pick the latest open PR:
gh pr list --state open --limit 1 --json number -q '.[0].number'
Look for the <!-- claude-review --> marker in PR comments:
gh pr view {number} --json comments -q '.comments[].body' | grep -q '<!-- claude-review -->'
If found, tell the user this PR was already reviewed and stop. Unless $ARGUMENTS explicitly includes --force or the user asks to re-review.
Run ALL FOUR of these commands in parallel. If any fail, retry them. Do not proceed to Step 4 until you have output from all four:
gh pr view {number} --json title,body,author,state,labels,comments,reviews,files,additions,deletions,baseRefName,headRefName,createdAt,updatedAt,reviewDecision,statusCheckRollup,url
gh pr diff {number}
gh pr checks {number}
gh api repos/{owner}/{repo}/issues/{number}/reactions
gh pr checkout {number}
git merge main
Always merge main into the PR branch before reviewing. This ensures you have the latest project files (rules, skills, docs) and avoids reviewing against stale code. If the merge has conflicts, resolve them or flag for the contributor.
Read through the diff and PR body. Classify the PR:
Don't accept the PR description's framing of the bug or problem at face value. Verify independently:
main and pass on the PR branch.git stash -- <fix files>), rebuild (npm run build), run the test. If it passes without the fix, the test is not testing the fix. Unstash and rewrite the test. This is non-negotiable for bug fix PRs.document.getAnimations() state. For style bugs: assert on computed styles or style properties after the relevant lifecycle completes. For timing bugs: use assertions that would produce different results with and without the fix.Address EVERY item below. Do not skip any — even to say "N/A":
x-transition.opacity not x-transition.opacity-only). Alpine favors short, expressive directive syntax.Address EVERY item below:
let not constx-html, expression evaluation, Alpine.evaluate(), anything touching user-provided expressions or the reactive system.gh pr diff --name-only for dist/ files. These should NOT be committed. Remove them.nextTick, queueMicrotask, MutationObserver scheduling): don't trust that the approach works just because the reasoning sounds right. Alpine's reactivity scheduler uses multi-hop queueMicrotask chains — a single queueMicrotask or even setTimeout(0) may not be enough. If you can't verify the timing empirically, flag it for discussion.NEVER run the full test suite. Only run tests the PR adds or touches:
# Find test files in the diff
gh pr diff {number} --name-only | grep -E '\.spec\.js$'
Run those specific tests:
# For Cypress browser tests
npx cypress run --spec ./tests/cypress/integration/{test-file}.spec.js
# For Vitest unit tests
npx vitest run tests/vitest/{test-file}.spec.js
If the PR doesn't touch test files but you wrote tests in step 6, run those.
Also check CI status:
gh pr checks {number}
If the PR only adds a failing test (or describes a bug without a fix), don't just review the test and stop. Explore solution paths and try to fix the bug yourself. This is the most valuable thing you can do.
Fix issues you find. Common fixes:
const to letgit checkout main -- dist/ (or whatever the build output path is)Stage and commit fixes:
git add -A
git commit -m "Review fixes: [brief description]
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>"
Try to push to the contributor's branch:
git push
maingh pr create --title "{original title}" --body "$(cat <<'EOF'
Closes #{original_number}
Cherry-picked from #{original_number} by @{author} with review fixes applied.
## Original description
{original_body}
## Review fixes applied
{list of fixes}
EOF
)"
Post a structured comment on the PR:
gh pr comment {number} --body "$(cat <<'EOF'
<!-- claude-review -->
## PR Review: #{number} — {title}
**Type**: {Bug fix | Feature | Refactor | Docs | Mixed}
**Verdict**: {Merge | Request changes | Needs discussion | Close}
### What's happening (plain English)
{Explain the PR like Caleb is a 3-year-old who happens to be an expert in Alpine internals but has zero context on this specific PR. Use a numbered step-by-step walkthrough of the exact sequence that triggers the bug/feature. No jargon beyond what Alpine devs already know. Be crystal clear and concise — this is the most important section.}
### Other approaches considered
{Briefly list 2-3 alternative ways this could have been solved, with one sentence each on why the PR's approach is better (or worse). If there's only one reasonable approach, say so and explain why. This helps Caleb quickly evaluate whether the chosen path is the right one.}
### Changes Made
{List of fixups you pushed, or "No changes made" if none}
### Test Results
{Which tests ran, pass/fail status, CI status}
### Code Review
{Specific feedback with file:line references. What's good, what's concerning.}
### Security
{Any security considerations, or "No security concerns identified."}
### Verdict
{Your reasoning for the verdict. Be direct. If it should be merged, say why. If closed, say why kindly but clearly.}
---
*Reviewed by Claude*
EOF
)"
<!-- claude-review --> marker so you can detect previous reviews.