From data-science
Reviews a GitHub PR using validators for regulatory accuracy, references, and code patterns, then posts findings as a comment (read-only). Supports --local flag and prompts for PR number or title.
npx claudepluginhub policyengine/policyengine-claude --plugin data-science# Reviewing PR: $ARGUMENTS **READ-ONLY MODE**: This command analyzes the PR and posts a review to GitHub WITHOUT making any code changes. Use `/fix-pr` to apply fixes. ## Options - `--local` - Show findings locally only, skip GitHub posting ## Step 1: Determine Posting Mode **If `--local` flag is provided**: Skip prompt, proceed in local-only mode. **If no flag provided**: Use `AskUserQuestion` to prompt BEFORE starting review: Store the user's choice and proceed with the review. --- ## Step 2: Determine Which PR to Review **If no PR argument provided**: Use `AskUserQuestion` ...
/prp-reviewPerforms thorough PR code review: fetches metadata/diff, checks patterns, runs lint/tests/build, posts comments on PR, saves local report. Accepts PR number/URL and --approve/--request-changes flags.
/review-prReviews GitHub PR via <PR_URL>: fetches details/diff/checks, evaluates code quality/design/testing/other criteria, presents findings table, posts approved verdict.
/review-prReviews GitHub PR by number or URL using multi-agent verification across changes, posting structured feedback. Supports --no-interactive mode.
/reviewReviews a GitHub pull request: parses PR number or URL, fetches metadata and diff with gh CLI, gathers user context, produces structured review document.
/SKILLPerforms deep read-only PR review of intent, correctness, code quality, regression risk, tests, and feedback. Outputs severity-ordered findings, open questions, and summary.
/review-prRuns multi-perspective PR review using specialized agents for code, comments, tests, errors, types, and simplification. Aggregates, dedupes, ranks findings by severity.
Share bugs, ideas, or general feedback.
READ-ONLY MODE: This command analyzes the PR and posts a review to GitHub WITHOUT making any code changes. Use /fix-pr to apply fixes.
--local - Show findings locally only, skip GitHub postingIf --local flag is provided: Skip prompt, proceed in local-only mode.
If no flag provided: Use AskUserQuestion to prompt BEFORE starting review:
Question: "Would you like to post this review to GitHub when complete?"
Options:
- "Yes, post to GitHub" (default)
- "No, show locally only"
Store the user's choice and proceed with the review.
# Parse arguments for --local flag
LOCAL_ONLY=false
PR_ARG=""
for arg in $ARGUMENTS; do
if [ "$arg" = "--local" ]; then
LOCAL_ONLY=true
else
PR_ARG="$arg"
fi
done
If no PR argument provided: Use AskUserQuestion to ask for the PR:
Question: "Which PR would you like to review?"
Header: "PR"
Options:
- "Enter PR number" (e.g., 6390)
- "Enter PR name/title" (e.g., "Arkansas TANF")
Then use the provided value to find the PR.
# If argument is a number, use it directly
if [[ "$PR_ARG" =~ ^[0-9]+$ ]]; then
PR_NUMBER=$PR_ARG
# Otherwise, search for PR by description/title
else
PR_NUMBER=$(gh pr list --search "$PR_ARG" --json number,title --jq '.[0].number')
if [ -z "$PR_NUMBER" ]; then
echo "No PR found matching: $PR_ARG"
exit 1
fi
fi
echo "Reviewing PR #$PR_NUMBER"
if [ "$LOCAL_ONLY" = true ]; then
echo "Mode: Local only (will not post to GitHub)"
fi
Collect information about the PR:
gh pr view $PR_NUMBER --json title,body,author,baseRefName,headRefName
gh pr checks $PR_NUMBER
gh pr diff $PR_NUMBER
Document:
Run 4 focused validators. Each reports issues but does NOT make changes.
Invoke program-reviewer to:
Key question: Does this implementation correctly reflect the law?
Invoke reference-validator to:
Key question: Can every value be traced to an authoritative source?
Invoke implementation-validator to:
adds, add(), add() > 0)period vs period.this_year)Key question: Does the code follow PolicyEngine standards?
Invoke edge-case-generator to:
Key question: Are the important scenarios tested?
Aggregate and prioritize all findings:
Critical (Must Fix Before Merge):
Should Address:
Suggestions:
If multiple validators flag the same issue, combine into one finding with the highest priority level.
If user chose local-only mode: Display findings locally and skip GitHub posting.
If user chose to post to GitHub: Continue with posting.
Before posting, check if you have a prior review on this PR:
# Get current GitHub user
CURRENT_USER=$(gh api user --jq '.login')
# Check for existing reviews from current user
EXISTING=$(gh api "/repos/{owner}/{repo}/pulls/$PR_NUMBER/comments" \
--jq "[.[] | select(.user.login == \"$CURRENT_USER\")] | length")
if [ "$EXISTING" -gt 0 ]; then
echo "Found existing review comments - will post updated review"
fi
Post a single, clear review:
gh pr comment $PR_NUMBER --body "## PR Review
### ๐ด Critical (Must Fix)
1. **Regulatory mismatch**: [Description with specific file:line]
2. **Hard-coded value**: [Value] in [file:line] - create parameter
3. **Reference issue**: [File] - [specific problem]
### ๐ก Should Address
1. **Pattern violation**: Use \`add()\` instead of manual sum in [file:line]
2. **Missing test**: Add edge case for [scenario]
3. **Formatting issue**: [file] - [issue: parameter description/label/values, variable reference format]
### ๐ข Suggestions
1. Consider adding calculation example in docstring
---
### Validation Summary
| Check | Result |
|-------|--------|
| Regulatory Accuracy | X issues |
| Reference Quality | X issues |
| Code Patterns | X issues |
| Formatting (params & vars) | X issues |
| Test Coverage | X gaps |
| CI Status | Passing/Failing |
### Next Steps
To auto-fix issues: \`/fix-pr $PR_NUMBER\`
Or address manually and re-request review."
If CI is failing, add to the Critical section:
gh pr checks $PR_NUMBER --json name,conclusion \
--jq '.[] | select(.conclusion == "failure") | "- **CI Failure**: " + .name'
Based on findings, set the review type:
| Severity | When to Use |
|---|---|
| APPROVE | No critical issues, minor suggestions only |
| COMMENT | Has issues but not blocking (educational) |
| REQUEST_CHANGES | Has critical issues that must be fixed |
/review-pr # Review PR for current branch (prompts before posting)
/review-pr 6390 # Review PR #6390 (prompts before posting)
/review-pr "Arkansas" # Search for PR by title (prompts before posting)
/review-pr --local # Review current branch's PR, show locally only
/review-pr 6390 --local # Review PR #6390, show locally only
These MUST be fixed before merge:
Before starting:
Start by asking the user about posting mode, then proceed through the phases.