skills/mp-prd-review/SKILL.md
Comprehensive PRD-end review: code quality, architecture, cleanup, documentation, unresolved items. Use when: "review PRD", "phase end", "PRD review", "wrap up PRD"
npx skillsauth add MartinoPolo/mpx-claude-code mp-prd-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive end-of-phase review for a completed PRD. Runs 10 parallel analysis agents, synthesizes findings into a prioritized action list, and optionally executes fixes.
Use compressed output throughout: drop articles, filler, pleasantries. Fragments OK. Use abbreviations and arrows (X → Y). Pattern: [thing] [action] [reason]. [next step].
Exception: PHASE_END document and user-facing summaries use normal professional prose.
/mp-prd-review #42
/mp-prd-review https://github.com/owner/repo/issues/42
gh issue view <number> --json number,title,body,comments,labels,state
Fetch all sub-issues:
gh issue list --search "parent:<number>" --state all --json number,title,body,comments,labels,state,closedAt --limit 100
Warn if any sub-issues are still open. Proceed anyway — the user triggered this manually for a reason.
For each closed sub-issue, find its merged PR:
gh pr list --search "closes #<sub_issue_number>" --state merged --json number,title,body,comments,url --limit 5
Collect all PR bodies and comments.
Find the merge-base before the first PRD-related commit and diff against current HEAD:
git fetch origin main
git log --oneline --all --grep="refs #<first_sub_issue>" --grep="fixes #<first_sub_issue>" --grep="closes #<first_sub_issue>" --format="%H" | tail -1
Use the parent of the earliest PRD commit as the base:
git diff <base>..HEAD --stat
git diff <base>..HEAD
If the diff exceeds context limits, fall back to --stat only and let agents read files directly.
The orchestrator (Opus) builds tailored context for each agent:
| Agent | Diff | Changed Files | PR/Issue Comments | | --------------------- | ---- | ------------- | ----------------------------------- | | spec-alignment | Full | Yes | Full — needs decision context | | code-quality | Full | Yes | Brief digest | | best-practices | Full | Yes | Brief digest | | security | Full | Yes | — | | performance | Full | Yes | — | | error-handling | Full | Yes | — | | architecture scanner | — | Yes | Architectural decisions only | | dead code scanner | Full | Yes | — | | documentation scanner | — | Yes | Full — needs to know what was built | | unresolved scanner | — | Yes | Full — primary data source |
Build a brief digest of PR/issue comments for agents that receive it: summarize key decisions, concerns raised, and deferred items in ~500 words.
Spawn all 10 agents in parallel. Each agent receives its tailored context slice from Step 1d.
Spawn each as a sub-agent with model: "sonnet":
mp-reviewer-code-quality — DRY, dead code, SoC, naming, complexitymp-reviewer-best-practices — language/framework conventions, type designmp-reviewer-spec-alignment — requirements coverage, scope creep, test qualitymp-reviewer-security — injection, XSS, auth gaps (HIGH confidence only)mp-reviewer-performance — N+1, re-renders, hot paths, memory leaksmp-reviewer-error-handling — propagation, retry/timeout, race conditionsPrompt each with:
Review the following PRD-scope changes (aggregate of multiple PRs implementing PRD #N: "[title]"). This is a PRD-end review — look for cross-PR patterns, not just individual PR issues.
[context slice per agent table above]
Spawn mp-scanner-architecture sub-agent with model: "sonnet":
Scan these files changed during PRD #N: "[title]". Focus on structural concerns introduced or worsened across the full PRD scope.
Changed files: [list with stats] Architectural decisions from discussions: [filtered comments]
The agent reads its own reference files (deep-modules.md, interface-design.md, REFERENCE.md).
Spawn Explore sub-agent with model: "sonnet":
Scan files changed during PRD #N for cleanup opportunities introduced across multiple PRs:
- Unused exports, types, or functions added in one PR but never consumed
- Stale imports left after refactoring across PRs
- Duplicated logic across files that should be a shared utility
- Redundant code where one PR's implementation superseded another's
- Orphaned test helpers or fixtures no longer referenced
Changed files: [list with stats] Diff: [full diff]
Verify each finding: grep for usages before flagging as unused. Only report HIGH confidence.
Output format per finding:
[Critical|Important|Minor] title — file:lineWhat & Why+Suggested fix
Spawn Explore sub-agent with model: "sonnet":
Check if project documentation is stale relative to changes made in PRD #N: "[title]".
For each file below, check ONLY if it exists. Skip any that don't exist — do not suggest creating them.
.mpx/CONTEXT.md— are there new domain terms not in § Domain Language? Are features in § Core Features still marked as pending when implemented?.mpx/DECISIONS.md— do structural changes warrant new decision entries?README.md— are setup steps, features, or usage instructions outdated?Changed files: [list with stats] PR/issue context: [full comments — to understand what was built]
Output format per finding:
[Important|Minor] title — fileWhat needs updating+Specific content to add/change
Spawn a sub-agent with model: "sonnet":
Scan all PR bodies and comments + issue bodies and comments from PRD #N for deferred, unfinished, or incomplete work.
Look for: "deferred", "TODO", "left for later", "unresolved", "out of scope", "follow-up", "nice to have", "future work", "skipped", "punted", "not implemented yet", "known issue", "hack", "workaround", "temporary".
For each candidate found:
- Read the relevant source files to check if it was actually implemented in a later PR within the PRD
- Search open GitHub issues to check if it's already tracked:
gh issue list --state open --search "<keywords>" --json number,title --limit 5- Classify:
- Complete — verified implemented in code → skip (don't report)
- Tracked — open issue exists → report with issue link, no action needed
- Needs AFK issue — clear scope, ready to implement → report with suggested issue title
- Needs HITL issue — uncertain scope, needs human decision → report with open questions
PR bodies and comments: [full content] Issue bodies and comments: [full content] Changed files: [list for code verification]
Output format per finding:
[Critical|Important|Minor] titleSource: PR #N comment by @userorIssue #N bodyStatus: Complete|Tracked (#N)|Needs AFK issue|Needs HITL issueDetails+ [for HITL:Open questions]
Collect all 10 agents' findings. Merge into a unified action list:
Multiple agents may flag the same issue (e.g., code-quality and dead-code scanner both finding unused code). Merge duplicates, keeping the most specific description.
Severity: Critical → Important → Minor
Categories:
Write to .mpx/reviews/PHASE_END_PRD_<N>.md:
# PRD Review: PRD #<N> — [Title]
Generated: [date] | Sub-issues: #1, #2, #3 | PRs: #4, #5, #6
## Summary
[2-3 sentences on overall PRD health, total findings count by severity]
## Critical
### [Category] — [Title]
- [ ] **File:** path/to/file.ts:42
- **Finding:** [what's wrong]
- **Action:** [what to do]
## Important
### [Category] — [Title]
- [ ] **File:** path/to/file.ts:99
- **Finding:** [what's wrong]
- **Action:** [what to do]
## Minor
### [Category] — [Title]
- [ ] **File:** path/to/file.ts:10
- **Finding:** [what's wrong]
- **Action:** [what to do]
## Unresolved Items
### Needs AFK Issue
- [ ] [Title] — [details, suggested issue title]
### Needs HITL Issue
- [ ] [Title] — [details, open questions]
### Already Tracked
- #N — [title] (no action needed)
## Documentation Updates
- [ ] [file] — [specific update needed]
## Architecture Promotion Candidates
- [Title] — [brief description, recommended for `/mp-architecture-review`]
Each item's checkbox (- [ ]) is the execution tracking mechanism.
Present the synthesized action list to the user:
PRD #N review complete. Found X critical, Y important, Z minor items across 6 categories.
[Show the PHASE_END document content]
Review the findings. You can:
- Confirm all items → proceed to execution
- Drop specific items → "drop items 3, 7"
- Edit items → "change item 5 to [X]"
- Defer everything → document is saved at
.mpx/reviews/PHASE_END_PRD_N.md
Wait for user response before proceeding.
Count actionable items (excluding "Already Tracked" and dropped items).
Execute using Sonnet sub-agents. The Opus orchestrator:
mp-executor sub-agents (Sonnet) with pre-analyzed fix instructions for each parallel group- [x])gh issue create --title "[title]" --label "task,AFK" --body "[body]"
or for HITL items:
gh issue create --title "[title]" --label "task,HITL" --body "[body with open questions]"
Link new issues as sub-issues of the PRD using GraphQL addSubIssue.
bash $HOME/.claude/scripts/detect-check-scripts.sh
Run all detected CHECK and TEST commands via mp-checker.
Document is saved. User can return in a new session, read .mpx/reviews/PHASE_END_PRD_N.md, and execute items manually or via /mp-execute for individual issues created from unresolved items.
After all items are resolved (or explicitly deferred):
gh issue list --search "parent:<prd_number>" --state open --json number,title --limit 100
All items resolved. Close PRD #N: "[title]"?
Wait for user confirmation before closing:
gh issue close <prd_number> --reason completed
development
Audit all active skills for consistency, convention drift, and common issues. Auto-fixes where possible, reports remaining issues. Use when: "audit skills", "skill audit", "check skills", "lint skills"
testing
Ship finished work: sync base, commit, push, PR, wait for CI green, merge. Use when: "ship it", "ship and merge", "ship this"
development
Scan recent Claude Code sessions for grilling/design discussions, extract decisions, and update CONTEXT.md + DECISIONS.md. Use when: "harvest decisions", "extract decisions from sessions", "update docs from sessions", "sync decisions"
tools
Consolidate CONTEXT.md: remove duplicates, outdated items, tighten language. Use when: "consolidate context", "clean up context", "simplify context", "consolidate requirements"