From PR Review Toolkit
Before reviewing code quality, compare stated intent (PR body, commit messages, TODOs, plan files) against the actual diff. Classify every plan item as DONE / PARTIAL / NOT DONE / CHANGED and flag out-of-scope changes. Use at the start of any PR review or before claiming a task complete.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pr-review-toolkit:scope-driftThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
An intent-versus-diff audit that runs **before** code-quality review. Answers one question: did this change do what it said it would do, and only that?
An intent-versus-diff audit that runs before code-quality review. Answers one question: did this change do what it said it would do, and only that?
Scope drift is the primary failure mode for multi-agent workflows. Agents routinely "while I was in there" into adjacent files, silently defer stated requirements, or reshape the plan without surfacing the change. This skill makes that observable.
Skip only when the change is a trivial single-line fix with no plan file or PR body.
Collect every available statement of intent. Use whichever sources exist:
gh pr view --json body,title for title and descriptiongh issue view {num} for any issue the PR closesgit log origin/main..HEAD --pretty=format:"%s%n%b"plans/**/plan.md, TODOS.md, TODO.md, ROADMAP.md, or similar referenced in the PR or living in the repo rootIf none exist, state that explicitly and proceed with a one-line reconstructed intent based on the first commit message.
From the combined intent sources, extract up to 50 actionable items. An actionable item is one the PR either must do or must not do.
Look for:
- [ ] or - [x])Normalize each to a single short line, for example:
Add scope-drift skill to pr-review-toolkitUpdate module.json with new file entriesDo NOT touch other modulesKeep edits minimalIf the combined intent produces more than 50 items, note the count and work with the top 50 by apparent priority (explicit scope > deliverables > nice-to-haves).
For each actionable item, classify against the actual diff. Use git diff origin/main...HEAD --stat and git diff origin/main...HEAD on relevant files.
| Status | Meaning |
|---|---|
| DONE | Item is fully implemented in the diff, with evidence (file, approximate line) |
| PARTIAL | Item is started but not complete. Name what is missing. |
| NOT DONE | Item is absent from the diff entirely |
| CHANGED | Item's implementation diverged from its description. Name what changed. |
Record evidence as path/to/file.ext:line pointers so the next reviewer can verify without re-running the diff.
Walk the diff in the opposite direction: every changed file that does NOT map to an actionable item is a scope drift candidate.
For each candidate, decide:
Do NOT remove drift changes automatically. The author may have a reason. Surface them for a decision.
Rate every PARTIAL, NOT DONE, CHANGED, and DRIFT finding as HIGH / MEDIUM / LOW impact.
Produce one section at the top of the review report:
## Scope Drift Audit
**Intent sources**: {PR body | issue #N | commit messages | plans/foo/plan.md}
**Items extracted**: {count}
### Plan Completion
- [DONE] {item} - {evidence: path:line}
- [PARTIAL] {item} - {what is missing} - {path:line}
- [NOT DONE] {item} - {impact: HIGH/MED/LOW}
- [CHANGED] {item} - {what diverged} - {path:line}
### Out-of-Scope Changes
- [DRIFT, HIGH] {file} - {one-line description of change} - {why it appears unrelated}
- [DRIFT, LOW] {file} - {one-line description} - {likely benign reason}
### Verdict
- In scope: {count} items DONE + {count} justified supporting changes
- Gaps: {count} PARTIAL + {count} NOT DONE
- Drift: {count} HIGH + {count} LOW
Gate the review only on HIGH-impact findings. For each HIGH gap or drift, issue a single AskUserQuestion (batched) before continuing to code-quality review. Present options:
LOW and MEDIUM findings are informational. Record them in the report and proceed.
For every HIGH-impact gap or drift, emit a one-line learning entry that a future reviewer can use:
plan-delivery-gap: {repo}#{pr} - {item or drift} - {cause hypothesis}
Example causes: "agent lost track after rebase", "scope unclear from PR body", "added dependency without explicit approval".
These feed the self-improving loop. The CCGM self-improving module's MEMORY files are the current store.
Scope-drift runs before the existing specialist agents (code-reviewer, silent-failure-hunter, etc.) from the external pr-review-toolkit plugin. Its output is a prerequisite, not a replacement.
Flow:
rules/fix-first-review.md).Ported from the Scope Drift + Plan Completion Audit section of garrytan/gstack's review/SKILL.md. Adapted to CCGM voice and the external pr-review-toolkit plugin's agent-based review flow.
npx claudepluginhub lucasmccomb/ccgm --plugin pr-review-toolkitCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.