|
| 1 | +--- |
| 2 | +name: pr-review-auditor |
| 3 | +description: Review the currently checked-out PR by discovering its upstream base branch with GitHub CLI, diffing base..HEAD, and performing a correctness-first code review that enforces repository policy with special priority on *GUIDELINES*.md rules and then AGENTS.md. Use when asked to do a full PR review, /review-style audit, commit-range quality check, or policy-compliance review of branch changes. |
| 4 | +--- |
| 5 | + |
| 6 | +# PR Review Auditor |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +Review branch changes from PR base to `HEAD` with findings-first output. |
| 11 | +Prioritize correctness risks, then CI regressions, then test gaps, and enforce |
| 12 | +policy precedence: `*GUIDELINES*.md` before `AGENTS.md`. |
| 13 | + |
| 14 | +## Workflow |
| 15 | + |
| 16 | +1. Collect context from the active branch. Run |
| 17 | + `.agents/skills/pr-review-auditor/scripts/collect_pr_context.sh` from repo |
| 18 | + root to detect: |
| 19 | + |
| 20 | +- checked-out branch, |
| 21 | +- PR number and base branch (via `gh pr view`), |
| 22 | +- merge-base commit, |
| 23 | +- review range (`<base_remote>/<base>..HEAD`), |
| 24 | +- changed files, |
| 25 | +- available policy files (`*GUIDELINES*.md`, `AGENTS.md`). |
| 26 | + |
| 27 | +2. Inspect commits and patches in range. Run |
| 28 | + `.agents/skills/pr-review-auditor/scripts/review_range.sh` with the range |
| 29 | + from step 1. This prints: |
| 30 | + |
| 31 | +- commits with full messages (`git log --format=fuller`), |
| 32 | +- per-commit changed files, |
| 33 | +- unified patches for detailed behavior review. |
| 34 | + |
| 35 | +3. Run a three-pass policy protocol (Markdown-only). Pass 1: Rule extraction |
| 36 | + |
| 37 | +- Read all `*GUIDELINES*.md` files first, then `AGENTS.md`. |
| 38 | +- Extract rules section-by-section by heading. For each heading, list actionable |
| 39 | + rules before moving to the next heading. |
| 40 | +- Extract every actionable rule into a numbered list with source citation. |
| 41 | +- Keep wording close to source text and avoid merging unrelated rules. |
| 42 | +- Minimum extraction floors: |
| 43 | + - `TESTING_GUIDELINES.md`: at least 20 rules unless a heading-by-heading audit |
| 44 | + proves fewer. |
| 45 | + - `AGENTS.md`: at least 15 rules unless a heading-by-heading audit proves |
| 46 | + fewer. |
| 47 | + - If below floor, include an explicit justification section that names each |
| 48 | + heading and why no additional actionable rule exists. Pass 2: Evidence |
| 49 | + mapping |
| 50 | +- For each extracted rule, assign `pass`, `fail`, or `n/a`. |
| 51 | +- Provide concrete evidence (`file:line`, command output, or explicit absence). |
| 52 | +- If rules conflict, cite both and follow `*GUIDELINES*.md`. Pass 3: Adversarial |
| 53 | + gap check |
| 54 | +- Re-read diffs and policy files only to find missed rules/findings. |
| 55 | +- Add new findings only when they include new source citations and evidence. |
| 56 | +- Require at least 5 "candidate missed rules" per policy file during this pass, |
| 57 | + then mark each as `new rule` or `duplicate` with rationale. |
| 58 | + |
| 59 | +4. Perform review in severity order. |
| 60 | + |
| 61 | +- Correctness/behavioral regressions. |
| 62 | +- CI and workflow regressions. |
| 63 | +- Test gaps or weak assertions. |
| 64 | +- Secondary maintainability/style concerns. |
| 65 | + |
| 66 | +5. Produce findings-first output. List issues with file/line references and |
| 67 | + policy citation when applicable. Separate policy findings into two explicit |
| 68 | + sections: |
| 69 | + |
| 70 | +- `GUIDELINES findings` |
| 71 | +- `AGENTS findings` |
| 72 | + |
| 73 | +6. Provide a remediation plan. Include: |
| 74 | + |
| 75 | +- ordered fix plan, |
| 76 | +- tests to run and why, |
| 77 | +- tests not run and why, |
| 78 | +- assumptions and open questions. |
| 79 | + |
| 80 | +## Output Requirements |
| 81 | + |
| 82 | +- Findings first, ordered by severity. |
| 83 | +- Include commit-message quality notes when relevant. |
| 84 | +- Cite exact paths and lines for each finding. |
| 85 | +- Include `files reviewed`, `tests run`, and `tests not run`. |
| 86 | +- If no findings exist, state that explicitly and list residual risks. |
| 87 | +- Include a `Rule Coverage Matrix` section in Markdown. |
| 88 | +- Do not mark the review complete until every extracted rule has a status and |
| 89 | + evidence. |
| 90 | +- Do not emit internal script-path fallback chatter; run the canonical |
| 91 | + `.agents/skills/pr-review-auditor/scripts/*` paths directly. |
| 92 | +- Include a `Rule Extraction Summary` with: |
| 93 | + - total rules per source file, |
| 94 | + - per-heading rule counts, |
| 95 | + - whether extraction floors were met, |
| 96 | + - explicit justification if any floor was not met. |
| 97 | + |
| 98 | +## Rule Coverage Matrix Template |
| 99 | + |
| 100 | +Use this exact table shape: |
| 101 | + |
| 102 | +| Rule ID | Source | Rule Summary | Status (pass/fail/n-a) | Evidence | |
| 103 | +| ------- | --------------------- | ------------ | ---------------------- | ------------------ | |
| 104 | +| G-001 | TESTING_GUIDELINES.md | ... | pass | tests/test_x.py:42 | |
| 105 | +| A-001 | AGENTS.md | ... | fail | src/module.py:87 | |
| 106 | + |
| 107 | +## Trigger Examples |
| 108 | + |
| 109 | +- "Figure out this PR's base branch and do a /review from base to HEAD." |
| 110 | +- "Audit all commits in this branch and check AGENTS + GUIDELINES compliance." |
| 111 | +- "Review patches in this PR and give me a fix plan with test gaps." |
| 112 | + |
| 113 | +## Resources |
| 114 | + |
| 115 | +- `.agents/skills/pr-review-auditor/scripts/collect_pr_context.sh`: derive PR |
| 116 | + base/range and policy file inventory. |
| 117 | +- `.agents/skills/pr-review-auditor/scripts/review_range.sh`: print full commit |
| 118 | + messages and patches for a range. |
| 119 | +- `references/review-checklist.md`: compact review checklist and severity |
| 120 | + rubric. |
0 commit comments