Multi-stage implementation review with parallel sub-agents, severity-based autonomous fixes,
and gated test verification. Runs code quality, architecture, simplicity, documentation,
and security reviews in sequence with test gates between each fix stage. Security review
is blocked until all other fixes are complete.
Use after completing a feature, implementation phase, or release candidate.
Supports scope modes: full, code-only, security, simplicity, docs.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Multi-stage implementation review with parallel sub-agents, severity-based autonomous fixes,
and gated test verification. Runs code quality, architecture, simplicity, documentation,
and security reviews in sequence with test gates between each fix stage. Security review
is blocked until all other fixes are complete.
Use after completing a feature, implementation phase, or release candidate.
Supports scope modes: full, code-only, security, simplicity, docs.
Tests gate every fix stage. Tests run at Stage 0, then re-run after Stages 3, 5, 7, 10, and 11. No stage proceeds if tests fail.
Security is always last. Stage 8 is blocked until Stages 3, 5, and 7 complete with passing tests.
Parallel within stages, sequential between stages. Stage 1 dispatches its two sub-agents in parallel; Stage 8 dispatches its three sub-agents in parallel. Stage 8 itself is strictly blocked until Stages 3, 5, and 7 complete with passing tests.
Autonomous fixes with escalation. Fix stages apply Critical, High, and Medium findings. Escalate to user only if a fix would change design intent or core functionality.
Language agnostic. Baseline detection probes for test runners across ecosystems.
No git operations. No branches, commits, or PRs. The calling agent or user handles git workflow.
Centralized review log. All findings written to a single file for traceability.
Step 1: Scope Mode Selection
Parse the user's request to determine scope mode. If ambiguous, ask.
Mode
Stages Run
Use Case
full
0, 1-11
Complete pre-release validation
code-only
0, 1-3, 11
Code quality pass — security explicitly out of scope
security
0, 8-10, 11
Security-focused review only
simplicity
0, 4-5, 11
YAGNI / over-engineering check
docs
0, 6-7, 11
Documentation completeness review
Default:full
Store the selected mode — it determines which stages run and what the completion checklist validates.
If mode is code-only, inform the user: "Note: code-only mode does not include security review. Run with security or full mode for security coverage."
Step 2: Review Log Setup
Create a review log file in .claude/memory/reviews/. This directory is gitignored (under .claude/memory/) so review logs are never committed to the repo.
Create the directory if it doesn't exist: mkdir -p .claude/memory/reviews
Filename:phased-review-YYYY-MM-DD.md (use current date)
If a log with today's date already exists, append a counter: phased-review-YYYY-MM-DD-2.md
Write the log header:
# Phased Review Log-**Date:** [YYYY-MM-DD]
-**Mode:** [selected mode]
-**Stages:** [list of stage numbers for this mode]
-**Project:** [project name / working directory]
Step 3: Execute Stages
Run only the stages included in the selected mode, in order. Each stage writes results to the review log.
Stage 0 — Baseline Verification
Always runs in every mode.
Follow the detection and execution probes in references/baseline-detection.md to:
Detect and run the test command. Record total, passing, failing, skipped, and exit code.
Detect and run linting/typechecking (if available). Record pass/fail per tool. Skip tools that aren't present.
Detect and run coverage measurement (if available). Record percentage. If no coverage tool found, note "not measured."
Check CLAUDE.md or project config for custom test/lint commands — prefer those if specified.
Write to review log:
## Stage 0 — Baseline- Tests: [X] passing, [Y] failing, [Z] skipped (exit code [N])
- Lint: [tool]: [PASS/FAIL] (or SKIPPED if not available)
- Typecheck: [tool]: [PASS/FAIL] (or SKIPPED if not available)
- Coverage: [X%] (tool: [name]) or "not measured"
- Test command: `[detected command]`- Status: **[PASS/FAIL]**
GATE: If tests fail (exit code != 0), STOP. Report failures and tell the user they must fix baseline failures before review can begin. Do not proceed to any further stage.
Stage 1 — Parallel Code + Architecture Review
Modes:full, code-only
Launch two sub-agents in parallel using the Task tool. Use the prompts from references/sub-agent-prompts.md.
Re-run tests to ensure no accidental code modifications
If tests fail, something was accidentally changed — investigate and fix
Write to review log:
## Stage 7 — Documentation Fixes-**Updated:** [list of files modified]
-**Created:** [list of new files, if any]
- Tests after fix: [X] passing, [Y] failing
- Status: **[PASS/FAIL]**
GATE: Tests must pass before proceeding.
Stage 8 — Parallel Security Review (3 Personas)
Modes:full, security
BLOCKING CONDITION: In full mode, this stage MUST NOT begin until Stages 3, 5, and 7 are ALL complete with passing tests. Verify all three gates passed before proceeding. In security mode (which skips 1-7), proceed directly after Stage 0 passes.
Launch three sub-agents in parallel using the Task tool. Use the prompts from references/sub-agent-prompts.md.
Thinks like an attacker. Finds exploitation paths, proves attack vectors with concrete PoC inputs, identifies the highest-impact vulnerabilities. IDs: OT1, OT2, etc.
Sub-Agent F — Defensive Security (Technical/Code):
You MUST display the full Stage 11 summary directly in the conversation. Do not just write to the review log — the user needs to see the results without opening the file. Present:
The complete findings summary table (all stages, all severities, fix/escalate/defer counts)
Test results comparison (baseline → final)
Coverage delta (if measured)
Completion validation status (all stages checked off or missing stages listed)
Final PASS/FAIL status with specific unmet criteria if FAIL
The review log file path for full details: .claude/memory/reviews/phased-review-[date].md
If the review PASSED, confirm clearly. If it FAILED, list every unmet criterion and what the user needs to address.