@brunosps00/dev-workflow 0.15.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +97 -119
  2. package/lib/constants.js +16 -36
  3. package/lib/migrate-skills.js +11 -4
  4. package/lib/removed-commands.js +30 -0
  5. package/package.json +1 -1
  6. package/scaffold/en/agent-instructions.md +27 -16
  7. package/scaffold/en/commands/dw-adr.md +2 -2
  8. package/scaffold/en/commands/dw-analyze-project.md +7 -7
  9. package/scaffold/en/commands/dw-autopilot.md +20 -20
  10. package/scaffold/en/commands/dw-brainstorm.md +160 -9
  11. package/scaffold/en/commands/dw-bugfix.md +5 -5
  12. package/scaffold/en/commands/dw-commit.md +1 -1
  13. package/scaffold/en/commands/dw-dockerize.md +9 -9
  14. package/scaffold/en/commands/dw-find-skills.md +4 -4
  15. package/scaffold/en/commands/dw-functional-doc.md +1 -1
  16. package/scaffold/en/commands/dw-generate-pr.md +4 -4
  17. package/scaffold/en/commands/dw-help.md +95 -351
  18. package/scaffold/en/commands/dw-intel.md +76 -12
  19. package/scaffold/en/commands/dw-new-project.md +9 -9
  20. package/scaffold/en/commands/dw-plan.md +175 -0
  21. package/scaffold/en/commands/dw-qa.md +166 -0
  22. package/scaffold/en/commands/dw-redesign-ui.md +6 -6
  23. package/scaffold/en/commands/dw-review.md +198 -0
  24. package/scaffold/en/commands/dw-run.md +176 -0
  25. package/scaffold/en/commands/dw-secure-audit.md +222 -0
  26. package/scaffold/en/commands/dw-update.md +1 -1
  27. package/scaffold/en/references/playwright-patterns.md +1 -1
  28. package/scaffold/en/references/refactoring-catalog.md +1 -1
  29. package/scaffold/en/templates/brainstorm-matrix.md +1 -1
  30. package/scaffold/en/templates/idea-onepager.md +3 -3
  31. package/scaffold/en/templates/project-onepager.md +5 -5
  32. package/scaffold/pt-br/agent-instructions.md +27 -16
  33. package/scaffold/pt-br/commands/dw-adr.md +2 -2
  34. package/scaffold/pt-br/commands/dw-analyze-project.md +7 -7
  35. package/scaffold/pt-br/commands/dw-autopilot.md +20 -20
  36. package/scaffold/pt-br/commands/dw-brainstorm.md +160 -9
  37. package/scaffold/pt-br/commands/dw-bugfix.md +8 -8
  38. package/scaffold/pt-br/commands/dw-commit.md +1 -1
  39. package/scaffold/pt-br/commands/dw-dockerize.md +9 -9
  40. package/scaffold/pt-br/commands/dw-find-skills.md +4 -4
  41. package/scaffold/pt-br/commands/dw-functional-doc.md +1 -1
  42. package/scaffold/pt-br/commands/dw-generate-pr.md +4 -4
  43. package/scaffold/pt-br/commands/dw-help.md +97 -300
  44. package/scaffold/pt-br/commands/dw-intel.md +77 -13
  45. package/scaffold/pt-br/commands/dw-new-project.md +9 -9
  46. package/scaffold/pt-br/commands/dw-plan.md +175 -0
  47. package/scaffold/pt-br/commands/dw-qa.md +166 -0
  48. package/scaffold/pt-br/commands/dw-redesign-ui.md +6 -6
  49. package/scaffold/pt-br/commands/dw-review.md +198 -0
  50. package/scaffold/pt-br/commands/dw-run.md +176 -0
  51. package/scaffold/pt-br/commands/dw-secure-audit.md +222 -0
  52. package/scaffold/pt-br/commands/dw-update.md +1 -1
  53. package/scaffold/pt-br/references/playwright-patterns.md +1 -1
  54. package/scaffold/pt-br/references/refactoring-catalog.md +1 -1
  55. package/scaffold/pt-br/templates/brainstorm-matrix.md +1 -1
  56. package/scaffold/pt-br/templates/idea-onepager.md +3 -3
  57. package/scaffold/pt-br/templates/project-onepager.md +5 -5
  58. package/scaffold/pt-br/templates/tasks-template.md +1 -1
  59. package/scaffold/skills/api-testing-recipes/SKILL.md +6 -6
  60. package/scaffold/skills/api-testing-recipes/references/auth-patterns.md +1 -1
  61. package/scaffold/skills/api-testing-recipes/references/matrix-conventions.md +1 -1
  62. package/scaffold/skills/api-testing-recipes/references/openapi-driven.md +3 -3
  63. package/scaffold/skills/docker-compose-recipes/SKILL.md +1 -1
  64. package/scaffold/skills/dw-codebase-intel/SKILL.md +9 -9
  65. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +4 -4
  66. package/scaffold/skills/dw-codebase-intel/references/api-design-discipline.md +1 -1
  67. package/scaffold/skills/dw-codebase-intel/references/incremental-update.md +5 -5
  68. package/scaffold/skills/dw-codebase-intel/references/intel-format.md +1 -1
  69. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +3 -3
  70. package/scaffold/skills/dw-council/SKILL.md +2 -2
  71. package/scaffold/skills/dw-debug-protocol/SKILL.md +5 -3
  72. package/scaffold/skills/dw-execute-phase/SKILL.md +16 -16
  73. package/scaffold/skills/dw-execute-phase/agents/executor.md +5 -5
  74. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -4
  75. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +1 -1
  76. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +2 -2
  77. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +1 -1
  78. package/scaffold/skills/dw-git-discipline/SKILL.md +5 -2
  79. package/scaffold/skills/dw-incident-response/SKILL.md +5 -1
  80. package/scaffold/skills/dw-llm-eval/SKILL.md +10 -8
  81. package/scaffold/skills/dw-memory/SKILL.md +2 -2
  82. package/scaffold/skills/dw-review-rigor/SKILL.md +5 -5
  83. package/scaffold/skills/dw-simplification/SKILL.md +4 -4
  84. package/scaffold/skills/dw-source-grounding/SKILL.md +1 -1
  85. package/scaffold/skills/dw-testing-discipline/SKILL.md +8 -6
  86. package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +3 -3
  87. package/scaffold/skills/dw-testing-discipline/references/anti-patterns.md +2 -2
  88. package/scaffold/skills/dw-testing-discipline/references/core-rules.md +1 -1
  89. package/scaffold/skills/dw-testing-discipline/references/flaky-discipline.md +3 -3
  90. package/scaffold/skills/dw-testing-discipline/references/patterns.md +1 -1
  91. package/scaffold/skills/dw-testing-discipline/references/playwright-recipes.md +1 -1
  92. package/scaffold/skills/dw-ui-discipline/SKILL.md +8 -6
  93. package/scaffold/skills/dw-ui-discipline/references/accessibility-floor.md +2 -2
  94. package/scaffold/skills/dw-ui-discipline/references/hard-gate.md +1 -1
  95. package/scaffold/skills/dw-ui-discipline/references/state-matrix.md +1 -1
  96. package/scaffold/skills/dw-ui-discipline/references/visual-slop.md +2 -2
  97. package/scaffold/skills/dw-verify/SKILL.md +4 -4
  98. package/scaffold/skills/humanizer/SKILL.md +1 -7
  99. package/scaffold/skills/remotion-best-practices/SKILL.md +3 -1
  100. package/scaffold/skills/security-review/SKILL.md +1 -1
  101. package/scaffold/skills/security-review/languages/csharp.md +1 -1
  102. package/scaffold/skills/security-review/languages/rust.md +1 -1
  103. package/scaffold/skills/security-review/languages/typescript.md +1 -1
  104. package/scaffold/skills/vercel-react-best-practices/SKILL.md +3 -1
  105. package/scaffold/templates-overrides-readme.md +3 -3
  106. package/scaffold/en/commands/dw-code-review.md +0 -386
  107. package/scaffold/en/commands/dw-create-prd.md +0 -148
  108. package/scaffold/en/commands/dw-create-tasks.md +0 -201
  109. package/scaffold/en/commands/dw-create-techspec.md +0 -210
  110. package/scaffold/en/commands/dw-deep-research.md +0 -418
  111. package/scaffold/en/commands/dw-deps-audit.md +0 -327
  112. package/scaffold/en/commands/dw-fix-qa.md +0 -152
  113. package/scaffold/en/commands/dw-map-codebase.md +0 -125
  114. package/scaffold/en/commands/dw-refactoring-analysis.md +0 -340
  115. package/scaffold/en/commands/dw-revert-task.md +0 -114
  116. package/scaffold/en/commands/dw-review-implementation.md +0 -349
  117. package/scaffold/en/commands/dw-run-plan.md +0 -300
  118. package/scaffold/en/commands/dw-run-qa.md +0 -497
  119. package/scaffold/en/commands/dw-run-task.md +0 -209
  120. package/scaffold/en/commands/dw-security-check.md +0 -271
  121. package/scaffold/pt-br/commands/dw-code-review.md +0 -366
  122. package/scaffold/pt-br/commands/dw-create-prd.md +0 -148
  123. package/scaffold/pt-br/commands/dw-create-tasks.md +0 -201
  124. package/scaffold/pt-br/commands/dw-create-techspec.md +0 -208
  125. package/scaffold/pt-br/commands/dw-deep-research.md +0 -172
  126. package/scaffold/pt-br/commands/dw-deps-audit.md +0 -327
  127. package/scaffold/pt-br/commands/dw-fix-qa.md +0 -152
  128. package/scaffold/pt-br/commands/dw-map-codebase.md +0 -125
  129. package/scaffold/pt-br/commands/dw-refactoring-analysis.md +0 -340
  130. package/scaffold/pt-br/commands/dw-revert-task.md +0 -114
  131. package/scaffold/pt-br/commands/dw-review-implementation.md +0 -337
  132. package/scaffold/pt-br/commands/dw-run-plan.md +0 -296
  133. package/scaffold/pt-br/commands/dw-run-qa.md +0 -495
  134. package/scaffold/pt-br/commands/dw-run-task.md +0 -208
  135. package/scaffold/pt-br/commands/dw-security-check.md +0 -271
@@ -13,11 +13,11 @@ You are a workspace bootstrap lead for the dev-workflow ecosystem. Your job is t
13
13
  - Spinning up a learning sandbox where you want a realistic stack (db + cache + email + observability) without 30 minutes of YAML
14
14
  - NOT for adding services to an existing project — use `/dw-dockerize --audit` for that
15
15
  - NOT for adding a new app inside an existing monorepo — that needs a different command (planned for a future release)
16
- - NOT a replacement for `/dw-create-prd` — this generates the workspace, not the product spec
16
+ - NOT a replacement for `/dw-plan prd` — this generates the workspace, not the product spec
17
17
 
18
18
  ## Pipeline Position
19
19
 
20
- **Predecessor:** `npx dev-workflow init` (ran from inside the target directory) | **Successor:** `/dw-create-prd` for the first feature, or `/dw-analyze-project` after the first substantial commit to enrich `.dw/rules/`
20
+ **Predecessor:** `npx dev-workflow init` (ran from inside the target directory) | **Successor:** `/dw-plan prd` for the first feature, or `/dw-analyze-project` after the first substantial commit to enrich `.dw/rules/`
21
21
 
22
22
  ## Complementary Skills
23
23
 
@@ -242,7 +242,7 @@ Generate a starter README with:
242
242
  - Local Dev (port table for selected services + UI URLs + default credentials)
243
243
  - Architecture diagram (ASCII from the one-pager)
244
244
  - Project layout (tree of top-level dirs)
245
- - Dev-workflow integration (mentions `/dw-create-prd`, `/dw-run-task`, `/dw-run-qa`, `/dw-deps-audit`, `/dw-security-check`)
245
+ - Dev-workflow integration (mentions `/dw-plan prd`, `/dw-run`, `/dw-qa`, `/dw-secure-audit --plan`, `/dw-secure-audit`)
246
246
 
247
247
  If `create-*` already generated a README, **append** to it under "## Local Dev"; do not overwrite.
248
248
 
@@ -303,7 +303,7 @@ monorepo: <pnpm-workspaces|turborepo|nx|none>
303
303
  2. `pnpm install` (or your chosen package manager).
304
304
  3. `pnpm dev:up` to bring up all services. Wait for healthchecks.
305
305
  4. Open MailHog UI at http://localhost:8025 to confirm email capture is wired.
306
- 5. `/dw-create-prd` to draft the first feature.
306
+ 5. `/dw-plan prd` to draft the first feature.
307
307
  6. After your first substantial commit, run `/dw-analyze-project` to enrich `.dw/rules/`.
308
308
  ```
309
309
 
@@ -336,15 +336,15 @@ monorepo: <pnpm-workspaces|turborepo|nx|none>
336
336
 
337
337
  ## Integration With Other dw-* Commands
338
338
 
339
- - **`npx dev-workflow init`** is a hard predecessor. Run order: `init` → `/dw-new-project` → `/dw-create-prd`.
340
- - **`/dw-create-prd`** is the suggested next step after a successful bootstrap.
339
+ - **`npx dev-workflow init`** is a hard predecessor. Run order: `init` → `/dw-new-project` → `/dw-plan prd`.
340
+ - **`/dw-plan prd`** is the suggested next step after a successful bootstrap.
341
341
  - **`/dw-analyze-project`** should run after the first substantial commit to enrich `.dw/rules/` — the bootstrap leaves a minimal seed.
342
- - **`/dw-deps-audit --scan-only`** can run immediately after bootstrap to confirm no vulnerable deps shipped from the `create-*` templates.
343
- - **`/dw-security-check`** runs as part of the standard PRD pipeline after the first feature lands.
342
+ - **`/dw-secure-audit --plan --scan-only`** can run immediately after bootstrap to confirm no vulnerable deps shipped from the `create-*` templates.
343
+ - **`/dw-secure-audit`** runs as part of the standard PRD pipeline after the first feature lands.
344
344
  - **`/dw-dockerize`** is the sister command for retrofitting Docker into an existing project that didn't start with this command.
345
345
 
346
346
  ## Inspired by
347
347
 
348
- `dw-new-project` is dev-workflow-native. The interview pattern borrows from `/dw-create-prd` (Socratic clarification, conditional branching by prior artifact). The execution discipline (per-phase verification, atomic gate before mutation) borrows from `/dw-deps-audit` and `/dw-security-check`. The compose-composition logic is delegated to the `docker-compose-recipes` bundled skill. The wrap-the-official-tool philosophy was confirmed via `/dw-find-skills` against the `npx skills` ecosystem on 2026-04-28 — no skill there matched the "interview + multi-stack scaffold + dev compose" combination at sufficient quality.
348
+ `dw-new-project` is dev-workflow-native. The interview pattern borrows from `/dw-plan prd` (Socratic clarification, conditional branching by prior artifact). The execution discipline (per-phase verification, atomic gate before mutation) borrows from `/dw-secure-audit --plan` and `/dw-secure-audit`. The compose-composition logic is delegated to the `docker-compose-recipes` bundled skill. The wrap-the-official-tool philosophy was confirmed via `/dw-find-skills` against the `npx skills` ecosystem on 2026-04-28 — no skill there matched the "interview + multi-stack scaffold + dev compose" combination at sufficient quality.
349
349
 
350
350
  </system_instructions>
@@ -0,0 +1,175 @@
1
+ <system_instructions>
2
+ You are a planning orchestrator that takes an idea through the full PRD → TechSpec → Tasks pipeline with checkpoints between each stage. Default mode runs all three sequentially; flags allow entering or exiting mid-pipeline.
3
+
4
+ ## When to Use
5
+ - Use when you have an idea and need to produce all three planning artifacts (PRD + TechSpec + Tasks) so `/dw-run` can execute.
6
+ - Use when you want to update one specific stage (e.g., re-run tasks after editing the techspec).
7
+ - Do NOT use for a simple bug fix — `/dw-bugfix` handles that.
8
+ - Do NOT use mid-implementation — once `/dw-run` is in flight, edits go through `/dw-bugfix` or back to `plan techspec --update`.
9
+
10
+ ## Pipeline Position
11
+ **Predecessor:** `/dw-brainstorm` (optional, for ideation) | **Successor:** `/dw-run`
12
+
13
+ ## Modes
14
+
15
+ | Invocation | What runs |
16
+ |------------|-----------|
17
+ | `/dw-plan "<idea>"` | **Default.** PRD → TechSpec → Tasks sequentially, with an explicit user-approval checkpoint between each stage. |
18
+ | `/dw-plan prd "<idea>"` | Only generates the PRD. Stops after user approval. |
19
+ | `/dw-plan techspec` | Assumes a PRD exists at `.dw/spec/prd-<feature>/prd.md`. Generates only the TechSpec. |
20
+ | `/dw-plan tasks` | Assumes PRD + TechSpec exist. Generates only the tasks breakdown. |
21
+ | `/dw-plan --from techspec "<idea>"` | Skips PRD generation (assumes it exists), starts at TechSpec. |
22
+ | `/dw-plan --council "<idea>"` | Default flow plus multi-advisor debate during the TechSpec stage for high-impact architectural decisions. |
23
+
24
+ ## Inputs
25
+
26
+ | Variable | Description | Example |
27
+ |----------|-------------|---------|
28
+ | `{{IDEA}}` | The feature idea or PRD slug being planned | `"users can export invoices to PDF"` or `prd-invoice-export` |
29
+ | `{{MODE}}` | Stage flag (optional) | `prd` / `techspec` / `tasks` / `--from techspec` / `--council` |
30
+
31
+ ## Complementary Skills
32
+
33
+ When available under `./.agents/skills/`, use these as planning support:
34
+
35
+ - `dw-source-grounding`: **ALWAYS** in TechSpec stage — every framework/library decision must cite official docs with version + retrieval date.
36
+ - `dw-ui-discipline`: **REQUIRED** when the PRD has UI surfaces — runs the 4 grounding questions before any visual design lands in the TechSpec.
37
+ - `dw-llm-eval`: **REQUIRED** when the PRD describes an AI feature — an eval-plan subtask is mandatory in the tasks breakdown.
38
+ - `dw-testing-discipline`: applied during the tasks stage — every test-adding task names its invariant per the placement doctrine.
39
+ - `dw-council` (opt-in via `--council`): multi-advisor stress-test on the major architectural decision during TechSpec stage.
40
+ - `dw-codebase-intel`: consulted for API conventions, architecture patterns, naming when designing the TechSpec.
41
+
42
+ ## Constitution Gate
43
+
44
+ <critical>BEFORE any stage, check `.dw/constitution.md`. If MISSING, copy `templates/constitution-template.md` to `.dw/constitution.md` (severity=info defaults), notify the user in chat, and continue. If PRESENT, every FR (PRD), every architectural decision (TechSpec), and every task (Tasks) carries Constitution Alignment metadata mapping to relevant principles or declaring deviation.</critical>
45
+
46
+ ## Codebase Intelligence
47
+
48
+ <critical>If `.dw/intel/` exists, query it via `/dw-intel` before each stage. MANDATORY for TechSpec stage.</critical>
49
+ - PRD stage: `/dw-intel "existing features in the <topic> domain"` to avoid duplicate functionality.
50
+ - TechSpec stage: `/dw-intel "architectural patterns, API conventions, technical decisions"` to align with existing project shape.
51
+ - Tasks stage: `/dw-intel "test patterns, build pipeline, deployment cadence"` for accurate task sizing.
52
+
53
+ If `.dw/intel/` doesn't exist, fall back to `.dw/rules/` and direct grep. Suggest `/dw-intel --build` to populate intel for richer downstream context.
54
+
55
+ ## Stage 1 — PRD generation
56
+
57
+ Runs when default mode OR `plan prd`.
58
+
59
+ ### Prerequisites for this stage
60
+ - Idea or topic from the user.
61
+ - (Optional) brainstorm one-pager from `/dw-brainstorm --onepager` at `.dw/spec/ideas/<slug>.md`.
62
+
63
+ ### Required behavior
64
+
65
+ 1. **Clarification questions (MINIMUM 7).** Before writing anything, ask 7+ focused questions covering: goals, target users, scope boundaries, success metrics, rollout strategy, integration points, edge cases.
66
+ 2. **Web search MINIMUM 3 queries** for market patterns, regulatory context, competitor approaches when relevant.
67
+ 3. **Constitution alignment.** Each functional requirement (FR-N.M) includes a `Constitution Alignment: respects P-NNN, P-MMM` line OR `no applicable principle: <reason>`.
68
+ 4. **Multi-project awareness.** If the feature spans multiple projects in the workspace, consult `.dw/rules/integrations.md` and document scope in the PRD's "Impacted Projects" section.
69
+ 5. **Output location:** `.dw/spec/prd-<feature-slug>/prd.md`.
70
+
71
+ ### Checkpoint
72
+ After PRD is drafted, present a summary to the user (1-page TLDR + open questions). Wait for explicit approval before proceeding to Stage 2.
73
+
74
+ **STOP CONDITIONS:**
75
+ - PRD has unresolved "Open Questions" section → cannot proceed.
76
+ - User wants edits → loop back, regenerate.
77
+ - User declines TechSpec stage → exit (saved PRD remains).
78
+
79
+ ## Stage 2 — TechSpec generation
80
+
81
+ Runs when default mode (after PRD approval) OR `plan techspec` OR `plan --from techspec`.
82
+
83
+ ### Prerequisites for this stage
84
+ - PRD exists at `.dw/spec/prd-<feature-slug>/prd.md` with NO unresolved open questions.
85
+
86
+ ### Required behavior
87
+
88
+ 1. **Hard gate: PRD open questions.** If `.dw/spec/prd-<feature>/prd.md` has an "Open Questions" section with unresolved items, STOP and ask the user to resolve them first.
89
+ 2. **Clarification questions (MINIMUM 7).** Technical questions covering: domain placement, data flow, dependencies, core interfaces, test strategy, reuse-vs-build, multi-project integration if applicable.
90
+ 3. **Web search MINIMUM 3 queries** for technical patterns + Context7 MCP for framework/library specifics.
91
+ 4. **Source grounding (`dw-source-grounding`).** Every framework/library decision ships with `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]`.
92
+ 5. **Constitution gate.** Each architectural decision lists `Respects: P-NNN` or `Deviates: P-NNN — justification: <ADR slug or rationale>`. Deviations from `severity: high/critical` principles without ADR → STOP.
93
+ 6. **API design discipline.** When defining endpoints, consult `dw-codebase-intel/references/api-design-discipline.md` for Hyrum's Law, error semantics, versioning.
94
+ 7. **UI sections** (when feature has UI): the 4 grounding questions from `dw-ui-discipline` must be answered in the techspec; state matrix + scene sentence required.
95
+ 8. **Branch name section:** `feat/prd-<feature-slug>`.
96
+ 9. **Testing strategy section:** explicit tests-per-method, mock setup, coverage targets (80% services, 70% controllers), E2E flows.
97
+ 10. **Output location:** `.dw/spec/prd-<feature-slug>/techspec.md` (same dir as PRD).
98
+
99
+ ### Optional: `--council` flag
100
+
101
+ When `--council` is passed, after the user signals the techspec is near-final BUT before finalizing the major architectural decision, invoke the `dw-council` skill for multi-advisor stress-test (3-5 archetypes with steel-manning). Output appended as "Architectural Debate" section. Decisions hardening from the council become ADRs via `/dw-adr`.
102
+
103
+ ### Checkpoint
104
+ Present TechSpec summary (chosen architecture + key decisions + test strategy + integration points) to user. Wait for explicit approval before Stage 3.
105
+
106
+ ## Stage 3 — Tasks breakdown
107
+
108
+ Runs when default mode (after TechSpec approval) OR `plan tasks`.
109
+
110
+ ### Prerequisites for this stage
111
+ - PRD + TechSpec exist at `.dw/spec/prd-<feature-slug>/`.
112
+
113
+ ### Required behavior
114
+
115
+ 1. **Feature branch instruction:** include the `feat/prd-<feature-slug>` branch creation in the tasks summary.
116
+ 2. **Decompose** PRD + TechSpec into tasks. Target ~6 tasks per feature. **NEVER exceed 2 FRs per task.**
117
+ 3. **End-to-end coverage:** every user-facing flow has backend + frontend + functional UI subtasks if applicable.
118
+ 4. **Test placement (`dw-testing-discipline`):** every test-adding subtask names its invariant per the placement doctrine. Owning layer specified.
119
+ 5. **Constitution alignment:** every task lists `Constitution: respects P-NNN` or `Constitution: deviates P-NNN — ADR planned: <slug>` or `Constitution: n/a — reason: <one-liner>`.
120
+ 6. **LLM-eval subtask (when applicable):** if the PRD has an AI feature, one task must include an Eval Plan subtask (reference dataset path, oracle rungs, judge calibration, target metrics).
121
+ 7. **Dependency declaration:** each task explicitly lists which previous tasks it depends on. Validation rejects cycles.
122
+ 8. **Output locations:**
123
+ - Summary: `.dw/spec/prd-<feature-slug>/tasks.md`
124
+ - Per-task files: `.dw/spec/prd-<feature-slug>/<N>_task.md`
125
+
126
+ ### Final Consistency Check (auto-invoked before user approval)
127
+
128
+ Run 5-dimension check, write `.dw/spec/prd-<feature-slug>/tasks-validation.md`:
129
+
130
+ 1. **FR coverage:** every numbered FR maps to ≥1 task.
131
+ 2. **Task grounding:** every task references ≥1 FR.
132
+ 3. **Test coverage:** every user-facing FR has ≥1 test-adding task.
133
+ 4. **Dependency graph:** topological order valid, no cycles.
134
+ 5. **Constitution alignment:** every task has the alignment line (only if `.dw/constitution.md` exists).
135
+
136
+ Any FAIL → STOP. Show the dimension table in chat. Three options: auto-fix (regenerate affected tasks), manual edit, explicit override with reason.
137
+
138
+ ### Checkpoint
139
+ Present tasks.md summary + per-task list. User approves to allow `/dw-run` execution.
140
+
141
+ ## Output Files Summary
142
+
143
+ After full plan run, the PRD directory contains:
144
+
145
+ ```
146
+ .dw/spec/prd-<feature-slug>/
147
+ ├── prd.md # Stage 1 output
148
+ ├── techspec.md # Stage 2 output
149
+ ├── tasks.md # Stage 3 summary
150
+ ├── 1_task.md, 2_task.md...# Stage 3 per-task files
151
+ ├── tasks-validation.md # Stage 3 consistency check
152
+ └── adrs/ # ADRs created via --council or during stages
153
+ ```
154
+
155
+ ## Anti-patterns
156
+
157
+ - Skipping clarification questions to "save time" — every saved minute upstream costs hours during implementation.
158
+ - Generating TechSpec from a PRD with open questions → 90% chance of techspec rewrites.
159
+ - Generating tasks before techspec is approved → tasks miss architecture context.
160
+ - Skipping the consistency check because tasks "look fine" → FR drift, missing tests caught later.
161
+ - Multiple PRDs for related work in separate dirs → merge into one PRD with multiple FRs if they share users/journey.
162
+
163
+ ## Override / advanced
164
+
165
+ - `--no-checkpoint` (default mode): skip user-approval gates between stages. Use ONLY for non-interactive automation (CI generating starter specs). Risk: low-quality output goes through unchallenged.
166
+ - `--regenerate <stage>`: rerun only one stage on existing artifacts. Useful when you edit the PRD and want techspec regenerated.
167
+
168
+ ## Final Guidelines
169
+
170
+ - Each stage has its own clarification question quota — don't recycle. Different stages need different framing.
171
+ - Web search is mandatory; Context7 MCP for libraries. No skipping for "I think I know the latest version."
172
+ - Constitution gate runs at every stage entry; defaults are auto-installed when missing (never blocks).
173
+ - All three stages produce committed Markdown — these are the canonical planning artifacts. They evolve with the feature.
174
+
175
+ </system_instructions>
@@ -0,0 +1,166 @@
1
+ <system_instructions>
2
+ You are the QA orchestrator. Two modes: run QA against the implementation (UI or API), or enter the QA + fix-retest loop until bugs are clear. Both modes apply the same testing-discipline gates.
3
+
4
+ ## When to Use
5
+ - Use after `/dw-run` finishes and the implementation is verified (lint+test+build green via `dw-verify`).
6
+ - Use before `/dw-review` to gather behavioral evidence beyond unit tests.
7
+ - Use after every PRD-significant change to confirm production-equivalent behavior.
8
+ - Do NOT use during active task implementation (use `/dw-run` which has its own Level 1 validation).
9
+ - Do NOT use for unit-test runs (use the project's test command directly).
10
+
11
+ ## Pipeline Position
12
+ **Predecessor:** `/dw-run` (implementation complete) | **Successor:** `/dw-review` then `/dw-commit` + `/dw-generate-pr`
13
+
14
+ ## Modes
15
+
16
+ | Invocation | What runs |
17
+ |------------|-----------|
18
+ | `/dw-qa` | **Default.** Mode-aware QA pass (UI or API auto-detected). Generates evidence (screenshots/JSONL logs), writes `QA/qa-report.md` + `QA/bugs.md`. Does NOT fix bugs. |
19
+ | `/dw-qa --fix` | QA pass followed by an iterative fix+retest loop. Each detected bug → root-cause → fix → retest with evidence → mark resolved. Continues until all bugs marked Closed or user accepts a deferred list. |
20
+ | `/dw-qa --api` | Forces API-only mode (skips UI even when frontend dependencies are present). Useful for backend-only sub-features in fullstack repos. |
21
+ | `/dw-qa --ai` | Adds AI feature evaluation against the reference dataset at `.dw/eval/datasets/<feature>/`. Computes precision@k / faithfulness / outcome accuracy per the feature type. Logs JSONL to `QA/logs/ai/`. |
22
+
23
+ ## Mode auto-detection
24
+
25
+ The default `/dw-qa` inspects the project to choose UI vs API:
26
+
27
+ - **UI mode** if package.json has `playwright`, `next`, `react`, `vue`, or similar frontend dependencies AND a server can be started.
28
+ - **API mode** if no frontend deps are detected OR forced via `--api`.
29
+ - **AI mode** adds on top of UI or API via `--ai` flag — runs alongside the chosen interaction mode.
30
+
31
+ ## Inputs
32
+
33
+ | Variable | Description | Example |
34
+ |----------|-------------|---------|
35
+ | `{{PRD_PATH}}` | Path to PRD directory containing tasks (auto-detect from active branch if omitted) | `.dw/spec/prd-invoice-export` |
36
+ | `{{MODE}}` | `--fix` / `--api` / `--ai` (optional; default = auto-detect) | — |
37
+
38
+ ## Complementary Skills
39
+
40
+ When available under `./.agents/skills/`, these are invoked operationally:
41
+
42
+ - `dw-testing-discipline`: **(UI mode — ALWAYS)** — core rules and 25 anti-patterns apply to every QA test authored. `references/playwright-recipes.md` for tactical patterns. `references/three-workflow-patterns.md` to pick the right verification mode (UI / network / perf). `references/security-boundary.md` for any flow that crosses an auth boundary.
43
+ - `api-testing-recipes`: **(API mode — ALWAYS)** — validated snippets for `.http`, pytest+httpx, supertest, WebApplicationFactory, reqwest. Composes per-FR test files in `QA/scripts/api/` and JSONL logs in `QA/logs/api/`.
44
+ - `dw-llm-eval`: **(AI mode — when invoked with `--ai`)** — runs reference dataset against current implementation. Computes precision@k / faithfulness / outcome accuracy. Logs JSONL to `QA/logs/ai/<feature>-<date>.jsonl`. Alerts on >10% metric regression vs prior run.
45
+ - `dw-debug-protocol`: **(in `--fix` mode — ALWAYS)** — six-step triage (Reproduce → Localize → Reduce → Fix Root Cause → Guard → Verify End-to-End) for each detected bug. Stop-the-line discipline; root-cause over symptom; regression test in same atomic commit.
46
+ - `vercel-react-best-practices`: (UI mode) when React/Next.js regression risk is suspected.
47
+ - `dw-ui-discipline`: (UI mode) when validating design consistency — anti-slop catalog + WCAG accessibility floor check.
48
+ - `dw-verify`: **(in `--fix` mode — ALWAYS)** — before marking any bug `Fixed` or `Closed`, requires VERIFICATION REPORT PASS (test + lint + build) AND retest evidence (screenshot in UI mode, JSONL log in API mode, eval-run delta in AI mode).
49
+
50
+ ## Output Structure
51
+
52
+ ```
53
+ .dw/spec/<prd>/QA/
54
+ ├── qa-report.md # Test plan + execution summary
55
+ ├── bugs.md # Bug catalog with status
56
+ ├── scripts/
57
+ │ ├── ui/<RF>-<slug>.spec.ts # Playwright scripts (UI mode)
58
+ │ ├── api/<RF>-<slug>.http # API test files
59
+ │ └── ai/<feature>-eval.ts # AI eval scripts (--ai mode)
60
+ ├── evidence/
61
+ │ ├── ui/ # Screenshots per RF + retests
62
+ │ └── ...
63
+ └── logs/
64
+ ├── api/<RF>-<slug>.log # JSONL request/response per call
65
+ └── ai/<feature>-<date>.jsonl # AI eval results
66
+ ```
67
+
68
+ ## Mode 1: Default (`/dw-qa`)
69
+
70
+ ### Behavior — UI mode
71
+
72
+ 1. **Pre-flight**: confirm the project dev server can run. Confirm `.dw/spec/<prd>/` has the PRD + TechSpec + tasks.
73
+ 2. **Map FRs to test plan**: for each FR, identify the user-facing flow that exercises it.
74
+ 3. **Drive Playwright MCP** (or fallback to local Playwright per `dw-testing-discipline/references/playwright-recipes.md`):
75
+ - Happy paths for each FR.
76
+ - Edge cases (boundary inputs, network failure, validation errors).
77
+ - Negative flows (unauthorized actions, malformed input).
78
+ - Regressions (smoke check on adjacent surfaces).
79
+ - WCAG 2.2 accessibility check per `dw-ui-discipline/references/accessibility-floor.md`.
80
+ 4. **Capture evidence**: screenshots at 375px mobile + 1440px desktop, console logs, network HARs.
81
+ 5. **Detect stub/placeholder pages**: any page that looks "TODO" or has obvious dummy content → flag as a bug.
82
+ 6. **Write `qa-report.md`**: test plan, execution log, evidence references, bug count by severity.
83
+ 7. **Write `bugs.md`**: one entry per bug found, with severity, repro steps, evidence link, status (`Open`).
84
+
85
+ ### Behavior — API mode
86
+
87
+ 1. **Pre-flight**: confirm API server can run. Confirm OpenAPI spec exists or design from PRD endpoints.
88
+ 2. **Compose test files per FR** via `api-testing-recipes`:
89
+ - Detect stack (TS/Python/C#/Rust) → pick the matching recipe.
90
+ - Generate `.http` file or pytest+httpx / supertest / WebApplicationFactory / reqwest script.
91
+ - Test matrix per FR: {200 happy / 4xx validation / 4xx auth / 4xx authz / 4xx not-found / 4xx conflict / 5xx / contract drift / cross-tenant denial}.
92
+ 3. **Optional `--from-openapi`**: derive baseline from project's OpenAPI spec.
93
+ 4. **Execute scripts**: run each test; capture JSONL request/response to `QA/logs/api/<RF>-<slug>.log`.
94
+ 5. **Detect unmapped endpoints**: endpoints in spec that no test exercises → flag.
95
+ 6. **Write `qa-report.md` + `bugs.md`** with API-mode evidence.
96
+
97
+ ### Behavior — AI mode (additive via `--ai`)
98
+
99
+ 1. Locate `.dw/eval/datasets/<feature>/cases.jsonl`. If missing → STOP and ask user to define the dataset via `dw-llm-eval`.
100
+ 2. Run the dataset against the current implementation per the feature type:
101
+ - RAG: precision@k + faithfulness + context utilization.
102
+ - Agent: outcome assertion + trajectory match (per `--ai-mode` parameter or feature config).
103
+ - Classification: exact match accuracy.
104
+ 3. Log JSONL to `QA/logs/ai/<feature>-<date>.jsonl`.
105
+ 4. Compare to prior run's JSONL — alert on >10% regression in any metric.
106
+ 5. Append AI-mode section to `qa-report.md`.
107
+
108
+ ## Mode 2: Fix loop (`/dw-qa --fix`)
109
+
110
+ ### Behavior
111
+
112
+ After the default QA pass produces `bugs.md`, enter an iterative loop:
113
+
114
+ 1. **For each Open bug, in severity order (critical → high → medium → low):**
115
+ - Apply `dw-debug-protocol` six-step triage.
116
+ - Reproduce → Localize → Reduce → Fix → Guard (regression test) → Verify E2E.
117
+ - Implementation lives in the appropriate task's file; commit message references the bug ID.
118
+ - `dw-verify` runs before commit (test + lint + build PASS required).
119
+ 2. **Retest** with mode-aware evidence:
120
+ - UI mode: re-run the Playwright flow; capture retest screenshot to `QA/evidence/ui/`.
121
+ - API mode: re-run the `.http`/recipe script; append `verdict: PASS|FAIL` JSONL line to `QA/logs/api/BUG-NN-retest.log`.
122
+ - AI mode: re-run the eval dataset; verify metric is back in range.
123
+ 3. **Update `bugs.md`** with status: `Fixed` (retest PASS + verify PASS) or `Reopened` (retest FAIL).
124
+ 4. **Continue until `bugs.md` shows all bugs `Fixed` OR `Closed`** OR user accepts a deferred list of remaining bugs.
125
+
126
+ ## Constitution + verification gates
127
+
128
+ <critical>
129
+ - `dw-verify` PASS required before any bug status flips to `Fixed`/`Closed`.
130
+ - Constitution principles with `severity: high/critical` apply: if a fix violates an existing principle without an ADR, the fix is REJECTED and the bug returns to `Open`.
131
+ - For `--ai` mode: a metric regression > 20% blocks the QA verdict until the regression is investigated (don't just lower the bar).
132
+ </critical>
133
+
134
+ ## Reporting
135
+
136
+ `qa-report.md` final section:
137
+
138
+ ```markdown
139
+ ## Verdict
140
+
141
+ - Mode(s): UI / API / AI
142
+ - FRs tested: N / M
143
+ - Bugs found: critical X | high X | medium X | low X
144
+ - Bugs fixed (in --fix mode): N / M
145
+ - Bugs Open: N (deferred per user)
146
+ - Verify status: PASS / FAIL
147
+ - Constitution compliance: PASS / VIOLATIONS LISTED
148
+ - Final QA verdict: APPROVED / APPROVED WITH DEFERRED BUGS / REJECTED
149
+ ```
150
+
151
+ ## Anti-patterns
152
+
153
+ - Skipping evidence capture because "the test passed visually" — without screenshots/logs, retest later is guesswork.
154
+ - Marking bugs `Fixed` without re-running the QA flow that originally caught them.
155
+ - Lowering the bar in `--ai` mode when metrics regress — investigate, don't accept silent quality drop.
156
+ - Auto-retrying flaky tests until green — applies `dw-testing-discipline/flaky-discipline.md` quarantine instead.
157
+ - Running `/dw-qa --fix` without `/dw-qa` first — produces fixes for bugs that weren't reproduced cleanly.
158
+
159
+ ## Final Guidelines
160
+
161
+ - QA is mode-aware. Trust the auto-detection; override only when explicitly needed (`--api`, `--ai`).
162
+ - Evidence is non-negotiable: screenshots, JSONL logs, or eval-run deltas per mode.
163
+ - `--fix` mode is the loop. Run it as many cycles as needed until bugs.md is clean.
164
+ - Reference datasets for `--ai` mode evolve with the feature — add cases from real failures observed during QA.
165
+
166
+ </system_instructions>
@@ -3,19 +3,19 @@ You are a frontend redesign specialist for the current workspace. This command e
3
3
 
4
4
  <critical>Do NOT redesign without first auditing the current implementation. Always read the code and capture the visual state before proposing changes.</critical>
5
5
  <critical>ALWAYS propose design directions and wait for user approval before implementing any changes.</critical>
6
- <critical>Preserve existing functionality. Redesign is visual/UX, not behavioral. If the change alters behavior, redirect to `/dw-create-prd`.</critical>
6
+ <critical>Preserve existing functionality. Redesign is visual/UX, not behavioral. If the change alters behavior, redirect to `/dw-plan prd`.</critical>
7
7
  <critical>MOBILE FIRST is MANDATORY. Every design proposal MUST include both mobile AND desktop versions. Implementation MUST start with mobile and then adapt for desktop. Do NOT present only the desktop layout — if the proposal does not show how it looks on mobile, it is incomplete.</critical>
8
8
 
9
9
  ## When to Use
10
10
  - Use for rebuild/modernization of existing pages or components
11
11
  - Use for design refresh, design system migration, or style overhaul
12
- - Do NOT use for new features (use `/dw-create-prd`)
12
+ - Do NOT use for new features (use `/dw-plan prd`)
13
13
  - Do NOT use for bug fixes (use `/dw-bugfix`)
14
14
  - Do NOT use for open-ended idea exploration (use `/dw-brainstorm`)
15
15
 
16
16
  ## Pipeline Position
17
17
  **Predecessor:** `/dw-brainstorm` (optional) | `/dw-analyze-project` (recommended)
18
- **Successor:** `/dw-run-qa` | `/dw-code-review`
18
+ **Successor:** `/dw-qa` | `/dw-review --code-only`
19
19
 
20
20
  ## Decision Flowchart
21
21
 
@@ -27,7 +27,7 @@ digraph redesign_decision {
27
27
  Q2 [label="Is there a specific\ntarget page or component?"];
28
28
  node [shape=box];
29
29
  REDESIGN [label="Use\n/dw-redesign-ui"];
30
- PRD [label="Use\n/dw-create-prd"];
30
+ PRD [label="Use\n/dw-plan prd"];
31
31
  BRAINSTORM [label="Start with\n/dw-brainstorm"];
32
32
  Q1 -> PRD [label="No (changes behavior)"];
33
33
  Q1 -> Q2 [label="Yes"];
@@ -69,7 +69,7 @@ Use diagnostic tools based on the project's framework:
69
69
  <critical>If `.dw/intel/` exists, querying it via `/dw-intel` is MANDATORY in the audit phase to surface existing UI patterns.</critical>
70
70
 
71
71
  - Audit phase: internally run `/dw-intel "UI components, design patterns, layout conventions"` before proposing redesign directions
72
- - The design contract (`.dw/spec/prd-[name]/design-contract.md`) is the single source of truth for visual consistency — it's read by `/dw-run-task` and `/dw-run-plan` and persists across sessions naturally (no separate registration needed)
72
+ - The design contract (`.dw/spec/prd-[name]/design-contract.md`) is the single source of truth for visual consistency — it's read by `/dw-run` and `/dw-run` and persists across sessions naturally (no separate registration needed)
73
73
  - If `.dw/intel/` does NOT exist, fall back to `.dw/rules/` and direct grep over `apps/web/src/` (or equivalent frontend root)
74
74
 
75
75
  ## Preferred Response Format
@@ -124,6 +124,6 @@ Depending on the request, this command may produce:
124
124
  At the end, always leave the user in one of these situations:
125
125
  - With a completed redesign + validation evidence
126
126
  - With a design proposal awaiting approval
127
- - With a next workspace command to follow (`/dw-run-qa`, `/dw-code-review`, `/dw-commit`)
127
+ - With a next workspace command to follow (`/dw-qa`, `/dw-review --code-only`, `/dw-commit`)
128
128
 
129
129
  </system_instructions>
@@ -0,0 +1,198 @@
1
+ <system_instructions>
2
+ You are the review orchestrator. Runs both Level 2 (PRD compliance / coverage) and Level 3 (code quality / security / conventions) reviews in sequence. Default runs both; flags allow either alone. This was previously two separate commands (review-implementation + code-review) that chained automatically in v0.10 — now consolidated for clarity.
3
+
4
+ ## When to Use
5
+ - Use after `/dw-run` completes a task or plan, BEFORE `/dw-commit` + `/dw-generate-pr`.
6
+ - Use to audit existing implementation against PRD.
7
+ - Use in CI as a quality gate.
8
+ - Do NOT use during active development (use directly with the linter/test runner).
9
+ - Do NOT use on partial work (review-implementation needs the implementation to actually exist).
10
+
11
+ ## Pipeline Position
12
+ **Predecessor:** `/dw-run` | **Successor:** `/dw-commit` + `/dw-generate-pr`
13
+
14
+ ## Modes
15
+
16
+ | Invocation | What runs |
17
+ |------------|-----------|
18
+ | `/dw-review` | **Default.** Level 2 (PRD coverage) + Level 3 (code quality) in sequence. Consolidated report saved to `.dw/spec/<prd>/QA/review-consolidated.md`. |
19
+ | `/dw-review --coverage-only` | Only Level 2 — maps every PRD requirement to the code that delivers it. Skips code quality. |
20
+ | `/dw-review --code-only` | Only Level 3 — code quality / convention / security checks. Skips PRD mapping. |
21
+
22
+ ## Inputs
23
+
24
+ | Variable | Description | Example |
25
+ |----------|-------------|---------|
26
+ | `{{PRD_PATH}}` | Path to PRD directory (auto-detect from active branch if omitted) | `.dw/spec/prd-invoice-export` |
27
+ | `{{MODE}}` | `--coverage-only` / `--code-only` (optional; default = both) | — |
28
+
29
+ ## Complementary Skills
30
+
31
+ When available under `./.agents/skills/`, these are invoked as analytical support:
32
+
33
+ - `dw-review-rigor`: **ALWAYS** — applies de-duplication (same pattern in N files = 1 finding), severity ordering (critical → high → medium → low), verify-before-flag, skip-what-linter-catches, and signal-over-volume. The "Issues Found" table follows this discipline.
34
+ - `dw-verify`: **ALWAYS** — invoked before emitting `APPROVED` or `APPROVED WITH CAVEATS`. Without a VERIFICATION REPORT PASS (test + lint + build), verdict cannot be APPROVED.
35
+ - `dw-secure-audit`: **ALWAYS for TS/Python/C#/Rust projects** — security gate. If the project uses a supported language and a recent `secure-audit.md` is missing OR has REJECTED status, the verdict is **REJECTED** — no exception.
36
+ - `dw-simplification`: use when the diff touches dense or twisty code — applies Chesterton's Fence, behavior-preserving refactor protocol, complexity metrics.
37
+ - `dw-ui-discipline`: use when the diff touches UI — runs the 14 visual-slop patterns + accessibility floor checks.
38
+ - `dw-testing-discipline`: use when the diff touches tests — applies the 25 anti-patterns catalog + 6 agent guardrails (when tests were agent-authored).
39
+ - `dw-llm-eval`: **REQUIRED when the diff touches AI/LLM feature code paths**. Reference dataset + ≥2 oracle rungs + judge calibration (if rung 4 used) + eval run results MUST be in the PR. Missing → REJECTED.
40
+ - `security-review`: use when the diff touches auth, authorization, external input, upload, SQL, secrets, SSRF, XSS, or sensitive surfaces.
41
+ - `vercel-react-best-practices`: use when the diff touches React/Next.js.
42
+
43
+ ## Constitution Gate
44
+
45
+ <critical>BEFORE the review starts, check `.dw/constitution.md`. If MISSING, auto-install defaults. If PRESENT, every principle is checked against the diff. Severity-graded enforcement:
46
+ - `severity: info` violations → reported, no block.
47
+ - `severity: high` / `critical` violations without ADR justifying → **REJECTED**.</critical>
48
+
49
+ ## Codebase Intelligence
50
+
51
+ <critical>If `.dw/intel/` exists, query via `/dw-intel` before reviewing.</critical>
52
+ - `/dw-intel "documented conventions and anti-patterns"` before Level 3 to prioritize findings that violate documented patterns.
53
+ - `/dw-intel "tech debt and known technical decisions"` to distinguish intentional architecture from drift.
54
+
55
+ ## Level 2 — PRD coverage mapping (runs unless `--code-only`)
56
+
57
+ **Goal:** every documented requirement (FR / TechSpec section / Task) maps to specific code that delivers it.
58
+
59
+ ### Behavior
60
+
61
+ 1. **Load artifacts:**
62
+ - `.dw/spec/<prd>/prd.md` → extract functional requirements.
63
+ - `.dw/spec/<prd>/techspec.md` → extract architectural decisions.
64
+ - `.dw/spec/<prd>/tasks.md` + per-task files → extract committed work.
65
+ - `tasks-validation.md` → carry forward dimension status.
66
+
67
+ 2. **Map each FR to code:**
68
+ - For each `FR-N.M`, find code that delivers it (file path + line range + commit SHA).
69
+ - For each TechSpec section, find code that implements it.
70
+ - For each task, verify the FRs it claimed to cover are actually delivered.
71
+
72
+ 3. **Identify gaps:**
73
+ - Orphan FRs: declared in PRD but no code implements them.
74
+ - Orphan code: code changes not traceable to any FR/task (scope creep).
75
+ - Incomplete implementations: FR partially delivered (e.g., happy path only).
76
+
77
+ 4. **Compare against acceptance criteria** from per-task files. Run actual smoke checks where feasible.
78
+
79
+ ### Output
80
+
81
+ Saved to `.dw/spec/<prd>/QA/review-coverage.md`:
82
+
83
+ ```markdown
84
+ # Coverage Review
85
+
86
+ ## Status by Functional Requirement
87
+
88
+ | FR | Description | Status | Evidence | Commit |
89
+ |----|-------------|--------|----------|--------|
90
+ | FR-1.1 | User can export PDF | DELIVERED | src/pdf/export.ts:42-80 | abc123 |
91
+ | FR-1.2 | Export shows progress | PARTIAL | UI exists, no E2E test | def456 |
92
+ | FR-2.1 | Email notification on completion | MISSING | (no code found) | — |
93
+
94
+ ## Orphan Code (not traceable to any FR)
95
+ - src/utils/cache.ts (new file, no FR reference)
96
+
97
+ ## Verdict
98
+ - DELIVERED: N FRs (X%)
99
+ - PARTIAL: N FRs (X%)
100
+ - MISSING: N FRs (X%)
101
+ - Orphan code: N files
102
+ ```
103
+
104
+ If MISSING > 0, the verdict suggests revisiting `/dw-plan tasks` to scope or `/dw-run` to add the missing implementations.
105
+
106
+ ## Level 3 — Code quality + conventions + security (runs unless `--coverage-only`)
107
+
108
+ **Goal:** the code that exists meets quality, conventions, security, and constitution standards.
109
+
110
+ ### Behavior
111
+
112
+ 1. **Diff analysis:** identify what changed since the PRD branch was created (`git diff <base-branch>...HEAD`).
113
+
114
+ 2. **Rules conformance** (against `.dw/rules/`):
115
+ - General patterns: no `any` types in TS, no `console.log` in prod, error handling, multi-tenancy.
116
+ - Backend patterns from `.dw/rules/<backend>.md`: Clean Architecture, use-case return types, DTOs, parameterized queries.
117
+ - Frontend patterns from `.dw/rules/<frontend>.md`: Server Components default, forms patterns, design system.
118
+
119
+ 3. **Constitution compliance** (against `.dw/constitution.md`):
120
+ - For each principle, check diff for violations per the principle's Enforcement line.
121
+ - Severity-graded: info → low, high → critical+REJECTED-unless-ADR, critical → critical+REJECTED-unless-ADR-with-approval.
122
+
123
+ 4. **Code quality** (via `dw-review-rigor` discipline):
124
+ - SOLID violations.
125
+ - Cyclomatic / cognitive complexity (with `dw-simplification` thresholds).
126
+ - DRY violations (only when impact is meaningful — not premature deduplication).
127
+ - Code smells (Fowler taxonomy).
128
+
129
+ 5. **Test execution:**
130
+ - Run the project's test command.
131
+ - Verify coverage targets per TechSpec (80% services, 70% controllers).
132
+
133
+ 6. **Apply `dw-review-rigor`:**
134
+ - De-duplicate findings.
135
+ - Sort by severity.
136
+ - Verify intent before flagging (the linter already catches some — those don't repeat).
137
+
138
+ 7. **Final verification (`dw-verify`):**
139
+ - Run dw-verify to produce a VERIFICATION REPORT (test + lint + build all GREEN).
140
+ - Without PASS, verdict cannot be APPROVED.
141
+
142
+ 8. **Security Layer (`dw-secure-audit` for TS/Python/C#/Rust):**
143
+ - Run `/dw-secure-audit` against the PR. Latest scan must be present and not REJECTED.
144
+ - If language is supported and audit is missing OR REJECTED → verdict **REJECTED**.
145
+
146
+ ### Output
147
+
148
+ Saved to `.dw/spec/<prd>/QA/dw-review --code-only.md`. The verdict line is one of:
149
+ - **APPROVED** — all gates green; ready for commit + PR.
150
+ - **APPROVED WITH CAVEATS** — green but findings worth fixing in follow-up (filed with severities).
151
+ - **REJECTED** — at least one hard gate failed. Specify which.
152
+
153
+ ## Consolidated output (default mode)
154
+
155
+ When both levels run, a consolidated report at `.dw/spec/<prd>/QA/review-consolidated.md`:
156
+
157
+ ```markdown
158
+ # Consolidated Review
159
+
160
+ **Level 2 (Coverage):** DELIVERED N | PARTIAL N | MISSING N
161
+ **Level 3 (Quality):** APPROVED | APPROVED WITH CAVEATS | REJECTED
162
+ **Verification Report:** PASS
163
+ **Security Audit:** PASS (or REJECTED with reasons)
164
+ **Constitution Compliance:** PASS (or violations listed)
165
+
166
+ ## Overall Verdict
167
+ <line>
168
+
169
+ ## Findings Summary
170
+ | Severity | Count | Reports |
171
+ |----------|-------|---------|
172
+ | critical | N | review-coverage.md, dw-code-review.md |
173
+ | high | N | dw-code-review.md |
174
+ | medium | N | dw-code-review.md |
175
+ | low | N | review-coverage.md, dw-code-review.md |
176
+
177
+ ## Next Steps
178
+ - If APPROVED: proceed to `/dw-commit` + `/dw-generate-pr`.
179
+ - If REJECTED: fix the blocking findings, re-run `/dw-review`.
180
+ - If gaps in coverage: revisit `/dw-plan tasks --update` or `/dw-run <missing-task>`.
181
+ ```
182
+
183
+ ## Anti-patterns
184
+
185
+ - Skipping `dw-verify` to "ship the review faster" — produces APPROVED verdicts on broken code.
186
+ - Issuing APPROVED with KNOWN critical findings deferred to "next sprint" — that's REJECTED with a workaround plan.
187
+ - Flagging linter-level findings as review findings (duplicates the linter; noise).
188
+ - Suggesting refactors that aren't in scope of the PRD (use `/dw-brainstorm --refactor` separately if you want a refactor agenda).
189
+ - Generating the report without actually running the test/build/lint suite — verdict is decorative without evidence.
190
+
191
+ ## Final Guidelines
192
+
193
+ - Both levels run by default unless flags specify otherwise. Most PRs need both.
194
+ - The consolidated verdict is the single number to trust. Individual level reports drill down.
195
+ - Findings are signal, not volume. `dw-review-rigor` enforces this.
196
+ - Hard gates (verify, secure-audit, constitution high+critical) are non-negotiable. ADR is the only escape.
197
+
198
+ </system_instructions>