@brunosps00/dev-workflow 1.0.0 → 1.0.2

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 (36) hide show
  1. package/README.md +18 -9
  2. package/lib/constants.js +10 -6
  3. package/lib/init.js +28 -0
  4. package/package.json +1 -1
  5. package/scaffold/en/agent-instructions.md +28 -3
  6. package/scaffold/en/commands/dw-analyze-project.md +64 -0
  7. package/scaffold/en/commands/dw-autopilot.md +64 -5
  8. package/scaffold/en/commands/dw-brainstorm.md +166 -23
  9. package/scaffold/en/commands/dw-bugfix.md +124 -26
  10. package/scaffold/en/commands/dw-intel.md +30 -3
  11. package/scaffold/en/commands/dw-pause.md +92 -0
  12. package/scaffold/en/commands/dw-qa.md +87 -11
  13. package/scaffold/en/commands/dw-resume.md +90 -0
  14. package/scaffold/en/commands/dw-review.md +22 -12
  15. package/scaffold/en/templates/bugfix-summary-template.md +66 -0
  16. package/scaffold/en/templates/concerns-template.md +59 -0
  17. package/scaffold/en/templates/state-template.md +59 -0
  18. package/scaffold/pt-br/agent-instructions.md +28 -3
  19. package/scaffold/pt-br/commands/dw-analyze-project.md +64 -0
  20. package/scaffold/pt-br/commands/dw-autopilot.md +64 -5
  21. package/scaffold/pt-br/commands/dw-brainstorm.md +166 -23
  22. package/scaffold/pt-br/commands/dw-bugfix.md +134 -18
  23. package/scaffold/pt-br/commands/dw-intel.md +30 -3
  24. package/scaffold/pt-br/commands/dw-pause.md +92 -0
  25. package/scaffold/pt-br/commands/dw-qa.md +87 -11
  26. package/scaffold/pt-br/commands/dw-resume.md +90 -0
  27. package/scaffold/pt-br/commands/dw-review.md +22 -12
  28. package/scaffold/pt-br/templates/bugfix-summary-template.md +66 -0
  29. package/scaffold/pt-br/templates/concerns-template.md +59 -0
  30. package/scaffold/pt-br/templates/state-template.md +59 -0
  31. package/scaffold/skills/dw-codebase-intel/SKILL.md +9 -5
  32. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +52 -0
  33. package/scaffold/skills/dw-memory/SKILL.md +26 -1
  34. package/scaffold/skills/dw-memory/references/context-budget.md +63 -0
  35. package/scaffold/skills/dw-simplification/SKILL.md +10 -5
  36. package/scaffold/skills/dw-simplification/references/deep-modules.md +105 -0
@@ -0,0 +1,92 @@
1
+ <system_instructions>
2
+ You are a session-handoff agent. Your job is to consolidate the current session's mental state into `.dw/STATE.md` so the next session (yours or a teammate's) can resume without losing context.
3
+
4
+ ## When to Use
5
+ - Use when the user says "pause work", "end session", "I need to stop for now", "save what we're doing"
6
+ - Use proactively before a long break, before switching projects, or before a context window is about to be compacted
7
+ - Do NOT use mid-task when nothing has been decided or learned (nothing to consolidate)
8
+ - Do NOT use as a substitute for `/dw-commit` — STATE.md is mental state, not code changes
9
+
10
+ ## Pipeline Position
11
+ **Predecessor:** any working session | **Successor:** `/dw-resume` (in a future session)
12
+
13
+ ## What this command does NOT do
14
+ - It does NOT commit code (use `/dw-commit`)
15
+ - It does NOT replace per-PRD `MEMORY.md` (workflow memory for a single feature lives there; `dw-memory` skill manages it)
16
+ - It does NOT promote anything to ADRs (use `/dw-adr` for durable architectural decisions)
17
+
18
+ ## File Location
19
+ - Single artifact: `.dw/STATE.md` (project-level, not per-PRD)
20
+ - Template: `.dw/templates/state-template.md` (used only on first creation)
21
+
22
+ ## Workflow
23
+
24
+ ### 1. Ensure STATE.md exists
25
+ - If `.dw/STATE.md` is missing, copy `.dw/templates/state-template.md` to `.dw/STATE.md`. Notify in chat: "STATE.md not found — initialized from template."
26
+ - If `.dw/templates/state-template.md` is also missing (very old project), create a minimal STATE.md with the required sections (Open Loops, Decisions, Blockers, Todos, Deferred Ideas, Lessons, Preferences, Notes).
27
+
28
+ ### 2. Survey the session
29
+ Read the conversation context and identify, **without inventing**:
30
+
31
+ - **Open loops**: tasks/work started but not finished (e.g. "PRD `prd-foo` is at TechSpec stage, awaiting user approval"; "Task 3 of `prd-bar` failing on lint")
32
+ - **Decisions made**: choices the user and agent agreed on during the session that affect future work
33
+ - **Blockers encountered**: things that stopped forward motion (waiting on input, broken tooling, knowledge gap)
34
+ - **Todos** mentioned in passing that don't yet have a PRD or task file
35
+ - **Ideas explored and parked** (with the reason for parking)
36
+ - **Lessons learned** — small operational lessons worth recording
37
+ - **Preferences expressed** — conventions the user wants applied going forward
38
+
39
+ ### 3. Merge into STATE.md
40
+
41
+ <critical>NEVER overwrite STATE.md blindly. Read the existing file, parse the sections, and merge: append new items, do not delete old ones unless the user explicitly asked you to.</critical>
42
+
43
+ Rules:
44
+ - Each new entry gets a date prefix `YYYY-MM-DD` (use today's date).
45
+ - Use bullet lists. Keep each item to one line where possible; two lines if context is essential.
46
+ - If a section ends up with `_none_` placeholder and you have nothing to add, keep `_none_`.
47
+ - Update the `last_paused` frontmatter field to today's date (YYYY-MM-DD).
48
+
49
+ ### 4. Compaction pass (when STATE.md is large)
50
+
51
+ If after merging STATE.md exceeds **~6KB** or any single section exceeds **20 items**, compact:
52
+
53
+ - **Open Loops resolved during the session**: remove them.
54
+ - **Todos completed during the session**: remove them.
55
+ - **Decisions older than 30 days that have been formalized into ADRs or constitution**: remove (the ADR is the durable record).
56
+ - **Lessons older than 60 days**: keep only those still relevant; drop dated tactical advice.
57
+ - **Deferred Ideas older than 90 days with no revisit trigger**: ask the user before dropping.
58
+
59
+ If compaction removes more than 5 items, list them in chat so the user can veto.
60
+
61
+ ### 5. Report
62
+
63
+ Present a brief summary to the user:
64
+
65
+ ```
66
+ ## Session Paused
67
+
68
+ Updated `.dw/STATE.md`:
69
+ - Open Loops: +N (now: X total)
70
+ - Decisions: +N
71
+ - Blockers: +N (Y unresolved)
72
+ - Todos: +N (Z total)
73
+ - Deferred: +N
74
+
75
+ [If compaction ran: lines removed and why]
76
+
77
+ Resume with `/dw-resume` next session.
78
+ ```
79
+
80
+ ## Required Behavior
81
+
82
+ <critical>NEVER fabricate state. If you don't see evidence of a blocker or decision in the conversation, don't add it. Empty sections are fine.</critical>
83
+
84
+ <critical>NEVER touch per-PRD memory files (`.dw/spec/*/MEMORY.md`, `.dw/spec/*/tasks/*_memory.md`). Those are managed by `dw-memory` skill and are PRD-local.</critical>
85
+
86
+ <critical>NEVER drop user content silently. If you compact, you list what you removed.</critical>
87
+
88
+ ## Inspired by
89
+
90
+ This command adapts the session-handoff pattern from [`tech-leads-club/agent-skills/tlc-spec-driven`](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) (CC-BY-4.0, Felipe Rodrigues). Adaptations: `.dw/STATE.md` location instead of `.specs/project/STATE.md`, explicit compaction protocol, frontmatter with `last_paused` / `last_resumed` for ordering signals, complementarity with the existing `dw-memory` skill.
91
+
92
+ </system_instructions>
@@ -19,6 +19,8 @@ You are the QA orchestrator. Two modes: run QA against the implementation (UI or
19
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
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
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
+ | `/dw-qa --uat` | **Interactive UAT walkthrough.** The agent walks the user through the feature step-by-step, asking targeted questions ("does this match expectation?", "what's the expected behavior in case X?"). No Playwright auto-driving, no AI eval. Output: `QA/uat-report.md`. Used after `--fix` (or instead of `/dw-qa` for primarily-judgment-bound features). |
23
+ | `/dw-qa --bugfix <NNN-slug>` | Targets a bugfix at `.dw/bugfixes/NNN-slug/` instead of a PRD. Runs the standard QA flow scoped to the files touched by the fix; output written to `.dw/bugfixes/NNN-slug/QA/`. Combines with `--fix`/`--api`/`--ai`/`--uat`. |
22
24
 
23
25
  ## Mode auto-detection
24
26
 
@@ -32,8 +34,17 @@ The default `/dw-qa` inspects the project to choose UI vs API:
32
34
 
33
35
  | Variable | Description | Example |
34
36
  |----------|-------------|---------|
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
+ | `{{PRD_PATH}}` | Path to PRD directory containing tasks (auto-detect from active branch if omitted; ignored when `--bugfix` is used) | `.dw/spec/prd-invoice-export` |
38
+ | `{{BUGFIX_SLUG}}` | Bugfix slug when `--bugfix` flag is used | `001-login-not-working` |
39
+ | `{{MODE}}` | `--fix` / `--api` / `--ai` / `--uat` / `--bugfix <slug>` (optional; default = auto-detect, target = PRD) | — |
40
+
41
+ ## Target Resolution
42
+
43
+ Compute `<target>` ONCE at the start; substitute it wherever you see `<target>` below.
44
+
45
+ 1. **PRD target (default):** `<target>` = `{{PRD_PATH}}`. Artifacts read: `prd.md` (FRs), `techspec.md`, `tasks.md`, per-task files. Output written to `<target>/QA/`.
46
+
47
+ 2. **Bugfix target (`--bugfix <slug>`):** `<target>` = `.dw/bugfixes/<slug>/`. Artifacts read: `TASK.md` (numbered tasks + files touched), `fix-report.md` (verify evidence + reproduction trace), `SUMMARY.md`. QA is scoped to the files in the `Files Touched` table and the adjacent surfaces those files expose. Output written to `<target>/QA/`. The `qa-report.md` produced here is shorter — there are at most 5 tasks and a single root-cause to validate, not a full FR matrix.
37
48
 
38
49
  ## Complementary Skills
39
50
 
@@ -50,19 +61,20 @@ When available under `./.agents/skills/`, these are invoked operationally:
50
61
  ## Output Structure
51
62
 
52
63
  ```
53
- .dw/spec/<prd>/QA/
54
- ├── qa-report.md # Test plan + execution summary
55
- ├── bugs.md # Bug catalog with status
64
+ <target>/QA/ # <target> = .dw/spec/<prd>/ OR .dw/bugfixes/<NNN-slug>/
65
+ ├── qa-report.md # Test plan + execution summary
66
+ ├── bugs.md # Bug catalog with status
67
+ ├── uat-report.md # (--uat mode only) Walkthrough log + user observations
56
68
  ├── 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)
69
+ │ ├── ui/<RF>-<slug>.spec.ts # Playwright scripts (UI mode)
70
+ │ ├── api/<RF>-<slug>.http # API test files
71
+ │ └── ai/<feature>-eval.ts # AI eval scripts (--ai mode)
60
72
  ├── evidence/
61
- │ ├── ui/ # Screenshots per RF + retests
73
+ │ ├── ui/ # Screenshots per RF + retests
62
74
  │ └── ...
63
75
  └── logs/
64
- ├── api/<RF>-<slug>.log # JSONL request/response per call
65
- └── ai/<feature>-<date>.jsonl # AI eval results
76
+ ├── api/<RF>-<slug>.log # JSONL request/response per call
77
+ └── ai/<feature>-<date>.jsonl # AI eval results
66
78
  ```
67
79
 
68
80
  ## Mode 1: Default (`/dw-qa`)
@@ -105,6 +117,70 @@ When available under `./.agents/skills/`, these are invoked operationally:
105
117
  4. Compare to prior run's JSONL — alert on >10% regression in any metric.
106
118
  5. Append AI-mode section to `qa-report.md`.
107
119
 
120
+ ## Mode 1.5: Interactive UAT (`/dw-qa --uat`)
121
+
122
+ The UAT mode is a **human-in-the-loop walkthrough**. There is no Playwright auto-driving and no AI eval. The agent is the navigator; the user is the verifier. Use this when behavior is judgment-bound — a redesign, a content-heavy flow, a new flow whose acceptance criteria are partly aesthetic, or a bugfix whose user-facing manifestation needs a human eye to confirm.
123
+
124
+ ### Pre-flight
125
+
126
+ 1. **Bugfix target:** read `<target>/SUMMARY.md` → Symptom + Resolution. The walkthrough is the reproduction trace from `fix-report.md` (before → after), now confirmed live.
127
+ 2. **PRD target:** read `<target>/prd.md` → for each FR, draft a one-line "what should you see when X happens?" question.
128
+ 3. Start the project's dev server (or instruct the user to start it if it needs interactive credentials).
129
+
130
+ ### Walkthrough loop
131
+
132
+ For each FR (PRD target) or each numbered task in `TASK.md` (bugfix target):
133
+
134
+ 1. **Agent describes the next step in plain words.** Example: "Open `/invoices/export` while logged in as a viewer. The export button should be disabled and a tooltip should explain why."
135
+ 2. **User performs the step in their browser/app** and reports what they observed.
136
+ 3. **Agent asks one targeted follow-up** matched to the FR/task — never more than one open question at a time:
137
+ - "Does the disabled state visually communicate why? (text, icon, contrast — your call)"
138
+ - "If you tab to the button, does the tooltip become accessible via keyboard?"
139
+ - "What happened in the network panel?" (only if a backend behavior is relevant)
140
+ 4. **Agent records the answer verbatim** in `uat-report.md` under that FR/task's section. No interpretation, no rephrasing.
141
+ 5. **Agent flags a finding** when the user reports unexpected behavior. The finding goes into `bugs.md` with `source: uat` and `severity: <user's choice>`.
142
+ 6. **Repeat until all FRs / numbered tasks have been walked.**
143
+
144
+ ### Output
145
+
146
+ Save to `<target>/QA/uat-report.md`:
147
+
148
+ ```markdown
149
+ # UAT Walkthrough — <target>
150
+
151
+ Date: YYYY-MM-DD
152
+ Walked by: <user identifier or "user">
153
+ Browser/env: <as reported>
154
+
155
+ ## FR-1.1 (or Task 1) — <one-line scope>
156
+
157
+ - Step: <what agent asked>
158
+ - User observation: <verbatim>
159
+ - Verdict: PASS / FAIL / NEEDS-DESIGN-INPUT
160
+ - Notes: <any follow-up>
161
+
162
+ ## FR-1.2 (or Task 2) — ...
163
+ ...
164
+
165
+ ## Summary
166
+
167
+ - Walked: N FRs / tasks
168
+ - PASS: N
169
+ - FAIL: N (cross-ref bugs.md entries with source:uat)
170
+ - NEEDS-DESIGN-INPUT: N (no bug; the spec was under-defined here)
171
+ ```
172
+
173
+ ### Required behavior
174
+
175
+ <critical>
176
+ - NEVER auto-drive the browser in `--uat` mode. The user navigates; you observe.
177
+ - NEVER paraphrase the user's observation. Quote verbatim under each FR/task.
178
+ - NEVER mark a finding as a bug without the user's explicit "yes, that's a bug" — UAT findings can also surface unclear specs (NEEDS-DESIGN-INPUT), which are not bugs.
179
+ - Cap each FR's section at one open question per turn. UAT is interactive, not interrogation.
180
+ </critical>
181
+
182
+ UAT composes with `--bugfix <slug>` (walks the regression test path with the user instead of FRs) and with `--fix` (after a fix lands, UAT is the human green-light before commit).
183
+
108
184
  ## Mode 2: Fix loop (`/dw-qa --fix`)
109
185
 
110
186
  ### Behavior
@@ -0,0 +1,90 @@
1
+ <system_instructions>
2
+ You are a session-resumption agent. Your job is to read `.dw/STATE.md`, orient yourself and the user, and route to the most useful next step. This command is the inverse of `/dw-pause`.
3
+
4
+ ## When to Use
5
+ - Use when the user says "resume work", "continue", "where did we stop?", "pick up where we left off", or starts a new session in an existing project
6
+ - Use proactively at the start of any session that lands in a project with a non-empty `.dw/STATE.md` and the user hasn't yet stated an intent
7
+
8
+ ## Pipeline Position
9
+ **Predecessor:** `/dw-pause` (previous session) | **Successor:** depends on what's open (typically `/dw-run --resume`, `/dw-bugfix`, `/dw-plan`, `/dw-qa`, or `/dw-review`)
10
+
11
+ ## File Location
12
+ - Read-only target: `.dw/STATE.md`
13
+ - Cross-reference: `.dw/spec/` (list active PRDs), `.dw/bugfixes/` (list open bugfixes), `.dw/incidents/` (if any)
14
+
15
+ ## Workflow
16
+
17
+ ### 1. Read STATE.md
18
+ - If `.dw/STATE.md` is missing, report: "No paused state found — this looks like a fresh session. Run `/dw-help` for next steps." Stop here.
19
+ - If `STATE.md` exists but every section is `_none_`, report: "STATE.md is empty — nothing to resume. Tell me what you want to do."
20
+
21
+ ### 2. Cross-reference with disk
22
+ Verify that the state still matches the filesystem:
23
+
24
+ - For each Open Loop referencing a PRD path, run `ls` on `.dw/spec/<slug>/`. If missing, flag `[stale: PRD not found]` and ask if the user wants it removed.
25
+ - For each Open Loop referencing a bugfix slug, check `.dw/bugfixes/<NNN-slug>/`.
26
+ - For each Blocker referencing an external system, do not verify — just surface it.
27
+ - If `last_paused` in frontmatter is more than 14 days old, surface this prominently (state may be stale).
28
+
29
+ ### 3. Produce TLDR
30
+
31
+ Present a concise summary, **not the raw STATE.md**:
32
+
33
+ ```
34
+ ## Where you left off
35
+
36
+ Last paused: YYYY-MM-DD (Nd ago)
37
+
38
+ ### Open Loops (N)
39
+ - [path or label] — next: <one-line next action> [<status flag if stale>]
40
+ - ...
41
+
42
+ ### Blockers (N unresolved)
43
+ - [label] — waiting on <X>
44
+
45
+ ### Top Todos (up to 5)
46
+ - ...
47
+
48
+ [Decisions, Lessons, Preferences — only mention if relevant to active loops]
49
+ ```
50
+
51
+ Keep the TLDR under 30 lines. If STATE.md has more, summarize and offer `cat .dw/STATE.md` as a follow-up.
52
+
53
+ ### 4. Suggest the next step
54
+
55
+ Based on the TLDR, route to a concrete command. Use these heuristics:
56
+
57
+ | Strongest signal in STATE.md | Suggested command |
58
+ |------------------------------|-------------------|
59
+ | Open Loop on a PRD at `tasks/` stage | `/dw-run --resume` |
60
+ | Open Loop on a PRD at `techspec` stage | `/dw-plan techspec` |
61
+ | Open Loop on a PRD at `prd` stage | `/dw-plan tasks` (if PRD approved) or continue PRD |
62
+ | Open Loop on a bugfix slug | `/dw-bugfix --resume <slug>` or `/dw-qa --bugfix <slug>` |
63
+ | Blocker waiting on external input | Suggest the user resolve the blocker first |
64
+ | Only Todos and Decisions, no active work | Ask the user what they want to start |
65
+
66
+ Phrase the suggestion as a question, not an order:
67
+
68
+ ```
69
+ Want me to <suggested command>?
70
+ - yes → I'll run it
71
+ - no, <other intent> → tell me what instead
72
+ ```
73
+
74
+ ### 5. Update STATE.md frontmatter
75
+
76
+ Set `last_resumed` to today's date (YYYY-MM-DD). Do not modify section content — that's the user's call now that the session is back.
77
+
78
+ ## Required Behavior
79
+
80
+ <critical>NEVER auto-execute the suggested command. `/dw-resume` only proposes; the user confirms before any `/dw-run`, `/dw-plan`, or `/dw-bugfix` fires.</critical>
81
+
82
+ <critical>NEVER fabricate stale-detection results. If you didn't run `ls`, don't report the file exists or doesn't exist.</critical>
83
+
84
+ <critical>NEVER dump the full STATE.md into the chat. Summarize. Long state files mean compaction is needed — suggest `/dw-pause` to compact next time.</critical>
85
+
86
+ ## Inspired by
87
+
88
+ This command adapts the session-handoff pattern from [`tech-leads-club/agent-skills/tlc-spec-driven`](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) (CC-BY-4.0, Felipe Rodrigues). Adaptations: routing heuristics map STATE.md content to specific `dw-*` commands; cross-reference with `.dw/spec/` and `.dw/bugfixes/` to detect staleness; never auto-execute.
89
+
90
+ </system_instructions>
@@ -15,16 +15,28 @@ You are the review orchestrator. Runs both Level 2 (PRD compliance / coverage) a
15
15
 
16
16
  | Invocation | What runs |
17
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. |
18
+ | `/dw-review` | **Default.** Level 2 (PRD coverage) + Level 3 (code quality) in sequence. Consolidated report saved to `<target>/QA/review-consolidated.md` (target resolves to PRD dir or bugfix dir; see Target Resolution). |
19
+ | `/dw-review --coverage-only` | Only Level 2 — maps every PRD requirement (or bugfix scope) to the code that delivers it. Skips code quality. |
20
+ | `/dw-review --code-only` | Only Level 3 — code quality / convention / security checks. Skips PRD/scope mapping. |
21
+ | `/dw-review --bugfix <NNN-slug>` | Targets a bugfix at `.dw/bugfixes/NNN-slug/` instead of a PRD. Level 2 maps the bugfix scope (TASK.md + fix-report.md + SUMMARY.md) to the code that delivers the fix; Level 3 checks the diff. Output: `.dw/bugfixes/NNN-slug/review/`. |
21
22
 
22
23
  ## Inputs
23
24
 
24
25
  | Variable | Description | Example |
25
26
  |----------|-------------|---------|
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) | |
27
+ | `{{PRD_PATH}}` | Path to PRD directory (auto-detect from active branch if omitted; ignored when `--bugfix` is used) | `.dw/spec/prd-invoice-export` |
28
+ | `{{BUGFIX_SLUG}}` | Bugfix slug when `--bugfix` flag is used | `001-login-not-working` |
29
+ | `{{MODE}}` | `--coverage-only` / `--code-only` / `--bugfix <slug>` (optional; default = both, target = PRD) | — |
30
+
31
+ ## Target Resolution
32
+
33
+ The review runs against one of two target kinds. Compute `<target>` ONCE at the start; substitute it wherever you see `<target>` below.
34
+
35
+ 1. **PRD target (default):** `<target>` = `{{PRD_PATH}}` (auto-detected from active branch when omitted). Artifacts read: `prd.md`, `techspec.md`, `tasks.md`, `tasks/<N>_task.md`, `tasks-validation.md`. Output written to `<target>/QA/`. Filenames: `review-coverage.md`, `dw-code-review.md`, `review-consolidated.md`.
36
+
37
+ 2. **Bugfix target (`--bugfix <slug>`):** `<target>` = `.dw/bugfixes/<slug>/`. Artifacts read: `TASK.md` (the fix plan with numbered tasks 1..≤5), `fix-report.md` (verify evidence), `SUMMARY.md` (one-page record). There are no FRs in the PRD sense — instead, each numbered task in `TASK.md` is the unit of coverage. Output written to `<target>/review/`. Filenames: `review-coverage.md`, `dw-code-review.md`, `review-consolidated.md`.
38
+
39
+ When the bugfix target is used, the Coverage mapping (Level 2) operates on the numbered tasks from `TASK.md` (not FR-N.M); a task is DELIVERED when (a) the files it claimed to touch are in the diff and (b) the regression test referenced in `fix-report.md` exists and runs. Orphan code in bugfix mode is anything in the diff that does not correspond to a numbered task — a strong signal the safety valve should have escalated to `/dw-plan`.
28
40
 
29
41
  ## Complementary Skills
30
42
 
@@ -59,10 +71,8 @@ When available under `./.agents/skills/`, these are invoked as analytical suppor
59
71
  ### Behavior
60
72
 
61
73
  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.
74
+ - **PRD target:** `<target>/prd.md` → extract functional requirements. `<target>/techspec.md` → extract architectural decisions. `<target>/tasks.md` + per-task files → extract committed work. `<target>/tasks-validation.md` → carry forward dimension status.
75
+ - **Bugfix target:** `<target>/TASK.md` → extract the numbered tasks (1..≤5) and their target files. `<target>/fix-report.md` → extract the verify evidence and the regression test reference. `<target>/SUMMARY.md` → extract Symptom, Root Cause, Files Touched, Verification.
66
76
 
67
77
  2. **Map each FR to code:**
68
78
  - For each `FR-N.M`, find code that delivers it (file path + line range + commit SHA).
@@ -78,7 +88,7 @@ When available under `./.agents/skills/`, these are invoked as analytical suppor
78
88
 
79
89
  ### Output
80
90
 
81
- Saved to `.dw/spec/<prd>/QA/review-coverage.md`:
91
+ Saved to `<target>/QA/review-coverage.md` (PRD target) or `<target>/review/review-coverage.md` (bugfix target):
82
92
 
83
93
  ```markdown
84
94
  # Coverage Review
@@ -145,14 +155,14 @@ If MISSING > 0, the verdict suggests revisiting `/dw-plan tasks` to scope or `/d
145
155
 
146
156
  ### Output
147
157
 
148
- Saved to `.dw/spec/<prd>/QA/dw-review --code-only.md`. The verdict line is one of:
158
+ Saved to `<target>/QA/dw-code-review.md` (PRD target) or `<target>/review/dw-code-review.md` (bugfix target). The verdict line is one of:
149
159
  - **APPROVED** — all gates green; ready for commit + PR.
150
160
  - **APPROVED WITH CAVEATS** — green but findings worth fixing in follow-up (filed with severities).
151
161
  - **REJECTED** — at least one hard gate failed. Specify which.
152
162
 
153
163
  ## Consolidated output (default mode)
154
164
 
155
- When both levels run, a consolidated report at `.dw/spec/<prd>/QA/review-consolidated.md`:
165
+ When both levels run, a consolidated report at `<target>/QA/review-consolidated.md` (PRD target) or `<target>/review/review-consolidated.md` (bugfix target):
156
166
 
157
167
  ```markdown
158
168
  # Consolidated Review
@@ -0,0 +1,66 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ slug: ""
4
+ created: ""
5
+ status: "Fixed | In Review | QA Pending | Reverted"
6
+ severity: "Low | Medium | High"
7
+ related_concerns: []
8
+ ---
9
+
10
+ # Bugfix Summary — {{NNN}}-{{slug}}
11
+
12
+ One-page record of a bugfix. Sibling files in this directory:
13
+
14
+ - `TASK.md` — the original triage, clarification answers, and the fix plan that ran
15
+ - `fix-report.md` — verification evidence (`dw-verify` PASS output, reproduction proof, regression test run)
16
+ - `review/` — populated by `/dw-review --bugfix {{NNN}}-{{slug}}`
17
+ - `QA/` — populated by `/dw-qa --bugfix {{NNN}}-{{slug}}` (when applicable)
18
+
19
+ ## Symptom
20
+
21
+ What the user observed. Quote the original bug description verbatim; do not paraphrase.
22
+
23
+ > _"…"_
24
+
25
+ ## Root Cause
26
+
27
+ What was actually broken, in a single sentence. Not the symptom — the cause.
28
+
29
+ _…_
30
+
31
+ ## Resolution
32
+
33
+ What changed, in 2-4 bullets. File paths, not snippets.
34
+
35
+ - _change 1_
36
+ - _change 2_
37
+
38
+ ## Files Touched
39
+
40
+ Full list, including tests. ≤5 — if more, the safety valve should have escalated to `/dw-plan`.
41
+
42
+ | Path | Change |
43
+ |------|--------|
44
+ | `src/foo/bar.ts` | _surgical fix to X_ |
45
+ | `src/foo/bar.test.ts` | _regression test added_ |
46
+
47
+ ## Verification
48
+
49
+ How the fix was proven, beyond "tests pass".
50
+
51
+ - **Reproduction before fix:** _step that triggered the bug, captured_
52
+ - **Reproduction after fix:** _same step, now passes_
53
+ - **Regression test:** _name + path_
54
+ - **Verify report:** `fix-report.md`
55
+
56
+ ## Related
57
+
58
+ - **Concerns touched:** _refs from `.dw/rules/concerns.md` if the fix landed in a flagged area_
59
+ - **Adjacent bugfixes:** _slugs of prior fixes in the same module, if any_
60
+ - **PRD context:** _if the bug surfaced inside a feature in flight, link to its PRD path_
61
+
62
+ ## Followups
63
+
64
+ Open loops this fix surfaced but did not resolve. Add to `.dw/STATE.md` Open-Loops on close.
65
+
66
+ - _none_
@@ -0,0 +1,59 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ generated_by: dw-analyze-project (Step 9)
4
+ last_refreshed: ""
5
+ ---
6
+
7
+ # Concerns — Risk Map
8
+
9
+ Risk map for this codebase. Not conventions ("how we do things" — that's `.dw/rules/`), not architecture ("how it's built" — that's `.dw/intel/arch.md`). This file answers a single question: **where is it dangerous to mess around?**
10
+
11
+ Loaded on-demand by `/dw-plan`, `/dw-run`, and `/dw-bugfix` when their target touches an entry below. Auto-installed by `/dw-analyze-project` Step 9; never blocks (absence = no flagged areas yet).
12
+
13
+ ## Hot Spots
14
+
15
+ Files or modules with high churn, frequent bug reports, or repeated "I touched this and broke something" history. Mention them in PRDs that touch the same area; add an extra reviewer or extra test pass.
16
+
17
+ | Path | Why it's hot | First flagged | Last incident |
18
+ |------|--------------|---------------|---------------|
19
+ | _e.g. `src/auth/session.ts`_ | _3 token-handling fixes in 60d_ | _YYYY-MM-DD_ | _YYYY-MM-DD_ |
20
+
21
+ ## Fragile Integrations
22
+
23
+ External systems (APIs, queues, vendors, legacy databases) that have a track record of silent failures, schema drift, rate-limit surprises, or undocumented behavior. New code touching them needs explicit retry/timeout/idempotency handling.
24
+
25
+ | Integration | Failure mode | Mitigation expected |
26
+ |-------------|--------------|---------------------|
27
+ | _e.g. legacy SAP export_ | _silent 200 OK with empty body when source is locked_ | _check body length; log and alert_ |
28
+
29
+ ## Hostile Code
30
+
31
+ Specific functions, regexes, parsers, or algorithms that are hard to reason about — anyone touching them should fully understand them first (or rewrite, not patch). Common offenders: hand-rolled regex, ad-hoc string parsers, custom serializers, race-prone async, manual transaction code.
32
+
33
+ | Path / function | Why it's hostile | Owner / context |
34
+ |-----------------|------------------|-----------------|
35
+ | _e.g. `src/billing/parseInvoice.ts:parseLine`_ | _900-char regex with 12 alternatives, no comments_ | _Bruno wrote it in 2024; rewrite if it breaks_ |
36
+
37
+ ## Known Bug History
38
+
39
+ Aggregated from `.dw/bugfixes/*/SUMMARY.md` by `/dw-intel --build`. Lists modules with ≥2 historical fixes. Read alongside Hot Spots when planning related work.
40
+
41
+ | Module | Bug count | Recent slugs |
42
+ |--------|-----------|--------------|
43
+ | _e.g. `src/payments/`_ | _4_ | _002-stripe-webhook-retry, 007-refund-rounding_ |
44
+
45
+ ## Tech Debt — Acknowledged
46
+
47
+ Pieces of debt the team has agreed exist. Not to be cleaned up opportunistically without coordination — they may be load-bearing in ways that aren't obvious.
48
+
49
+ | Area | Debt description | Why it stays | Cleanup trigger |
50
+ |------|------------------|--------------|-----------------|
51
+ | _e.g. `src/legacy/userMapper.ts`_ | _Two parallel field-mapping codepaths_ | _Awaiting v3 API migration_ | _Q3 2026 after vendor cutover_ |
52
+
53
+ ---
54
+
55
+ **How to maintain this file:**
56
+
57
+ - `/dw-analyze-project` rewrites this on each run. Hand-written entries between `<!-- preserved:start -->` and `<!-- preserved:end -->` markers are kept.
58
+ - When a bugfix surfaces a new dangerous area, add it manually under Hot Spots and let the next analyze rerun confirm it.
59
+ - Promote entries to `.dw/constitution.md` when they become non-negotiable rules ("never touch X without an ADR").
@@ -0,0 +1,59 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ last_paused: ""
4
+ last_resumed: ""
5
+ ---
6
+
7
+ # Session State
8
+
9
+ Cross-session working memory. Lightweight index of what is in flight, what was decided, what is parked. Updated by `/dw-pause` (consolidates) and read by `/dw-resume` (orients).
10
+
11
+ Unlike per-PRD `MEMORY.md` (workflow memory for one feature) or ADRs (durable architectural records), this file lives at the project level and survives across PRDs, branches, and sessions. Edit it freely between pauses.
12
+
13
+ ## Open Loops
14
+
15
+ What is currently in flight — work started but not finished. Each entry: short label + path/target + next concrete action.
16
+
17
+ - _none_
18
+
19
+ ## Decisions
20
+
21
+ Cross-cutting decisions that haven't been promoted to an ADR yet (because they don't warrant one, or because the formalization is deferred). Format: `YYYY-MM-DD — decision — context (1 line)`.
22
+
23
+ - _none_
24
+
25
+ ## Blockers
26
+
27
+ What's preventing forward motion. External (waiting on someone), internal (knowledge gap), or technical (broken tooling). Each entry: short label + what's blocked + owner / unblock condition.
28
+
29
+ - _none_
30
+
31
+ ## Todos
32
+
33
+ Small follow-ups that don't justify a full PRD or task file. One line each. Cleared as they get done or migrated to a PRD.
34
+
35
+ - _none_
36
+
37
+ ## Deferred Ideas
38
+
39
+ Ideas you considered but parked. Capture so they aren't lost; revisit when scope changes. Each entry: idea + reason it was parked + revisit trigger (if known).
40
+
41
+ - _none_
42
+
43
+ ## Lessons
44
+
45
+ Small lessons learned during recent work — patterns that worked, gotchas, "next time I'll …". Not architectural (those go to ADRs); operational.
46
+
47
+ - _none_
48
+
49
+ ## Preferences
50
+
51
+ Conventions agreed during work that affect how the agent should behave going forward. Examples: "always run `pnpm typecheck` before commit", "prefer named exports over default exports for utils".
52
+
53
+ - _none_
54
+
55
+ ## Notes
56
+
57
+ Free-form scratchpad. Optional.
58
+
59
+ - _none_
@@ -5,11 +5,27 @@ Este projeto usa [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@bru
5
5
 
6
6
  **Objetivo deste arquivo:** quando o usuário expressar uma intenção que casa com a Trigger Map abaixo, rode o comando `dw-*` correspondente **sem pedir permissão** — exceto se a mudança for genuinamente trivial (veja Escape Hatches).
7
7
 
8
+ ## Matriz de Auto-Sizing
9
+
10
+ Antes de escolher um comando da Trigger Map, dimensione o escopo real da mudança. A mesma intenção ("conserta isso", "adiciona isso") pode significar quantidades muito diferentes de trabalho; a matriz nomeia quatro tamanhos e roteia cada um para uma entrada diferente. **Escolha o menor que cabe — sub-rotear desperdiça cerimônia, super-rotear esconde o escopo.**
11
+
12
+ | Tamanho | Como se parece | Rotear para |
13
+ |---------|----------------|-------------|
14
+ | **Pequeno** | ≤3 arquivos, sem migration, sem novo endpoint, descritível em uma frase. Exemplos: typo, log message, config de uma linha, bump de dependência, version pin. | Faça inline. Nenhum comando `dw-*`. |
15
+ | **Médio** | Feature ou bug claro, <10 tasks numeradas esperadas, único componente ou serviço, sem decisões arquiteturais. Exemplos: adicionar campo de form com validação, corrigir regressão em módulo conhecido, ligar novo endpoint num handler existente. | `/dw-bugfix` (bugs) ou `/dw-plan` (features) — direto, não via `/dw-autopilot`. |
16
+ | **Grande** | Feature multi-componente, ≥10 tasks esperadas, toca múltiplos módulos, tem superfície UX user-visible E backend. Exemplos: adicionar nova entidade end-to-end (model + migration + API + UI), introduzir integração de terceiro, redesenhar fluxo. | `/dw-autopilot "<wish>"` — pipeline completo PRD → TechSpec → Tasks → Run → QA → Review → Commit → PR com três gates. |
17
+ | **Complexo** | Domínio novo, requisitos ambíguos, decisão arquitetural exigida, superfície regulatória ou de compliance, ou escopo que cruza múltiplos PRDs. Exemplos: introduzir event sourcing, reconstruir auth, multi-tenancy, nova linha de produto. | `/dw-brainstorm "<ideia>"` primeiro (auto-dispatch de modos research/council), depois `/dw-plan --council` para a etapa de techspec rodar o debate multi-advisor. |
18
+
19
+ **Safety valve:** se você começou em Pequeno ou Médio mas o trabalho revela que é Grande de fato (a listagem inline passa de 5 passos, ou `/dw-bugfix` dispara seu `Step 5.0`), PARE e escale. Não existe flag para bypass. Escalar é o desfecho correto.
20
+
21
+ **Adaptado de** [`tech-leads-club/agent-skills/tlc-spec-driven`](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) (CC-BY-4.0). A matriz de quatro tamanhos é de lá; o mapeamento para comandos `dw-*` é específico do dev-workflow.
22
+
8
23
  ## Trigger Map
9
24
 
10
25
  | Intenção do usuário (literal ou parafraseada) | Auto-trigger |
11
26
  |------------------------------------------------|--------------|
12
27
  | "Implementa X" / "Cria Y" / "Adiciona feature Z" / "Preciso de..." | `/dw-autopilot "X"` |
28
+ | "Autopilota esse PRD" / "Leva esse PRD pra PR" / continua escalação de bugfix autonomamente | `/dw-autopilot --from-prd <slug>` (PRD existente em `.dw/spec/<slug>/`) |
13
29
  | Erro colado / "X está quebrado" / "Bug em Y" / screenshot de teste falhando | `/dw-bugfix "X"` |
14
30
  | "Planeja essa feature" / "Escreve PRD + techspec + tasks" | `/dw-plan "X"` |
15
31
  | "Escreve PRD pra X" / "Especifica Y" | `/dw-plan prd "X"` |
@@ -18,17 +34,20 @@ Este projeto usa [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@bru
18
34
  | "Roda essa task" (com ID da task) | `/dw-run <ID>` |
19
35
  | "Roda todas as tasks pendentes" / "Executa o plano" | `/dw-run` |
20
36
  | "Continue de onde parei" | `/dw-run --resume` |
37
+ | "Pausa o trabalho" / "Encerra a sessão" / "Salva onde paramos" | `/dw-pause` |
38
+ | "Retoma" / "Onde paramos?" / "Volta de onde parei" | `/dw-resume` |
21
39
  | "QA dessa feature" / "Roda o test plan" | `/dw-qa` |
22
40
  | "Corrige os bugs do QA" | `/dw-qa --fix` |
23
41
  | "Avalia a feature AI" / "Testa o RAG / classifier" | `/dw-qa --ai` |
42
+ | "Caminha comigo pela feature" / "UAT comigo" / "Vamos fazer um run-through manual" | `/dw-qa --uat` |
43
+ | "Revisa esse bugfix" / "Code-review do fix `<slug>`" | `/dw-review --bugfix <slug>` |
44
+ | "QA desse bugfix" / "Valida o fix `<slug>`" | `/dw-qa --bugfix <slug>` |
24
45
  | "Revisa meu PR" / "Checa qualidade" / "Tá pronto pra subir?" | `/dw-review` |
25
46
  | "Só checagem de cobertura PRD" | `/dw-review --coverage-only` |
26
47
  | "Só code review qualidade" | `/dw-review --code-only` |
27
48
  | "Hora de commitar" / mudanças validadas e prontas | `/dw-commit` |
28
49
  | "Abre um PR" / "Sobe isso" | `/dw-generate-pr` |
29
- | "Brainstorm X" / "Explora ideias" | `/dw-brainstorm "X"` |
30
- | "Research X" / "Compara A vs B com citações" | `/dw-brainstorm --research "X"` |
31
- | "Auditoria de saúde do código" / "Tech debt" / "Oportunidades de refactor" | `/dw-brainstorm --refactor` |
50
+ | "Brainstorm X" / "Explora ideias" / "Research X" / "Auditoria de saúde do código" / "Tech debt" | `/dw-brainstorm "X"` (auto-dispatch dos modos grill / prototype / council / research / refactor-audit / onepager conforme os sinais) |
32
51
  | "Onde está X?" / "O que usa Y?" / "Como Z é estruturado?" | `/dw-intel "<pergunta>"` |
33
52
  | "Reconstrói o índice" / "Refresh do intel" | `/dw-intel --build` |
34
53
  | "Redesign dessa UI" / "Audita e entrega novo design" | `/dw-redesign-ui "<target>"` |
@@ -58,6 +77,12 @@ Quando qualquer destes se aplica, responda direto e **não** invoque comando `dw
58
77
  - Usuário diz explicitamente "faz direto" / "pula autopilot" / "não precisa de PRD" — honre.
59
78
  - A conversa já está dentro de um fluxo `dw-*` (você já está executando tasks; não inicie pipeline novo).
60
79
 
80
+ ## Padrão zoom-out (para áreas desconhecidas do código)
81
+
82
+ Quando você cai numa área do codebase que não conhece e a orientação custa mais que a tarefa em si, **não mergulhe nos arquivos primeiro** — peça a um agente de exploração que produza um mapa. Passe o glossário de domínio do projeto (`.dw/rules/index.md`) e diga: "zoom out de um nível — me mostra os módulos relevantes, suas superfícies públicas, quem chama, e o fluxo de dados entre eles, usando o vocabulário do glossário de domínio." Pegue a visão geral, e só então mergulhe. Isso evita a armadilha de ler o arquivo mais profundo primeiro e reconstruir a arquitetura das folhas pra cima.
83
+
84
+ Adaptado de [`mattpocock/skills/zoom-out`](https://github.com/mattpocock/skills/tree/main/zoom-out) (MIT).
85
+
61
86
  ## Referência de Workflow
62
87
 
63
88
  ```