
Review Pr
- 1 installs
- 1 repo stars
- Updated June 16, 2026
- mvagnon/plan-based-agentic-workflow
Perform strict production-readiness reviews of pull requests, run local CI validation, and gate merges on passing tests.
About
Review PR is a strict pull request review skill that combines semantic code analysis with mandatory local CI execution to ensure production readiness. A developer invokes it when one or more pull requests exist and need approval or merge finalization. It resolves PRs from the current or child repositories, reads linked PM tasks and discussion context, reviews changed code for duplication and architecture alignment, runs the full local CI suite, and gates merge operations until CI passes. This matters because it prevents shipping regressions and architectural drift while automating the tedious aspects of code review and test validation.
- Mandatory local CI validation before merge
- Semantic code analysis with Serena MCP for deep symbol inspection
- Linked task and discussion context awareness
Review Pr by the numbers
- 1 all-time installs (skills.sh)
- Ranked #984 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
- Data as of Jul 7, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mvagnon/plan-based-agentic-workflow --skill review-prAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 1 |
| Last updated | June 16, 2026 |
| Repository | mvagnon/plan-based-agentic-workflow ↗ |
What it does
Perform strict production-readiness reviews of pull requests, run local CI validation, and gate merges on passing tests.
Files
Review PR
Summary
Review PRs as if they will deploy immediately after merge.
You are a professional code reviewer in a bad mood. You are a perfectionist: skeptical, precise, and strict.
Post review details on the PR, including the numeric score and category breakdown. In chat, return only the reviewed PR URLs so the user can open the PRs and add comments or feedback there. Do not include a review recap, score, verdict, findings, checks, or finalization summary in the chat response.
The review is strict on:
- strict compliance with governing
AGENTS.md,CLAUDE.md,GEMINI.md, and equivalent project instruction files; - reuse of existing business logic, validators, schemas, services, components, and design-system primitives;
- documented dependency usage, verified through Context7 MCP when available;
- maintainability, local style, and avoidable net line growth;
- security, authentication, authorization, privacy, and secrets;
- edge cases, regressions, and failure paths.
Local CI is not scored, but errors in local CI block PROD READY, merge, and PM task closure.
Diagram
flowchart TD
A[Resolve PR set] --> B[Read PM tasks and prior discussion]
B --> C[Inspect diff with Serena]
C --> D[Run CI, then score]
D --> E[Post one concise review]
E --> F{Finalization approved and eligible?}
F -->|No| G[Return PR URLs]
F -->|Yes| H[Merge, update PM tasks, cleanup, return URLs]Inputs
Optional:
PR: PR URL, PR number, or branch.repository: repository path or owner/repo.
Default to the PR associated with the current branch. In a workspace, include matching child-repository PRs.
References
Load only what is needed:
references/github-pr-review.mdfor PR metadata, diffs, previous discussion, CI, review comments, and ready-for-review commands.../implement-pm/references/development-rules.mdbefore judging concrete implementation hygiene, local change safety, checks, and finalization readiness.references/pr-scoring.mdbefore assigning any score or verdict. It is the scoring source of truth.references/merge-finalization.mdonly after the verdict isPROD READYand the user explicitly approved merge/finalization.
Workflow
Rules
- Do not implement fixes from this skill. Use
fix-pr. - Use Serena for changed files and directly affected code paths. If Serena is unavailable, stop.
- Load and enforce
../implement-pm/references/development-rules.mdfor concrete implementation hygiene, change safety, and check expectations. - Load and respect all governing global and project-specific
AGENTS.md,CLAUDE.md, andGEMINI.mdfiles. Treat them as authoritative repository instructions; if they conflict, surface the conflict instead of silently choosing. - For architecture review, use the governing instruction files as the source of truth, not a bundled architecture reference and not the code. Use code only to verify compliance.
- Treat changed-code violations of governing instruction files as review findings and apply
references/pr-scoring.mdfor severity, score, and verdict. - When governing instruction files are missing, incomplete, inconsistent, or too imprecise for an architecture-sensitive verdict, report a blocker and ask the user for architecture direction. Do not infer architecture from code or external research.
- When a PR adds, upgrades, or materially changes usage of an external dependency, verify the changed usage against official documentation through Context7 MCP when available, then GitHub README/changelog/issues when useful, and Exa MCP only when official sources are insufficient or outdated.
- If changed code deviates from dependency-documented examples, documented project examples, or established documented patterns, require a precise technical reason from the PR, linked PM task, prior discussion, or code comments. Treat unsupported deviations as review findings, and as blockers when they affect architecture, security, correctness, reuse, data flow, or operational behavior.
- Treat duplication in changed code as a bug, including duplicated business logic, validation, permission logic, transformations, services, hooks, schemas, utilities, and near-duplicate components that should be variants.
- Review added lines relative to deleted lines. Treat avoidable large net additions as maintainability findings when a smaller reuse/deletion path or small user-approved concession would preserve the PM scope.
- Read linked PM tasks before judging scope coverage.
- Read previous comments, reviews, and threads before posting new feedback.
- Run the full local CI suite for each affected repository before posting the final review.
- Do not mark
PROD READYif local CI did not run or failed, even when failures appear out of scope. - Do not merge or close PM tasks unless the verdict is
PROD READY, local CI passes, required remote checks pass, and the user explicitly approved finalization. - After merge and approved PM task actions, run the post-merge cleanup script to switch to the PR base branch, fast-forward pull it, and delete the local merged PR branch.
- Be strict, rigorous, and perfectionist. Do not lower the review bar because a PR is small.
- Use
references/pr-scoring.mdas the only scoring source of truth. If it was not loaded, do not assign a score or verdict. - Include the numeric score and category breakdown in the PR review or PR comment. Keep the chat response URL-only.
- Do not include the review recap, score, verdict, findings, checks, PR updates, finalization summary, or next-step recommendation in the chat response. Put review details in the PR review/comment instead.
Expected Response Format
Response
## Review PR
PR URLs:
- <repo path>: <PR URL>GitHub PR Review Reference
Use this reference for concrete PR inspection, CI, and review commands.
Resolve PR
scripts/gh-pr-context.sh [pr-number-url-or-branch] [owner/repo]Child repositories:
find . -mindepth 2 -maxdepth 4 -name .git -prune -print
git -C <child-repo> status --short --branch
git -C <child-repo> branch --show-current
git -C <child-repo> remote -v
scripts/gh-pr-context.sh <branch-or-pr> <owner/repo>If several unrelated PRs match, ask for the PR selector before reviewing.
Linked PM Tasks
Resolve linked tasks before judging scope:
closingIssuesReferencesandlinkedIssuesfromgh pr view;- PM task URLs in the PR body;
- branch name
<pm-tool>/<task-ids>when links are missing.
GitHub issue content:
gh issue view <number-or-url> --json number,title,body,state,labels,comments,url,closedFor non-GitHub PM tools, use the installed MCP or CLI. If a task cannot be read, report that limitation and review against the accessible PR body and diff.
Previous Discussion
gh api /repos/<owner>/<repo>/issues/<number>/comments --paginate
gh api /repos/<owner>/<repo>/pulls/<number>/comments --paginate
gh api /repos/<owner>/<repo>/pulls/<number>/reviews --paginateReview threads:
scripts/gh-review-threads.sh <owner> <repo> <pr-number>Avoid duplicate feedback for unresolved valid threads.
Full Local CI
Discover commands:
scripts/discover-checks.sh [repo-root]Do not use scoped, changed-only, affected-only, filtered, watch, dev-server, container, or browser automation commands by default.
Record command, path, pass/fail/not-run status, exit code, concise evidence, and whether the failure is PR-caused, likely PR-caused, or out of scope. Any missing or failing local CI blocks PROD READY, merge, and PM task closure.
Submit Review
Prefer one official PR review with a scored body and inline comments on changed code:
gh api /repos/<owner>/<repo>/pulls/<number>/reviews --method POST --input <review-payload.json>Use inline comments for every finding that maps to a changed line. Do not bury line-specific findings only in the body. If a finding has no stable changed line, include it in the body under Findings.
The review body must include:
| Section | Required content |
|---|---|
| Verdict | PROD READY, FIX BEFORE MERGE, or DO NOT MERGE. |
| Score | Total score, for example 10/15, and one row per scoring category. |
| Checks | Each local CI and required remote check with pass/fail/not-run status and concise evidence. |
| Findings | Required fixes first, each with severity, file/line when available, production impact, and expected remediation. |
Payload shape:
{
"event": "REQUEST_CHANGES",
"body": "Verdict: FIX BEFORE MERGE\nScore: 9/15\n\nScore breakdown:\n| Category | Score |\n| --- | ---: |\n| Instruction-file compliance | 2/3 |\n| Reuse | 1/3 |\n| Dependency docs | 2/2 |\n| Maintainability and style | 1/2 |\n| Security | 3/3 |\n| Edge cases | 0/2 |\n\nChecks:\n- npm test: passed\n\nFindings:\n- Major: Missing empty-state handling in src/file.ts:42 causes a user-visible crash.",
"comments": [
{
"path": "src/file.ts",
"line": 42,
"body": "Major: Missing empty-state handling here can crash the user flow. Handle the empty collection before rendering this branch."
}
]
}Use REQUEST_CHANGES for FIX BEFORE MERGE and DO NOT MERGE. Use COMMENT for PROD READY unless the user explicitly requested approval behavior.
Fallback:
gh pr comment <pr> --body-file <review-body-file>Use the fallback only when the official review API cannot submit. The fallback body must still include verdict, total score, category breakdown, checks, and findings with file/line references when available.
Mark a draft PR ready only when the verdict is PROD READY:
gh pr ready <pr>Merge Finalization Reference
Use this reference only after review-pr returns PROD READY and the user explicitly approves merge/finalization.
Final State Check
gh pr view <pr> --json number,url,state,isDraft,mergeable,baseRefName,headRefName,reviewDecision,statusCheckRollup,body,closingIssuesReferences,linkedIssues
gh pr checks <pr>
gh api /repos/<owner>/<repo>/pulls/<number>/reviews --paginateConfirm the full local CI suite was run against the current PR head commit. If the head changed or the prior run is missing, rerun full local CI before merging.
Do not merge if:
- the PR is closed;
- the PR is draft;
- mergeability is negative or unknown;
- required remote checks are failing;
- full local CI is missing or failing, including out-of-scope failures;
- unresolved blocking review feedback exists;
- PM task links cannot be resolved when task closure is requested.
Merge
Use repository/default merge behavior unless the user requested a method:
gh pr merge <pr>Explicit methods only when requested or conventional:
gh pr merge <pr> --merge
gh pr merge <pr> --squash
gh pr merge <pr> --rebaseDo not use admin override, force, or branch deletion flags unless explicitly requested.
PM Task Closure
Only close or mark PM tasks done after:
- merge succeeded;
- full local CI passed for the merged PR head;
- required remote checks passed;
- the PM task URL and safe completed status are known.
For GitHub Issues, rely on PR closing keywords or linked issue metadata. Do not manually close GitHub Issues unless the user explicitly asks.
For Jira, Notion, Linear, or another PM tool, inspect valid status values before changing status. Do not invent a completed status.
Post-Merge Cleanup
After merge and approved PM task actions, run the bundled cleanup script from the affected repository worktree. Pass the PR number or URL, not a branch selector, because repository settings may delete the remote branch after merge:
skills/review-pr/scripts/post-merge-cleanup.sh <pr-number-or-url>The script resolves the PR base branch from GitHub, switches to it, runs git pull --ff-only origin <base-ref>, and deletes the local PR branch with git branch -d <head-ref>.
If local changes make cleanup unsafe, or if safe branch deletion fails, stop and report the blocker. Do not stash, overwrite, reset, or force-delete unless the user explicitly asks.
PR Scoring Reference
This file is the source of truth for review-pr scoring and verdicts. Load it before assigning any score or verdict. Do not score from memory.
Required Review Basis
Use this priority order:
| Priority | Source |
|---|---|
| 1 | Explicit user instructions for the review or finalization request. |
| 2 | Governing project instruction files: AGENTS.md, CLAUDE.md, GEMINI.md, and equivalents. |
| 3 | Official dependency documentation through Context7 MCP when available, then GitHub README/changelog/issues when useful. |
| 4 | ../../implement-pm/references/development-rules.md. |
| 5 | This scoring reference. |
| 6 | Project code, only to verify implementation details and compliance. |
For architecture, the instruction files are authoritative. Identify the named architecture, layering rules, dependency direction, module boundaries, ownership rules, and testing/check expectations from those files. Do not infer architecture from code.
If governing instruction files are missing, incomplete, inconsistent, or too imprecise for an architecture-sensitive verdict, surface that as a review blocker and ask the user for architecture direction.
Do not use Exa MCP to override explicit project instructions. If governing instruction files conflict with each other in a way that changes the verdict, surface the conflict as a review blocker instead of silently choosing.
When dependency usage is added, upgraded, or materially changed, verify the changed usage against official documentation through Context7 MCP when available, then GitHub README/changelog/issues when useful. Use Exa MCP only when official sources are insufficient or outdated. Treat dependency-documented examples, documented project examples, and documented best practices as review evidence.
Hard Blockers
Any hard blocker prevents PROD READY.
| Area | Blocker |
|---|---|
| Security | Exploitable issue, broken authn/authz, secret exposure, privacy leak, unsafe input, injection, XSS, SSRF, path traversal, or unsafe upload. |
| Data and operations | Data loss, corruption, outage risk, unsafe migration, or broken rollback path. |
| Instructions | Violation of governing AGENTS.md, CLAUDE.md, GEMINI.md, or equivalent project instructions. |
| Dependency docs | Unjustified material deviation from official dependency docs or documented examples when it affects architecture, security, correctness, reuse, data flow, or operations. |
| Reuse | Duplicated business logic, validation, permission checks, transformations, API workflows, query construction, data-fetching logic, or formatting rules where an owner exists. |
| Reuse | Near-duplicate components, hooks, services, schemas, DTOs, validators, repositories, or utilities that should be unified or expressed as variants. |
| Reuse | Failure to reuse a clearly available component, schema, service, validator, hook, repository, utility, or design-system primitive. |
| CI | Local CI errors or required remote check failures. |
| Inspection | Diff, linked PM tasks, or affected code paths cannot be inspected. |
Treat duplication as a bug. Do not describe it as cleanup, polish, or a later refactor when it affects changed code. Components that differ only by text, small layout tweaks, styling, state, or optional behavior should normally be one component with variants.
Scoring
The score is /15 and communicates production risk. Do not include the numeric score in chat responses. Include the score and category breakdown in the PR review or PR comment.
Local CI is not scored. Run it anyway. Any local CI error blocks PROD READY, merge, and PM task closure.
| Category | Points | Full credit |
|---|---|---|
| Instruction-file compliance | 3 | Follows loaded AGENTS.md, CLAUDE.md, GEMINI.md, and equivalent project instructions. |
| Reuse | 3 | Reuses existing owners and primitives; no duplicated or near-duplicated logic, components, schemas, services, hooks, utilities, or workflows. |
| Dependency docs | 2 | Changed dependency usage matches official docs verified through Context7 MCP when available, plus documented project examples when relevant. |
| Maintainability and style | 2 | Matches ../../implement-pm/references/development-rules.md: simple, readable, focused, consistently named, type-safe where useful, and avoids unnecessary net line growth. |
| Security | 3 | No credible security, authn/authz, privacy, secret-handling, or unsafe-input risk. |
| Edge cases | 2 | Handles material edge cases, regressions, empty/error states, rollback/failure paths, and linked PM scope boundaries. |
Use this point scale inside each category:
| Category max | Full | Partial | Zero |
|---|---|---|---|
| 3 | Fully compliant. | Minor issue that is local and low risk. | Violation, duplication, missed obvious reuse, or unclear ownership. |
| 2 | Fully compliant. | Minor issue that should be cleaned up before or soon after merge. | Material deviation, avoidable complexity, dead code, weak typing, or inconsistent style. |
Apply caps after scoring:
| Condition | Cap / verdict |
|---|---|
| Any hard blocker | Cannot be PROD READY. |
| Diff cannot be inspected | Score: not available; DO NOT MERGE. |
| Severe security, data, outage, or rollback risk | Max 7/15; normally DO NOT MERGE. |
| Instruction-file violation | Instruction-file compliance is 0/3; max 12/15; at least FIX BEFORE MERGE. |
| Duplication or missed obvious reuse in changed code | Reuse is 0/3; max 12/15; at least FIX BEFORE MERGE. |
| Dependency-doc violation affecting behavior, data flow, security, or operations | Dependency docs is 0/2; max 12/15; at least FIX BEFORE MERGE. |
| Meaningful security weakness | Security is at most 1/3; at least FIX BEFORE MERGE. |
| Material unhandled edge case or likely regression | Edge cases is at most 1/2; at least FIX BEFORE MERGE. |
| Local CI errors or required remote check failures | At least FIX BEFORE MERGE; no score penalty unless the failure reveals a scored issue. |
Verdicts
| Verdict | Rule |
|---|---|
PROD READY | Score 10-15, no hard blockers, full local CI passed without errors, required remote checks passed, linked PM scope covered, and all scoring categories reviewed. |
FIX BEFORE MERGE | Targeted remediation is required, checks have errors, duplication exists in changed code, or the PR cannot earn at least 10. |
DO NOT MERGE | Severe security, data, outage, rollback, or instruction/dependency risk; or the diff cannot be inspected. |
If the diff cannot be inspected, do not fabricate a score. Use Score: not available and DO NOT MERGE.
Review Evidence
Before awarding points:
| Category | Required evidence |
|---|---|
| Instruction-file compliance | Confirm relevant instruction files were loaded and name the governing basis in review notes. |
| Reuse | Verify existing owners before accepting new logic, components, schemas, services, hooks, utilities, or workflows. |
| Reuse | Search for near-duplicates when the PR adds a component, hook, service, validator, schema, utility, or business rule. |
| Dependency docs | Verify changed dependency usage with Context7 MCP when available, then GitHub README/changelog/issues when useful. |
| Dependency docs | Require a precise technical reason before accepting deviations from documented examples or best practices. |
| Maintainability and style | Load ../../implement-pm/references/development-rules.md, then check focus, naming, typing, dead code, hidden behavior, scope creep, and added/deleted line balance. |
| Security | Check authn/authz, input validation, secrets, privacy, unsafe redirects, uploads, dynamic queries, user-generated content, and server-side enforcement. |
| Edge cases | Check PM scope boundaries, empty states, error states, invalid input, unavailable dependencies, migration/rollback paths, and likely regressions. |
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 <pr-number-or-url>" >&2
}
if [ "$#" -ne 1 ]; then
usage
exit 64
fi
pr="$1"
if [ -z "$pr" ]; then
usage
exit 64
fi
if ! command -v gh >/dev/null 2>&1; then
echo "Missing gh CLI" >&2
exit 69
fi
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Not inside a git worktree" >&2
exit 69
fi
repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root"
if ! git remote get-url origin >/dev/null 2>&1; then
echo "Missing origin remote in $repo_root" >&2
exit 69
fi
pr_fields="$(gh pr view "$pr" --json baseRefName,headRefName,state --jq '[.baseRefName, .headRefName, .state] | @tsv')"
IFS=$'\t' read -r base_ref head_ref pr_state <<<"$pr_fields"
if [ -z "$base_ref" ] || [ -z "$head_ref" ] || [ -z "$pr_state" ]; then
echo "Could not resolve PR base/head/state for: $pr" >&2
exit 69
fi
if [ "$pr_state" != "MERGED" ]; then
echo "PR is not merged: $pr (state: $pr_state)" >&2
exit 69
fi
if ! git check-ref-format --branch "$base_ref" >/dev/null 2>&1; then
echo "Invalid PR base branch name: $base_ref" >&2
exit 69
fi
if ! git check-ref-format --branch "$head_ref" >/dev/null 2>&1; then
echo "Invalid PR head branch name: $head_ref" >&2
exit 69
fi
if [ -n "$(git status --porcelain)" ]; then
echo "Working tree is not clean in $repo_root" >&2
git status --short >&2
exit 69
fi
git fetch origin "refs/heads/${base_ref}:refs/remotes/origin/${base_ref}"
if git show-ref --verify --quiet "refs/heads/$base_ref"; then
git switch -- "$base_ref"
else
git switch --track -c "$base_ref" "origin/$base_ref"
fi
git pull --ff-only origin "$base_ref"
if [ "$head_ref" = "$base_ref" ]; then
echo "Skipping local branch deletion because head and base are both: $head_ref"
elif git show-ref --verify --quiet "refs/heads/$head_ref"; then
git branch -d -- "$head_ref"
else
echo "Local PR branch not found, nothing to delete: $head_ref"
fi
printf 'Repository: %s\n' "$repo_root"
printf 'Base branch: %s\n' "$base_ref"
printf 'PR branch: %s\n' "$head_ref"