| name | workflow-review-changes |
| version | 4.1.0 |
| description | [Workflow] Use when activating the Review Current Changes workflow for review, fix, and re-review recursively until all issues resolved. |
[BLOCKING] Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval.
[BLOCKING] Before each step or sub-skill call, update task tracking: set in_progress when step starts, set completed when step ends.
[BLOCKING] Every completed/skipped step MUST include brief evidence or explicit skip reason.
[BLOCKING] If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.
Quick Summary
Goal: Ensure changed work reaches clean review through validated findings, verified fixes, full re-review, and synchronized docs/tests — review all uncommitted changes, validate findings, fix only validated findings, then re-run /changes-review INLINE (only when /plan-execute actually changed files), repeating the plan→plan-execute→changes-review loop until a complete pass is clean.
Summary:
- Step 0 (FIRST ACTION, pre-sequence): bind the self-recursive review loop — an always-on protocol loop you self-drive (the BINDING mechanism, hook/command-independent) PLUS, when available, a
/goal Stop-hook gate as an optional accelerator — so the review→self-fix→whole-diff-re-review loop is unabandonable until it converges to a clean zero-finding pass — why: a soft "loop until clean" directive gets rationalized away after one fix cycle, and the protocol loop holds even where /goal is absent. Session-level wrapper, NOT one of the 18 canonical steps. ALWAYS runs — including as a step inside a parent workflow — because this workflow always runs INLINE in the main session (never a sub-agent), so it owns the loop directly in every case.
- Step 1
/changes-review runs FIRST and owns the baseline (surface analysis, integration-test/translation-sync gaps, UI review via internal /ui-review); step 2 /why-review validates those findings to drop false positives BEFORE the parallel batch fires — so steps 3–9 act only on warranted findings.
- Steps 3–9 (
/architecture-review, /domain-entities-review [if entity files], /performance-review, /integration-test-review, /security-review, /production-readiness-review, /ui-review [if frontend files]) are read-only sub-agents: spawn ALL in ONE message and advance ONLY after every member returns (all-return barrier); the mutating /code-simplifier (step 10) waits until the barrier clears and self-reviews its own changes via /code-review. (/ui-review runs here as a DEDICATED conditional batch member AND still runs internally inside step 1's /changes-review — both by design; see the UI-review note below.)
- Fix cycle (steps 11–14
/plan→/plan-review→/plan-execute→/changes-review) runs ONLY when validated findings exist; the step-14 re-review runs ONLY if /plan-execute changed files, re-reading the full diff from scratch INLINE to counter orchestrator confirmation bias, and loops until a clean zero-finding pass, bounded at 5 rounds MAX (escalate via AskUserQuestion at whichever trips first: 3 no-progress repeats of the same blocker, or round 5 completing with findings still open — cap exhaustion escalates, never PASSes).
- Step 15
/why-review (ALWAYS runs, FULL mode, standalone) — near-final HOLISTIC review of the WHOLE target + current changes (complete changeset plus the surrounding code/spec/docs it touches) as ONE artifact through /why-review's full adversarial rationale gate. A DIFFERENT lens from step-2 --validate-findings (only sanity-checks the /changes-review findings) and from the per-file/per-dimension reviewers (steps 1, 3–9): catches design-rationale, hidden-coupling, easy-to-change, and whole-package gaps the granular passes miss — why: a standalone /why-review of the target catches what the per-file/per-dimension batch structurally cannot. On findings → re-enter /plan→/plan-execute→/changes-review, then re-run step 15, looping run→fix→run until a full-mode pass finds zero new findings (bounded by /why-review's own review loop: max 2 re-dos / 3-repeat-blocker → escalate).
/docs-update (step 16) ALWAYS runs and triages internally; SPEC-STALE drift verdicts from step 1 flow here to update the Feature Spec first — the workflow is NOT clean while any behavior-vs-spec divergence stays unadjudicated (green tests do not normalize drift).
Sequence: (Step 0 pre-sequence: bind self-recursive review loop — protocol loop always, /goal accelerator when available — top-level only) → /changes-review (owns UI review — invokes /ui-review internally when frontend changes) → /why-review (validate findings) → [parallel batch] /architecture-review + /domain-entities-review (if entity changes) + /performance-review + /integration-test-review + /security-review + /production-readiness-review + /ui-review (if frontend changes) → /code-simplifier (self-reviews its own changes via /code-review) → /plan → /plan-review → /plan-execute → /changes-review (conditional inline re-review — only if /plan-execute changed files; loops /plan→/plan-execute→/changes-review until clean) → /why-review (HOLISTIC full-mode standalone review of the WHOLE target + changes; loops run→fix→run until zero new findings) → /docs-update → /workflow-end → /watzup
Key Rules:
-
MUST ATTENTION define success criteria before execution and loop until observable verification passes.
-
MUST ATTENTION when creating/reviewing specs or tests, name Business Intent / Invariant Guarded or the protected business intent/invariant and ensure the test would fail if that intent breaks.
-
MUST ATTENTION carry every unresolved finding or unaccepted risk into validation/fix planning; do not close until fixed or explicitly accepted.
-
MUST ATTENTION include unresolved risk register, generated mirror drift, and spec/test/docs drift in the fresh review prompt when relevant.
-
MUST ATTENTION run /why-review at step 2 to validate the /changes-review findings BEFORE spawning the parallel reviewers — drop false positives early so the batch and fix cycle act only on warranted findings.
-
After /plan-execute applies validated fixes (and ONLY if /plan-execute changed files) → re-run /changes-review INLINE over the current full diff from the first phase; re-read the diff from scratch to counter orchestrator confirmation bias
-
Main-agent re-review (with knowledge of its own fixes) is NOT sufficient — orchestrator-level confirmation bias
-
PASS = one complete review pass finds zero blocking issues after all validated fixes and verification are included
-
Repeated blockers are tracked in conversation context; stop after 3 no-progress full invocations of the same blocker
First Principle — Easy to Change
The success metric of every coding decision is future change cost.
DRY, SRP, abstraction, design patterns, naming, layering, tests — every
technique exists to serve one goal: making the next change cheaper.
When evaluating code, a refactor, a test, or an abstraction, ask:
does this make the next change cheaper or more expensive?
- Reject "best practices" that raise change cost (premature abstraction,
speculative generality, leaky indirection, ceremony without payoff).
- Name the real enemies in findings: coupling, hidden state, duplicated
knowledge, unclear intent, irreversible decisions exposed too early.
- A simpler design that is easy to change beats a sophisticated design that
isn't.
Apply this lens before invoking any specific rule, pattern, or checklist
below — if a downstream rule would raise change cost, this principle wins.
Step 0 — Bind the Self-Recursive Review Loop (FIRST ACTION — pre-sequence; protocol-first, /goal optional)
MUST ATTENTION: Before creating the 18 step tasks below, the VERY FIRST action is to BIND the self-recursive review loop so the session cannot end until the whole workflow loop converges to a clean zero-finding pass. Binding has TWO layers: (1) an always-on protocol loop you self-drive — the BINDING mechanism, hook/command-independent, in force on every host; and (2) an optional /goal accelerator — a mechanical Stop-hook block installed only WHEN the command is available. This is a session-level enforcement WRAPPER — NOT one of the 18 canonical workflows.json sequence steps, so it does NOT change the step count or the sequence; it makes the existing loop unabandonable.
Entry gate:
- ALWAYS run — whether this workflow is the top-level invocation (user ran
/start-workflow workflow-review-changes or /changes-review routed here directly) OR a step inside a parent workflow (e.g. workflow-feature, workflow-bugfix, workflow-refactor). Because this workflow always runs INLINE in the main session (never as a sub-agent — see the WORKFLOW-IN-WORKFLOW note), it owns the session Stop hook directly in every case, so the loop binds and enforces identically. There is no "deferred to parent" case.
Procedure:
1. Protocol loop — ALWAYS binding (hook/command-independent). This is the mechanism that actually holds the loop shut; it binds Claude, Codex, and Copilot equally, whether or not /goal exists. You yourself MUST NOT stop until the condition below holds:
Run /changes-review + /why-review + the parallel reviewers + /code-simplifier → if validated findings exist, /plan → /plan-execute SELF-FIXES them → re-run /changes-review INLINE over the WHOLE current diff from the first phase (combined with the prior fixes, not just the last fix) → loop /plan→/plan-execute→/changes-review until one complete pass finds zero findings; only then /docs-update → /workflow-end. Stop only when a complete review pass is clean (or the same blocker repeats 3× with no progress → escalate via AskUserQuestion). Do not stop while any validated finding is unfixed.
2. /goal command — invoke as an accelerator WHEN AVAILABLE. If /goal is registered and permitted on this host, invoke it (the actual built-in command) with the same condition to add a mechanical Stop-hook block on top of the protocol loop:
/goal workflow-review-changes self-recursive loop: run /changes-review + /why-review + the parallel reviewers + /code-simplifier → if validated findings exist, /plan → /plan-execute SELF-FIXES them → re-run /changes-review INLINE over the WHOLE current diff from the first phase (combined with the prior fixes, not just the last fix) → loop /plan→/plan-execute→/changes-review until one complete pass finds zero findings; only then /docs-update → /workflow-end. Stop only when a complete review pass is clean (or the same blocker repeats 3× with no progress → escalate via AskUserQuestion). Do not stop while any validated finding is unfixed.
The /goal Stop hook then blocks stopping until the condition holds and auto-clears when met — do not tell the user to clear it.
If /goal is unavailable, unregistered, or not permitted — record ONE line and proceed under the protocol loop (step 1), which is already binding; NEVER error, block, or fake a gate on its absence:
/goal accelerator unavailable — review loop bound by protocol (Step 0 step 1)
- Then proceed to create the 18 step tasks below and run the sequence.
Why bind the loop on top of the loop prose: the conditional re-review (step 14) and the "loop until clean" rules are soft directives an orchestrator can rationalize away after one fix cycle (confirmation bias). The protocol loop (step 1) converts them into a self-enforced invariant on every host; the /goal Stop hook (step 2), when present, adds a mechanical block — but the guarantee never depends on it. The session cannot end with a validated finding unfixed or a non-clean review pass. — why: a fix cycle that stops before re-proving the whole diff ships unreviewed work, so the loop must hold even where /goal is absent.
Mandatory Task Creation (ZERO TOLERANCE)
Step 0 first: bind the Step 0 self-recursive review loop (above — protocol loop always, /goal accelerator when available) BEFORE creating these tasks — always, including when this workflow is a step inside a parent workflow, since it always runs inline in the main session and owns the loop directly.
Create one task per row in the table below — source of truth is workflows.json → changes-review.sequence (currently 18 steps; verify count matches if you suspect drift). The Step 0 loop binding is a pre-sequence wrapper and is NOT counted among these 18:
| # | Task Subject | Conditional? |
|---|
| 1 | [Workflow] /changes-review — Surface detection + dimensional review tasks (BE/FE/SCSS/Synthesis/General) + UI dimension via /ui-review (if frontend changes) + integration test sync check + multilingual translation sync check | No |
| 2 | [Workflow] /why-review — Validate the /changes-review findings before parallel reviewers run (each finding warranted, evidence-backed, not a false positive) | No — FINDINGS-VALIDATION gate over the /changes-review findings; the fix plan's design is reviewed by /plan-review (step 12); if step 1 found zero issues, pass through with nothing to validate |
| 3 | [Workflow] /architecture-review — Architecture compliance review ⚡ PARALLEL BATCH | No — run as sub-agent in parallel with steps 4/5/6/7/8/9 |
| 4 | [Workflow] /domain-entities-review — DDD quality review of changed domain entity files ⚡ PARALLEL BATCH | Yes — skip if no domain entity files (Domain/, Entities/, ValueObjects/) in git diff |
| 5 | [Workflow] /performance-review — Performance analysis ⚡ PARALLEL BATCH | No — run as sub-agent in parallel with steps 3/4/6/7/8/9 |
| 6 | [Workflow] /integration-test-review — 7-gate test quality review + Gate 7 change coverage (every behavior change → covering test + spec TC) ⚡ PARALLEL BATCH | No — run as sub-agent in parallel with steps 3/4/5/7/8/9 |
| 7 | [Workflow] /security-review — Security vulnerability review ⚡ PARALLEL BATCH | No — run as sub-agent in parallel with steps 3/4/5/6/8/9 |
| 8 | [Workflow] /production-readiness-review — SRE production-readiness review (12 criteria /24 + Extended SRE Readiness gate) in READ-ONLY findings/score mode ⚡ PARALLEL BATCH | No — run as sub-agent in parallel with steps 3/4/5/6/7/9; read-only in the batch (its standalone Validated Fix + Full Re-Review loop is deferred to the mutating steps) |
| 9 | [Workflow] /ui-review — UI/frontend quality review (long-content overflow, responsive multi-screen flex, flex-vs-fixed sizing, z-index discipline, SCSS/BEM, async loading/error/empty states) ⚡ PARALLEL BATCH | Yes — skip if no frontend files (project frontend path/extension patterns) in git diff; runs as ui-ux-designer sub-agent in parallel with steps 3/4/5/6/7/8. DEDICATED batch member AND still runs internally inside step 1's /changes-review — both by design (see UI-review note below) |
| 10 | [Workflow] /code-simplifier — Simplify and refine code (self-reviews its own changes via /code-review before returning) | No — runs AFTER parallel batch (modifies code; batch reviews pre-simplification state; simplifier owns review of its own output) |
| 11 | [Workflow] /plan — Consolidate validated review findings into fix plan | Conditional — run ONLY if reviews surfaced validated findings to fix; skip if all reviews PASS |
| 12 | [Workflow] /plan-review — Architecture/design review of fix plan (includes adversarial design-rationale pass + internal /why-review --validate-findings of its own findings) | Conditional — run ONLY if there is a fix plan (i.e. findings exist); skip if all reviews PASS |
| 13 | [Workflow] /plan-execute — Implement fixes from plan | Conditional — run ONLY if there are validated findings to fix; skip if all reviews PASS |
| 14 | [Workflow] /changes-review — Conditional inline re-review after /plan-execute (re-runs the review over the current diff); loop /plan→/plan-execute→/changes-review until clean | Skip if all reviews PASS, OR if /plan-execute applied no file changes |
| 15 | [Workflow] /why-review — HOLISTIC full-mode standalone review of the WHOLE review target + current changes as one artifact; loop run→fix→run until a complete full-mode pass finds zero new findings | Always run — FULL mode (NOT --validate-findings); distinct lens from step 2 + the dimensional reviewers; on findings re-enter /plan→/plan-execute→/changes-review then re-run step 15 (bounded by /why-review's own review loop: max 2 re-dos / 3-repeat-blocker → escalate) |
| 16 | [Workflow] /docs-update — Update impacted documentation | Always run — /docs-update triages internally (fast-exits when only config/tool files changed) |
| 17 | [Workflow] /workflow-end — End workflow state (prints the concise change recap, then clears state) | No |
| 18 | [Workflow] /watzup — Post-workflow summary and final /understand handoff | No |
UI review runs in TWO places by design (keep both). /ui-review runs BOTH (a) INTERNALLY inside step 1 (/changes-review invokes it as its UI dimension) AND (b) as a DEDICATED conditional parallel-batch member (step 9, ui-ux-designer sub-agent). Both are gated on the same trigger — frontend/UI files in the diff — so both are skipped when no frontend files changed. Create the step-9 [Workflow] /ui-review task (conditional) AND keep step 1's internal UI dimension; do NOT collapse them into one.
NEVER consolidate, rename, or omit steps. If reviews PASS, mark conditional tasks completed with note "Skipped — all reviews passed".
Integration Test Sync: The /changes-review skill (task #1) includes a mandatory integration test coverage check for changed command/query/handler files. When gaps are found, the skill uses AskUserQuestion to surface them — NOT purely advisory. The user must explicitly choose to run /integration-test or confirm tests are already written. No silent skip.
Translation Sync: The /changes-review skill (task #1) includes a mandatory multilingual UI translation-sync check. When UI text changes in multilingual projects without locale updates, the skill uses AskUserQuestion for an explicit user decision — NOT purely advisory.
Docs Update: /docs-update MUST run after EVERY review — it performs Phase 0 triage and fast-exits automatically when only non-business-code files changed (.claude/**, config). When business code is in the changeset, it WILL invoke: Phase 2 /spec (business feature doc update), Phase 2.5 /spec-index [mode=index] (derived bucket INDEX/ERD refresh — if docs/specs/ bucket maintains a derived index; note: dirs may be app buckets or flat system folders — probe ls docs/specs/{name}/ to find a specific service), Phase 2.6 /tech-spec when the derived technical view is affected, Phase 3 /spec [mode=tests] (test spec sync), Phase 4 /spec [mode=sync] (§8 TCs ↔ executing test code). Never skip based on review PASS status alone.
Spec Drift Adjudication: The /changes-review skill (task #1) runs a mandatory spec-drift adjudication (SYNC:spec-drift-adjudication, per shared/sdd-artifact-contract.md → Drift Gates) for every behavior-changing file: it classifies each divergence between changed behavior and the canonical Feature Spec as CODE-WRONG (BLOCKING — fix the code/test against intended behavior), SPEC-STALE (the change is the new intent — the spec documents the old behavior), or AMBIGUOUS (escalate). The reviewer never silently picks a side. A SPEC-STALE verdict flows downstream: /docs-update (step 16) updates the Feature Spec FIRST via /spec [update], then re-syncs /spec [mode=tests]. The workflow is NOT clean while any behavior-vs-spec divergence remains unadjudicated — green tests do not normalize drift (green can encode the drift itself).
Spec enrichment per cycle (MANDATORY — closes the feedback loop): Every confirmed finding fixed in the loop (steps 11–14) that changed observable behavior MUST produce a new or updated §8 regression/preservation TC via /spec [mode=tests] before the workflow is clean — a code-only fix with no covering §8 TC is an INCOMPLETE cycle, not a clean pass. This applies to EVERY confirmed behavior-changing fix, not only SPEC-STALE drift verdicts or bugfix-workflow paths: a CODE-WRONG fix owes a regression TC describing the now-correct behavior; a behavior change owes a preservation/regression TC guarding the new behavior. So each recursive cycle ENRICHES the spec rather than only mutating code — the inline re-review (step 14) and the /workflow-end spec ↔ TDD-test sync gate both treat a behavior-changing fix that left no §8 TC as an open finding.
Parallel Review Phase (Steps 3–9) — EXECUTION PROTOCOL
Note: Steps 3–9 are the specialist reviewers — architecture compliance, DDD entities,
performance, integration test quality, security vulnerabilities, production readiness, and
UI/frontend quality (/ui-review, conditional on frontend files). They run as workflow-level
parallel sub-agents, separate from the DIMENSIONAL review (BE/FE/SCSS/Synthesis + UI dimension)
that runs INSIDE Step 1 (/changes-review).
/ui-review runs in TWO places by design (keep both): (a) INTERNALLY inside Step 1 as
/changes-review's UI dimension, AND (b) here as the DEDICATED step-9 batch member
(ui-ux-designer sub-agent). Both fire only when the diff has files matching the project's
configured frontend/UI file patterns; both are skipped otherwise.
Steps 3–9 (/architecture-review, /domain-entities-review, /performance-review, /integration-test-review, /security-review, /production-readiness-review, /ui-review) are read-only and independent — no shared mutable state, no ordering dependency between them. Run them as parallel sub-agents to preserve main session context budget and reduce wall-clock time.
Why parallel?
Each reviewer reads the git diff independently and analyzes one concern. Sequential execution would burn 50K+ tokens in the main session absorbing all seven inline. The stepMeta in workflows.json marks all seven as executionMode: subagent, contextBudget: high — dispatch each as a sub-agent per the model-driven advancement rule (no hook emits a 💡 [SUB-AGENT RECOMMENDED] hint).
UI review runs in TWO places by design (keep both). /changes-review (step 1) invokes /ui-review (ui-ux-designer sub-agent) INTERNALLY as its own dimensional-batch UI dimension when frontend files changed, AND step 9 spawns /ui-review again as a DEDICATED conditional member of THIS parallel phase. Both fire only when frontend/UI files are in the diff; both are skipped otherwise. This intentional double-run gives the UI dimension both an in-context read (step 1) and a first-class, independently-reported specialist pass (step 9).
Execution: spawn in one message
After steps 1 and 2 (/changes-review and /why-review) complete, spawn all active parallel reviewers in a single response with multiple Agent tool calls:
Agent(architecture-review, subagent_type="architect", ...) ← all in ONE message
Agent(domain-entities-review, subagent_type="code-reviewer", ...) ← only if entity files in diff
Agent(performance-review, subagent_type="performance-optimizer", ...)
Agent(integration-test-review, subagent_type="integration-tester", ...)
Agent(security-review, subagent_type="security-auditor", ...)
Agent(production-readiness-review, subagent_type="code-reviewer", ...) ← read-only SRE findings/score mode
Agent(ui-review, subagent_type="ui-ux-designer", ...) ← only if frontend/UI files in diff
Each sub-agent receives:
- The baseline summary from step 1 (what changed, integration test gaps found)
- Instruction to write report to
plans/reports/{skill}-{date}-{slug}.md
- Full review protocols per
SYNC:review-protocol-injection (verbatim in prompt — never by file reference)
State advancement after parallel batch (model-driven — PRIMARY)
Advancement here is model-driven — your responsibility against the task list, NOT a hook/tool signal. This is the same rule the universal context files carry ("Workflow Step Advancement & Parallel Phases" in CLAUDE.md / AGENTS.md), so the batch advances identically under Claude and Codex. The shared kernel is the canonical SYNC:parallel-phase-advancement block consolidated at the end of this skill — its barrier rule governs this batch: declare the group up-front; spawn ALL members in ONE message; advance ONLY after EVERY member returns (a skipped conditional member counts as "returned"); a sub-agent return advances a step IDENTICALLY to an inline call; defer the mutating /code-simplifier step until the barrier clears; hooks are accelerators only.
Applied to this workflow's batch — after ALL parallel reviewers (steps 3–9) have returned:
TaskUpdate step 3 → completed
TaskUpdate step 4 → completed (or "Skipped — no entity files" if the conditional domain-entities-review member did not run — a skipped conditional counts as "returned")
TaskUpdate step 5 → completed
TaskUpdate step 6 → completed
TaskUpdate step 7 → completed
TaskUpdate step 8 (/production-readiness-review) → completed
TaskUpdate step 9 (/ui-review) → completed (or "Skipped — no frontend/UI files" if the conditional ui-review member did not run — a skipped conditional counts as "returned")
- Read all sub-agent report files; synthesize findings into a combined review summary
- Proceed to step 10 (
/code-simplifier) sequentially — only after the barrier above (it is a code-mutating step and must see the complete review snapshot)
Advancement here is model-driven. This sub-agent batch advances only after every member returns (the all-return barrier) — no step-tracking hook advances it. Claude and Codex both rely entirely on this rule.
Consolidation before /code-simplifier
Before running /code-simplifier, synthesize all parallel sub-agent findings:
- List all Critical/High/Medium/Low findings across all 7 reports (plus the UI-dimension findings folded into step 1's report when frontend files changed)
- Note any conflicts between reviewers (same file, different concerns)
- Pass this summary to
/code-simplifier as context so simplification is informed by review findings
Surface Analysis from Step 1:
Step 1 (/changes-review) now emits a surface analysis summary in its report:
## Change Surface Analysis
BE files: {N}
FE-Logic files: {M}
SCSS files: {P}
Review Mode: [DIMENSIONAL | BE-ONLY | FE-ONLY | FE-SPLIT | TOOLING]
Include this surface analysis in the consolidation summary passed to /code-simplifier.
This lets the simplifier focus attention on the dominant surface without re-analyzing the diff.
Dimensional agent reports (if mode = DIMENSIONAL):
plans/reports/review-be-{date}.md — BE findings
plans/reports/review-fe-logic-{date}.md — FE-Logic findings
plans/reports/review-scss-{date}.md — SCSS findings (if spawned)
plans/reports/synthesis-review-{date}.md — Cross-boundary findings
All four (plus the UI-dimension /ui-review findings when frontend files changed) feed into the consolidation summary alongside steps 3–9 specialist findings (which include the dedicated step-9 /ui-review pass).
What runs sequentially (never parallelize)
| Step | Why sequential |
|---|
changes-review (#1) | Establishes baseline — must run first |
why-review (#2) | Validates the changes-review findings before the batch — gates which findings the batch and fix cycle act on |
code-simplifier (#10) | Modifies code — batch reviews pre-simplification state; self-reviews its own output via /code-review before returning |
plan → plan-review → plan-execute (#11–13) | Ordered validated fix-plan cycle — /plan consumes already-validated review findings; /plan-review reviews the fix plan's design (adversarial rationale pass + internal /why-review --validate-findings of its own findings) before /plan-execute implements it |
why-review (#15) | Near-final HOLISTIC standalone review — runs in FULL mode over the WHOLE target + changes after the step-14 loop converges; its own findings re-enter the fix loop, so it must run after fixes settle, not before |
Conditional Inline Re-Review Protocol (CRITICAL)
Decision Logic
Reviews (steps 1-10) → ALL PASS (no findings)?
YES → skip steps 11-14 (/plan//plan-review//plan-execute//changes-review), proceed to /why-review HOLISTIC full-mode pass (step 15) → /docs-update (step 16) → /workflow-end → /watzup → DONE
NO (findings exist) → /plan → /plan-review → /plan-execute → (if /plan-execute changed files) /changes-review INLINE re-review (step 14) → loop until clean → /why-review HOLISTIC full-mode pass (step 15)
Step 15 (ALWAYS): /why-review FULL mode over the WHOLE target + changes. If it finds new findings → re-enter /plan→/plan-execute→/changes-review, then re-run step 15; loop run→fix→run until a complete full-mode why-review pass is clean → /docs-update (step 16).
Note: /code-simplifier (step 10) self-reviews the code it changes via /code-review before returning — there is no separate workflow-level code-review step.
Note: /why-review runs TWICE — step 2 in `--validate-findings` mode (sanity-checks the /changes-review findings before the parallel batch; the fix plan's design rationale is reviewed by /plan-review (step 12), which self-invokes /why-review --validate-findings on its own findings) AND step 15 in FULL mode (a holistic standalone review of the whole target + changes as one artifact). The two are different lenses — step 2 validates surfaced findings; step 15 hunts whole-package/design-rationale gaps the granular passes never surfaced.
Conditional Inline Re-Review Gate (Step 14) — After /plan-execute Applies Fixes
- CONDITION (run only if /plan-execute changed files): Step 14 runs ONLY when
/plan-execute actually modified files (validated fixes were applied). If /plan-execute made no file changes — nothing was wrong, or the plan resolved to no-ops — SKIP step 14 entirely and proceed to the step-15 holistic /why-review (which still ALWAYS runs), then /docs-update.
- DO re-run the
/changes-review protocol INLINE in the main session over the current full diff. Create a fresh task breakdown, rerun blast radius, risk detection, surface categorization, diff collection, dimensional reviews, synthesis, and validation gates. (Inline by design for this workflow — cheaper than spawning a fresh sub-agent; accept the mild orchestrator-confirmation-bias tradeoff, and counter it by re-reading the diff from scratch.)
- DO track re-review invocation count and repeated blockers in conversation context
- DO integrate the inline
/changes-review findings — MUST NOT filter, reinterpret, or override
- IF the inline re-review returns PASS with zero findings → first confirm every confirmed behavior-changing fix applied in this loop produced a new/updated §8 regression/preservation TC via
/spec [mode=tests] (per "Spec enrichment per cycle" above); a behavior-changing fix that left no covering §8 TC is an OPEN finding — re-enter the loop to add it before proceeding. Only once spec enrichment is complete → proceed to the step-15 holistic /why-review (FULL mode over the whole target + changes; loop run→fix→run until it is clean) → then /docs-update → /workflow-end → /watzup → DONE
- IF the inline re-review returns FAIL and the same blocker has not repeated 3 times → validate findings, run
/plan + /plan-execute again, then re-run /changes-review (step 14)
- IF the same validated blocker repeats across 3 invocations with no observable progress → STOP and escalate via
AskUserQuestion — do NOT silently loop or fall back to any prior protocol
Loop-binding tie-in: the Step 0 protocol loop (and the /goal gate when available) stays OPEN until this loop reaches a clean zero-finding pass (or a 3-repeat blocker escalates). The session cannot stop with a validated finding still unfixed by /plan-execute or a non-clean re-review outstanding — this binds on every host, whether or not /goal is installed. Each re-review reviews the WHOLE current diff from the first phase combined with ALL prior fixes — never just the previous cycle's fix in isolation. (This applies in every case — including when this workflow is a step inside a parent workflow — because it always runs inline in the main session and owns the loop directly.)
Specialist finding re-entry (steps 3–9) — DEFAULT is re-run the raising specialist, NOT holistic-only. The Step 14 inline /changes-review re-runs only its own BE/FE/SCSS/UI dimensions; it does NOT re-run the specialist reviewers (/architecture-review, /performance-review, /security-review, /integration-test-review, /production-readiness-review, /domain-entities-review, /ui-review) that ran once at steps 3–9. Therefore a specialist finding fixed in this fix cycle MUST re-enter convergence by DEFAULT via a scoped re-run of the SPECIFIC specialist that raised it — that specialist owns its lens and is the authority on whether its own finding is genuinely resolved. (Exception: /ui-review's UI lens is additionally re-covered by the Step 14 inline /changes-review's UI dimension, so a step-9 UI finding may close on that inline re-review; the other six specialists are not re-run inline.) The holistic Step 15 /why-review alone MAY substitute ONLY as a documented exception with explicit written justification (e.g. the specialist's concern is fully subsumed by the holistic package). NEVER treat a specialist finding as closed on a single pass.
Holistic Why-Review Gate (Step 15) — Standalone Full-Mode Review of the Whole Target (ALWAYS RUNS)
Why this step exists: the step-2 /why-review --validate-findings gate only sanity-checks the findings /changes-review already surfaced, and steps 1 + 3–9 each review one file or one dimension. None of them review the whole target as a single artifact through /why-review's adversarial design-rationale lens — which is exactly why running workflow-review-changes historically missed issues that a standalone /why-review <target> caught. Step 15 closes that gap: it is the same call a human would make by running /why-review directly over the change, now wired into the workflow.
- CONDITION: ALWAYS run (whether or not a fix cycle happened). It runs AFTER the step-14
/changes-review loop has converged to a clean pass (or was skipped because no fixes were needed), so it reviews the settled, final state of the whole change.
- MODE: Invoke
/why-review in FULL mode — pass the review target + the current changes as the target (e.g. /why-review the whole <feature/diff/target> combined with the current changes). MUST NOT use --validate-findings here (that mode is terminal and only re-checks an existing findings list — it would NOT perform the holistic review this step requires).
- SCOPE: "the whole review target combined with current changes" = the complete changeset AND the surrounding code/spec/docs it touches, reviewed as ONE artifact — not a per-file or per-finding pass.
/why-review runs its full Validation Checklist + both Adversarial Rounds + Easy-to-Change gate, then validates its own findings via its internal closing gate.
- LOOP (run → fix → run until no findings): If step 15 surfaces ANY new finding → validate it, re-enter
/plan → /plan-execute → /changes-review (step 14 loop) to fix, then RE-RUN step 15 over the whole updated target. Loop until a complete full-mode /why-review pass finds zero new findings. /why-review's own self-recursive review loop bounds this (max 2 re-do rounds; a 3-repeat blocker with no progress → escalate via AskUserQuestion).
- INLINE INSIDE A PARENT WORKFLOW: when this workflow is a step inside a parent workflow it runs INLINE in the main session (never as a sub-agent), so step 15 runs exactly as it does standalone — it is part of the 18-step sequence and this session owns its own review loop directly (protocol loop always;
/goal gate when available).
- ONLY THEN proceed to
/docs-update (step 16) — so the final docs sweep reflects any fixes step 15 forced.
Iteration Tracking (Conversation-Scoped)
Iteration count is tracked in conversation context only — no persistent files. Each new conversation starts fresh at round 0.
Rules:
- Repeated blocker cap — if the same validated finding repeats for 3 full invocations with no progress, STOP and escalate via
AskUserQuestion (manual review required)
- PASS = done — if no fix cycle happened, initial clean reviews/tests are enough; if a fix cycle happened, PASS requires a complete inline
/changes-review re-review pass with zero findings
- Issue count increasing — if round N finds MORE issues than round N-1, STOP and escalate via
AskUserQuestion
- Goal Satisfaction FAIL = findings exist — a required saved criterion at FAIL in the Goal Satisfaction matrix enters the SAME loop as a code finding: validate the gap is real →
/plan → /plan-execute → inline re-review of the affected criteria only. Workflow end requires every required criterion PASS or BLOCKED with a user-facing escalation reason; mark criteria BLOCKED (never silently drop them) when two consecutive iterations show no criterion progress.
Goal Contract propagation (workflow-owned): At workflow start, resolve the active Goal Contract per SYNC:goal-contract-satisfaction-loop (active plan goal.md → plans/goals/{YYMMDD-HHmm}-{slug}/goal.md). Pass the same goal file reference to every child step; step 1 /changes-review emits the Goal Satisfaction matrix against the SAME saved criteria. After each fix cycle, append an Iteration Log entry to the goal file with evidence references.
Flow Diagram
Main Session: Review → Validate findings → Plan → Fix (/plan-execute) → /changes-review re-review
│ │
│ (no issues) │ (only if /plan-execute changed files;
↓ ↓ else skip to holistic /why-review)
/why-review HOLISTIC (step 15) /changes-review re-runs INLINE
full-mode review of WHOLE target over the current full diff
│ │
new findings? ── yes ──┐ ↓
│ no │ Report → PASS? → /why-review HOLISTIC (step 15)
↓ └─→ Validate → Plan → Fix → /changes-review → (re-run step 15)
/docs-update → FAIL? → Validate findings → Plan → Fix
/workflow-end → /changes-review re-review
/watzup
DONE ✓
IMPORTANT MANDATORY Steps: /changes-review -> /why-review -> /architecture-review -> /domain-entities-review -> /performance-review -> /integration-test-review -> /security-review -> /production-readiness-review -> /ui-review -> /code-simplifier -> /plan -> /plan-review -> /plan-execute -> /changes-review -> /why-review -> /docs-update -> /workflow-end -> /watzup
[STEP CONDITIONS] Not every step always runs — the bare list above is the canonical order; these are the run-conditions:
- Step 0 loop binding (pre-sequence) — ALWAYS bind the self-recursive review loop (protocol loop always;
/goal accelerator when available), including when this workflow is a step inside a parent workflow, because it always runs inline in the main session and owns the loop directly. Not one of the 18 counted steps.
- Step 4
/domain-entities-review — only if domain entity files (Domain/, Entities/, ValueObjects/) are in the diff.
- Step 9
/ui-review — only if frontend/UI files (per the project's configured frontend/UI file patterns) are in the diff. Runs in TWO places by design (keep both): also invoked INTERNALLY inside step 1 /changes-review as its UI dimension.
- Steps 11–13
/plan → /plan-review → /plan-execute — only if reviews surfaced validated findings to fix (i.e. there are findings / code changes to make). Skip all three when steps 1–10 PASS clean.
- Step 14
/changes-review (re-review) — only if /plan-execute actually changed files; re-runs INLINE and loops /plan→/plan-execute→/changes-review until a clean pass (bounded: 3-repeat blocker rule AND 5 rounds MAX — escalate at whichever trips first).
- Step 15
/why-review (HOLISTIC, FULL mode) — ALWAYS runs after the step-14 loop converges; reviews the WHOLE target + changes as one artifact; on new findings re-enters the step-14 fix loop and re-runs until a clean full-mode pass.
- Steps 1–3, 5–8, 10, 15–18 — always run.
[BLOCKING SEQUENCING] Step 1 /changes-review is SEQUENTIAL and MUST run FIRST — it produces the baseline (surface analysis + integration-test/translation gap detection) consumed by all downstream reviewers, AND owns the internal UI review (invokes /ui-review internally via a ui-ux-designer sub-agent when the diff has frontend/UI files — this is the (a) of the keep-both dual run). Step 2 /why-review is SEQUENTIAL and runs immediately after — it validates the /changes-review findings (drops false positives) before any parallel reviewer spawns. Steps 3–9 (/architecture-review, /domain-entities-review, /performance-review, /integration-test-review, /security-review, /production-readiness-review, /ui-review) form a PARALLEL BATCH — spawn all in ONE message via specialized Agent tool calls (architect, code-reviewer, performance-optimizer, integration-tester, security-auditor, /production-readiness-review via code-reviewer, plus /ui-review via ui-ux-designer — the (b) of the keep-both dual run, conditional on frontend/UI files). Step 10 /code-simplifier is SEQUENTIAL and waits until ALL parallel batch sub-agents return + consolidation summary is built; it self-reviews the code it changes via /code-review (scoped to its own changed files) before returning, so there is no separate workflow-level code-review step. Steps 11–14 proceed sequentially as listed. Step 15 /why-review is SEQUENTIAL, ALWAYS runs after the step-14 loop converges, and is invoked in FULL mode (NOT --validate-findings) over the WHOLE target + changes — its own findings loop back through steps 11–14 until a clean full-mode pass, then step 16 /docs-update runs.
[WORKFLOW-IN-WORKFLOW: MUST RUN INLINE IN THE MAIN SESSION — never as a sub-agent] This skill activates the full workflow-review-changes workflow (18 steps). When invoked as a step inside a parent workflow (e.g., workflow-feature, workflow-bugfix, workflow-refactor), it MUST run INLINE in the main current session agent via the Skill tool — NEVER dispatched through the Agent tool as a sub-agent. This is a deliberate, documented EXCEPTION to the general "Workflow-in-workflow → sub-agent" rule (CLAUDE.md / AGENTS.md "Workflow Step Advancement" §3).
Why inline, never a sub-agent: this workflow's correctness depends on owning the main session. (1) Step 0 binds a self-recursive review loop — a self-driven protocol loop on every host, plus (when available) a /goal gate that binds the session Stop hook — so the review→self-fix→re-review loop is unabandonable; a sub-agent runs in an isolated context that only returns a summary and cannot own the session Stop hook, so dispatched as a sub-agent both the inline self-fix loop and the /goal guarantee are silently lost. (2) The step-13 post-fix re-review runs INLINE by design over the live main-session diff. (3) The recursive /plan→/plan-execute→/changes-review→/why-review self-fix loop must mutate and re-read the real working tree across the session, not an isolated context that only returns a summary. Context stays bounded anyway because the heavy reviewers (steps 3–9) are STILL dispatched as sub-agents that write full findings to plans/reports/ — only the orchestration and the self-fix loop run inline.
Standalone invocation (not inside a workflow): inline in the main session, identically — no sub-agent.
[BLOCKING] Each step MUST invoke its Skill tool — marking a task completed without skill invocation is a workflow violation. NEVER batch-complete validation gates.
[CONDITIONAL INLINE RE-REVIEW] After validated fixes in /plan-execute — and ONLY if /plan-execute changed files — re-run /changes-review INLINE (step 14) over the current full diff. If /plan-execute made no changes, skip step 14. Clean review passes with zero findings end the step-14 loop; repeated blockers stop after 3 no-progress invocations. Either way, step 15 /why-review (holistic, FULL mode) ALWAYS runs next over the whole target + changes before /docs-update.
[REPEATED BLOCKER CAP] Track re-review invocations in conversation context, not persistent files. After a fix cycle, PASS = a complete inline /changes-review re-review pass finds zero findings without more fixes; stop after the same blocker repeats 3 times with no progress.
Activate the workflow-review-changes workflow. Run /start-workflow workflow-review-changes with the user's prompt as context.
Applicability in this workflow (reconciles with step 13): the canonical block below is the general fresh-context mechanism. In workflow-review-changes the step-14 post-fix re-review applies its principle — zero memory, re-read the full diff from scratch, no self-filtering — INLINE in the main session (the deliberate cost tradeoff documented at step 14), NOT via an isolated sub-agent. The isolated-sub-agent form below governs ONLY the parallel dimensional reviewers in steps 3–9 (already sub-agents); the workflow itself — even as a step inside a parent workflow — always runs INLINE in the main session, never as a sub-agent. So "with isolated sub-agents where applicable" resolves to inline for the step-14 self-re-review and for the workflow orchestration — no contradiction.
Parallel-Phase Advancement (model-driven) — How to run AND advance a declared parallel batch of workflow steps. Tool-agnostic: identical under Claude and Codex — neither depends on a hook. Mirrors the universal context-file rule ("Workflow Step Advancement & Parallel Phases" in CLAUDE.md / AGENTS.md).
- Declare the group. Name the members of the parallel phase up-front — which steps run together, and mark any conditional member with its trigger.
- Spawn ALL members in ONE message. Dispatch every member together (multiple
Agent/sub-agent calls in a single response) — never drip them one per turn.
- Barrier — advance ONLY after EVERY member returns. A member is "returned" when its work completes inline OR its sub-agent returns; a conditional member whose trigger is absent counts as returned. Do NOT advance, and do NOT start the next step, until the whole group has returned.
- A sub-agent return advances the step identically to an inline call. Advancement is YOUR judgment against the task list — never wait for a hook or tool event. Mark each member
completed (or "Skipped — ") as the batch resolves.
- Mutating steps wait for the barrier. Never start a code-mutating step (e.g.
code-simplifier) until the full batch has returned — it must act on the complete review snapshot, not a partial one.
- Hooks are accelerators only. Any step-tracking hook may emit a "next step" hint as an optimization; correctness MUST NOT depend on it. Codex runs with no hooks and advances entirely by this rule.
Blocked until: - [ ] all members spawned in one message - [ ] every member returned (incl. skipped conditional) - [ ] each member marked completed/skipped - [ ] mutating step deferred until after the barrier.
End-to-Start Debugger Trace — For non-trivial bugs, failed verification, regression fixes, behavior-changing code, or unclear code flow, start from the observed final state and walk backward before proposing a fix.
- Frame 0: observed end state — Name the exact user-visible output, failing assertion, log line, persisted value, API response, rendered UI, or aggregate bucket. Record the reader/query/renderer that produced it with
file:line evidence.
- Walk backward one hop at a time — Trace final reader -> projection/cache/storage -> writer -> consumer/handler/job -> producer/caller -> original trigger. At every hop record: input, transformation, output, owner, and evidence.
- Enumerate all feeder paths — Find every upstream producer/caller/event/job that can write into the final path, including retry, async, cache, background, and alternate UI/API paths. Mark each path verified, ruled out, or still unknown.
- Build the hypothesis matrix — For each plausible cause, list evidence for, evidence against, how to reproduce/verify, blast radius, and status (
primary, contributing, ruled out, latent). Do not fix until competing causes are explicitly resolved or bounded.
- Choose the owning fix layer — Identify the invariant owner and the lowest shared point that protects all downstream consumers. A fix at the symptom site is rejected unless the symptom site owns the invariant.
- Prove convergence forward — After choosing the fix, walk start -> end again and show how the corrected state reaches the observed final output. Map each root cause to a fix part and each fix part to a test/proof.
BLOCKED until: final state named · backward trace written · all feeder paths enumerated · hypothesis matrix completed · owning fix layer justified · forward convergence proof mapped to tests.
NEVER: Start at the first suspicious code path. Collapse multiple producers into one "flow". Treat duplicate symptoms as duplicate records without proving the read model. Skip ruled-out hypotheses.
Fresh Context Re-Review — Eliminate orchestrator confirmation bias after fixes by restarting the full review with isolated sub-agents where applicable.
Why: The main agent knows what it (or /feature-implement) just fixed and rationalizes findings accordingly. A fresh sub-agent has ZERO memory, re-reads from scratch, and catches what the main agent dismissed. Sub-agent bias is mitigated by (1) fresh context, (2) verbatim protocol injection, (3) main agent not filtering the report.
When: ONLY after a validated-finding fix cycle. A review round that finds zero issues ENDS the loop — do NOT spawn a confirmation sub-agent. A review round that finds issues triggers: validate findings → fix → full review restart from the first phase.
How:
- Start a NEW full review invocation/task breakdown; when that protocol calls for agents, spawn NEW
Agent tool calls — use code-reviewer subagent_type for code reviews, general-purpose for plan/doc/artifact reviews
- Inject ALL required review protocols VERBATIM into the prompt — see
SYNC:review-protocol-injection for the full list and template. Never reference protocols by file path; AI compliance drops behind file-read indirection (see SYNC:shared-protocol-duplication-policy)
- Sub-agent re-reads ALL target files from scratch via its own tool calls — never pass file contents inline in the prompt
- Sub-agent writes structured report to
plans/reports/{review-type}-round{N}-{date}.md
- Main agent reads the report, integrates findings into its own report, DOES NOT override or filter
Rules:
- SKIP fresh sub-agent when the prior full review found zero issues (no fixes = nothing new to verify)
- NEVER skip the full review restart after a fix cycle — every fix invalidates the prior verdict
- NEVER reuse a sub-agent across rounds — every fresh round spawns a NEW
Agent call
- Continue until a complete full review pass has zero findings; if the same blocker repeats 3 times with no progress, escalate via
AskUserQuestion
- Track iteration count and repeated blockers in conversation context (session-scoped, no persistent files)
Incremental Result Persistence — MANDATORY for all sub-agents or heavy inline steps processing >3 files.
- Before starting: Create report file
plans/reports/{skill}-{date}-{slug}.md
- After each file/section reviewed: Append findings to report immediately — never hold in memory
- Return to main agent: Summary only (per SYNC:subagent-return-contract) with
Full report: path
- Main agent: Reads report file only when resolving specific blockers
Why: Context cutoff mid-execution loses ALL in-memory findings. Each disk write survives compaction. Partial results are better than no results.
Report naming: plans/reports/{skill-name}-{YYMMDD}-{HHmm}-{slug}.md
Sub-Agent Return Contract — When this skill spawns a sub-agent, the sub-agent MUST return ONLY this structure. Main agent reads only this summary — NEVER requests full sub-agent output inline.
## Sub-Agent Result: [skill-name]
Status: ✅ PASS | ⚠️ PARTIAL | ❌ FAIL
Confidence: [0-100]%
### Findings (Critical/High only — max 10 bullets)
- [severity] [file:line] [finding]
### Actions Taken
- [file changed] [what changed]
### Blockers (if any)
- [blocker description]
Full report: plans/reports/[skill-name]-[date]-[slug].md
Main agent reads Full report file ONLY when: (a) resolving a specific blocker, or (b) building a fix plan.
Sub-agent writes full report incrementally (per SYNC:incremental-persistence) — not held in memory.
Context budget — the return payload is a SUMMARY, not a transcript: ≤10 finding bullets, no raw file contents / full diffs / verbatim logs inline, no re-pasted source. Everything beyond the summary lives in the Full report on disk. A sub-agent that would exceed the summary shape MUST write the detail to its report and return only the pointer — the orchestrator's context is the scarce resource the whole map-reduce protects.
AI Mistake Prevention — Failure modes to avoid on every task:
Re-read files after context changes. Context compaction, resume, or long-running work can make memory stale; verify current files before acting.
Verify generated content against source evidence. AI hallucinates APIs, names, claims, and document facts. Check the relevant source before documenting or referencing.
Check downstream references before deleting or renaming. Removing an artifact can stale docs, generated mirrors, configs, and callers; map references first.
Trace the full impact chain after edits. Changing a definition can miss derived outputs and consumers. Follow the affected chain before declaring done.
Verify ALL affected outputs, not just the first. One green check is not all green checks; validate every output surface the change can affect.
Assume existing values are intentional — ask WHY before changing. Before changing a constant, limit, flag, wording, or pattern, read nearby context and history.
Surface ambiguity before acting — don't pick silently. Multiple valid interpretations require an explicit question or stated assumption with risk.
Keep shared guidance role-relevant. Universal guidance must help every receiving skill or agent; code-specific obligations belong only in code-specific protocols.
Nested Task Expansion Contract — For workflow-step invocation, the [Workflow] ... row is only a parent container; the child skill still creates visible phase tasks.
- Call
TaskList first. If a matching active parent workflow row exists, set nested=true and record parentTaskId; otherwise run standalone.
- Create one task per declared phase before phase work. When nested, prefix subjects
[N.M] $skill-name — phase.
- When nested, link the parent with
TaskUpdate(parentTaskId, addBlockedBy: [childIds]).
- Orchestrators must pre-expand a child skill's phase list and link the workflow row before invoking that child skill or sub-agent.
- Mark exactly one child
in_progress before work and completed immediately after evidence is written.
- Complete the parent only after all child tasks are completed or explicitly cancelled with reason.
Blocked until: TaskList done, child phases created, parent linked when nested, first child marked in_progress.
Task Tracking & External Report Persistence — Bootstrap this before execution; then run project-reference doc prefetch before target/source work.
- Create a small task breakdown before target file reads, grep, edits, or analysis. On context loss, inspect the current task list first.
- Mark one task
in_progress before work and completed immediately after evidence; never batch transitions.
- For plan/review work, create
plans/reports/{skill}-{YYMMDD}-{HHmm}-{slug}.md before first finding.
- Append findings after each file/section/decision and synthesize from the report file at the end.
- Final output cites
Full report: plans/reports/{filename}.
Blocked until: task breakdown exists, report path declared for plan/review work, first finding persisted before the next finding.
Critical Thinking Mindset — Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.
Anti-hallucination: Never present guess as fact — cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence — certainty without evidence root of all hallucination.
Project Reference Docs Gate — Run after task-tracking bootstrap and before target/source file reads, grep, edits, or analysis. Project docs override generic framework assumptions.
- Identify scope: file types, domain area, and operation.
- Read
docs/project-config.json first — the project's machine-readable map. It is the single source of truth for THIS repo (modules/paths, framework + search keywords, test/E2E/integration run-commands, design system, architecture rules, workflow patterns); ground exact paths, run-commands, and conventions on it before investigating, planning, or coding — never assume framework defaults (CLAUDE.md + reference docs are derived from it). If it — or the docs index, lessons.md, CLAUDE.md, AGENTS.md, or any required reference doc — is missing or stale, auto-run /project-init or the narrow route (/project-config, /docs-init, /scan-all, /scan --target=<key>, /claude-md-init) first; if Codex mirrors or AGENTS.md are stale, ask the user to run /sync-codex (never auto-run it).
- Required docs by trigger: always
docs/project-reference/lessons.md; doc lookup docs-index-reference.md; review code-review-rules.md; backend/CQRS/API backend-patterns-reference.md; domain/entity domain-entities-reference.md; frontend/UI frontend-patterns-reference.md; styles/design scss-styling-guide.md + design-system/design-system-canonical.md; integration tests integration-test-reference.md; E2E e2e-test-reference.md; feature docs/specs feature-spec-reference.md + spec-system-reference.md + spec-principles.md; behavior/public-contract/spec-test-code sync workflow-spec-test-code-cycle-reference.md; derived spec index/ERD/reimplementation guides spec-system-reference.md + source Feature Specs under docs/specs/; architecture/new area project-structure-reference.md.
- Read every required doc, then before target work state:
Reference docs read: ... | Not applicable: ....
Ready when: scope evaluated, docs/project-config.json consulted, required docs checked/read or setup route completed, lessons.md confirmed, citation emitted.
Goal Contract Satisfaction Loop — Persist the user goal in an external file, execute against it, and loop review/fix until every saved required criterion passes or a blocker escalates. Bounded closed loop — NEVER open-ended autonomous exploration.
- Resolve the active goal (in order): active plan
goal.md → plans/goals/{YYMMDD-HHmm}-{slug}/goal.md → create a new Goal Contract from the current user request (template: .claude/templates/goal-contract-template.md).
- Required sections: Original Request, Purpose, Success Criteria (checkboxes; mark required vs optional), Constraints, Evidence Required, Iteration Log, Goal Satisfaction matrix.
- Before work: read the active goal and map planned work to saved success criteria — execution serves the saved criteria, never chat memory alone.
- After execution/verification: append an Iteration Log entry — result, evidence references (
file:line, command output, report path), remaining gaps.
- Review gate: emit a Goal Satisfaction matrix —
| Success Criterion | Evidence | Status | with PASS/FAIL/BLOCKED. Overall PASS requires every required criterion PASS.
- Loop rule (retry): required criterion FAIL → validate the gap is real → fix → re-review only the affected criteria. Stop cleanly when all required criteria PASS.
- Escalation rule (stop): two consecutive iterations with no criterion progressing, or a blocker needing user input → mark the criterion BLOCKED with a user-facing reason and escalate. NEVER loop indefinitely.
- Skip rule: tiny conversational tasks may skip the goal file ONLY with a recorded one-line reason. User-accepted gate skips are recorded in the goal file with reason and scope.
- Security: NEVER store secrets, tokens, credentials, or private customer data in goal files — store evidence references and redact sensitive values.
Blocked until: active goal resolved (or skip reason recorded) · saved success criteria read before edits · iteration evidence appended after execution · Goal Satisfaction matrix emitted before any PASS verdict.
Trade-Off Interrogation Gate — ALWAYS ask these THREE questions before ANY verdict, score, finding, or recommendation — about the thing under review AND about every recommendation YOU make. — why: naming a benefit without its price is an endorsement, not a review; the costliest trade-offs are the ones nobody wrote down.
- Is there any trade-off? Name what it SACRIFICES. "None" / "pure win" is an unfinished analysis, NOT an answer — to claim none, state which dimensions you checked and why each is unaffected: future change cost · complexity · performance/latency · memory/cost · coupling · reversibility · migration burden · operational load · blast radius · security posture · testability · team skill/ramp · delivery time · UX.
- Is it worth it? Weigh gain against sacrifice EXPLICITLY — what is gained (with a metric) · what it costs · WHO pays · WHEN it comes due — then emit WORTH IT / NOT WORTH IT / UNCLEAR. "Better" with no metric and no cost FAILS this question. NOT WORTH IT → withdraw or replace the recommendation, never keep it as-is.
- Is the trade-off material enough to CONFIRM WITH THE USER? A material trade-off is the user's call, never yours. MATERIAL when ANY holds: irreversible / one-way door (data migration, public contract, storage format, vendor lock-in) · cost shifted onto someone else (another team, ops/on-call, future maintainer, end user) · one quality attribute traded for another (correctness↔speed, security↔convenience, latency↔cost, simplicity↔flexibility) · a boundary crossed (client↔server tier, service contract, event contract, shared library) · a high-consequence path (auth, money, data integrity, breaking change, High/Medium residual risk) · the worth-it verdict is UNCLEAR.
MATERIAL → STOP and confirm via AskUserQuestion BEFORE the verdict stands — state the trade-off, both options, what each sacrifices, and your recommendation. NOT material → record it inline with a one-line justification and proceed.
Non-asking execution contexts — ESCALATE BY HANDOFF, never by silence. AskUserQuestion reaches only the main interactive agent: a sub-agent cannot ask the user, and a terminal/verdict-only mode asks nothing by design. When you are running in such a context, the obligation is redirected, never waived — do ALL of: (a) complete questions 1 and 2 normally; (b) decide materiality and record it in the Trade-Off Assessment row with confirmed? = NO — cannot ask from this context; (c) name the unconfirmed MATERIAL trade-off explicitly in your returned summary/verdict so the CALLER (or parent orchestrator) escalates it via AskUserQuestion on your behalf — a material trade-off mentioned only inside a report file on disk is NOT a handoff; (d) do not emit an unqualified PASS — mark the verdict as carrying an unconfirmed material trade-off, so the caller's gate stays closed until the user answers. The caller inherits the escalation duty the moment it reads your return.
This carve-out is about reachability, not convenience: it applies ONLY where the tool genuinely cannot reach the user (spawned sub-agent, terminal validate/verdict-only mode, non-interactive/headless run). It is NEVER a licence to skip the question, to self-approve a one-way door, or to downgrade materiality because asking is inconvenient — if you CAN ask, you MUST ask.
Emit a Trade-Off Assessment row per reviewed decision and per recommendation: | decision | sacrifices | gain (metric) | who pays, when | WORTH IT/NOT/UNCLEAR | material? | confirmed? |.
BLOCKED until: trade-off named (or dimensions-checked justification given) · worth-it verdict emitted · materiality decided · every MATERIAL trade-off either confirmed with the user OR — in a non-asking context — handed off in the returned verdict for the caller to confirm. A MATERIAL trade-off that is neither confirmed nor handed off can NEVER be PASS, and NEVER gets buried as a Low-severity note.
NEVER answer "no trade-off" without checking · decide a material trade-off silently on the user's behalf · let convergence/delivery pressure authorize walking through a one-way door · bundle several material trade-offs into one vague "proceed?".
MUST ATTENTION apply critical + sequential thinking — every claim needs appropriate traced evidence (file:line for repo/code claims; source URL or artifact section for research, product, content, and docs claims); confidence >80% to act, <60% DO NOT recommend. Anti-hallucination: never present guess as fact, admit uncertainty freely, cross-reference independently, stay skeptical of own confidence.
MUST ATTENTION apply AI mistake prevention — verify generated content against evidence, trace downstream references before deleting or renaming, verify all affected outputs, re-read files after context loss, and surface ambiguity before acting.
- MANDATORY Bootstrap task tracking before target work; transition one task at a time.
- MANDATORY Persist plan/review findings to
plans/reports/ incrementally and synthesize from disk.
- MANDATORY Before investigating, planning, or coding, read
docs/project-config.json (the project map: modules/paths, run-commands, conventions, architecture/workflow rules) + the required project-reference docs, and cite Reference docs read: ....
- MANDATORY Always include
lessons.md; project config + conventions override generic framework defaults.
- MANDATORY If project config, root instruction files, or any required reference doc is missing or stale, auto-run
/project-init or the narrow lower-level route before ordinary project-specific work.
IMPORTANT MUST ATTENTION debugger trace gate: for non-trivial bug/fix/investigation/review work, start at the observed final output and trace backward through reader -> storage/projection -> writer -> consumer/job -> producer/trigger. Enumerate all feeder paths and hypotheses before fixing. BLOCKED until trace, hypothesis matrix, owning fix layer, and forward convergence proof exist.
- MANDATORY Parent workflow rows do not replace child phase tracking; expand phases and link the parent when nested.
- MANDATORY Orchestrators pre-expand child skill phases before invocation; use
[N.M] $skill-name — phase prefixes and one-in_progress discipline.
- MANDATORY Resolve the active Goal Contract BEFORE work (active plan
goal.md → plans/goals/{YYMMDD-HHmm}-{slug}/goal.md → create from current request) and read saved success criteria before editing.
- MANDATORY Append iteration evidence after execution; emit a Goal Satisfaction matrix (PASS/FAIL/BLOCKED) before reporting PASS; loop on validated FAIL; escalate repeated no-progress or blockers. NEVER store secrets in goal files.
Prompt-Enhance Closing Anchors
IMPORTANT MUST ATTENTION follow declared step order for this skill; NEVER skip, reorder, or merge steps without explicit user approval
IMPORTANT MUST ATTENTION for every step/sub-skill call: set in_progress before execution, set completed after execution
IMPORTANT MUST ATTENTION every skipped step MUST include explicit reason; every completed step MUST include concise evidence
IMPORTANT MUST ATTENTION if Task tools unavailable, maintain an equivalent step-by-step plan tracker with synchronized statuses
- MANDATORY MUST ATTENTION ALWAYS ASK THE 3 TRADE-OFF QUESTIONS — on the thing under review AND on every recommendation you make: (1) is there any trade-off? name what it SACRIFICES (change cost · complexity · perf · coupling · reversibility · migration · ops load · blast radius · security · testability · delivery time · UX) — "none"/"pure win" is an unfinished analysis, so state the dimensions checked; (2) is it worth it? gain (with a metric) vs cost, WHO pays, WHEN → emit WORTH IT / NOT WORTH IT / UNCLEAR; NOT WORTH IT → withdraw or replace it; (3) is it material enough to confirm with the user? irreversible/one-way door · cost shifted onto another team/ops/maintainer/user · one quality attribute traded for another · a tier/service/event/library boundary crossed · auth/money/data-integrity/breaking-change/High-or-Medium-risk path · verdict UNCLEAR → STOP and confirm via
AskUserQuestion BEFORE the verdict.
- MANDATORY A MATERIAL trade-off with no user confirmation can NEVER be PASS; NEVER bury one as a Low-severity note, NEVER decide it silently, and NEVER let delivery or convergence pressure authorize a one-way door. — why: an un-walked-back one-way door is the user's call to make, not the reviewer's.
- MANDATORY — non-asking contexts escalate BY HANDOFF, never by silence.
AskUserQuestion reaches only the main interactive agent: a sub-agent cannot ask the user, and a terminal/verdict-only mode asks nothing by design. There the duty is REDIRECTED, not waived — still name the trade-off, still decide materiality, record confirmed? = NO — cannot ask from this context, state the unconfirmed MATERIAL trade-off in your RETURNED verdict/summary so the CALLER escalates it (a note only in an on-disk report is not a handoff), and never emit an unqualified PASS. Applies ONLY where the user is genuinely unreachable (spawned sub-agent, terminal validate mode, headless run) — if you CAN ask, you MUST ask.
Closing Reminders
IMPORTANT MUST ATTENTION Goal: Ensure changed work reaches clean review through validated findings, verified fixes, full re-review, and synchronized docs/tests — review all uncommitted changes, validate findings, fix ONLY validated findings, then re-run /changes-review INLINE (only when /plan-execute changed files), looping plan→plan-execute→changes-review until one complete pass is clean.
MUST ATTENTION Protocols in force (concise digest of the SYNC/shared blocks this skill carries — each line is a signpost to its canonical body above; NEVER act on the digest alone, read the cited block):
- Parallel-Phase Advancement: spawn batch in one message; advance only after all-return barrier.
- End-to-Start Debugger Trace: trace observed end state backward before fixing.
- Fresh Context Re-Review: restart full review post-fix; zero-memory re-read counters confirmation bias.
- Incremental Persistence: append findings to report file per item; never hold in memory.
- Sub-Agent Return Contract: return only the summary shape; full report on disk.
- AI Mistake Prevention: verify generated content against evidence, trace downstream references, verify all affected outputs, re-read after context loss, surface ambiguity.
- Nested Task Creation: parent workflow row never replaces child phase tasks.
- Task Tracking & External Report: bootstrap task breakdown and report path before work.
- Critical Thinking: every claim needs traced proof; confidence >80% to act.
- Project Reference Docs: read required project-reference docs first; conventions override generic defaults.
IMPORTANT MUST ATTENTION run the sequence in order — step 1 /changes-review owns the baseline (surface analysis + UI review via internal /ui-review + integration-test/translation-sync/spec-drift gates), step 2 /why-review validates those findings BEFORE the parallel batch fires — so steps 3–9 act only on warranted findings — why: validating after fixing wastes the batch on false positives.
IMPORTANT MUST ATTENTION spawn the steps 3–9 read-only reviewers (/architecture-review, /domain-entities-review [if entity files], /performance-review, /integration-test-review, /security-review, /production-readiness-review, /ui-review [if frontend/UI files]) ALL in ONE message and advance ONLY after EVERY member returns (all-return barrier) — defer mutating /code-simplifier (step 10) until the barrier clears — why: a code-mutating step must see the complete review snapshot, not a partial one.
IMPORTANT MUST ATTENTION every finding, recommendation, and verdict needs file:line proof or traced evidence + a confidence % — >80% act, 60–80% verify first, <60% DO NOT recommend; "Insufficient evidence" is valid output — why: speculation is forbidden output and silently encodes false positives into the fix plan.
MUST ATTENTION break work into small todo tasks using TaskCreate BEFORE starting — create ALL 18 tasks immediately (source of truth = workflows.json → changes-review.sequence); mark one in_progress, mark completed immediately after each step's evidence; on context loss call TaskList first — never duplicate.
MUST ATTENTION grep 3+ existing patterns and read the target files BEFORE proposing any fix; cite file:line evidence in the fix plan — local conventions override generic framework defaults — why: closest example ≠ matching preconditions, verify shared base classes/scope/lifetime before copying.
MUST ATTENTION after fixes in /plan-execute (and ONLY if /plan-execute changed files), re-run /changes-review INLINE over the current full diff from Phase 0; re-read the diff from scratch to counter orchestrator confirmation bias — why: the main agent rationalizes findings about its own fixes; loop /plan→/plan-execute→/changes-review until clean.
MUST ATTENTION track full re-review invocations and repeated blockers in conversation context (session-scoped, no persistent files) — stop after the same blocker repeats 3 times with no progress and escalate via AskUserQuestion; STOP and escalate if round N finds MORE issues than round N-1 — never silently loop.