@brunosps00/dev-workflow 0.8.1 → 0.10.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 (96) hide show
  1. package/README.md +30 -27
  2. package/bin/dev-workflow.js +1 -1
  3. package/lib/constants.js +6 -8
  4. package/lib/init.js +6 -0
  5. package/lib/install-deps.js +0 -5
  6. package/lib/migrate-gsd.js +164 -0
  7. package/lib/uninstall.js +2 -2
  8. package/package.json +1 -1
  9. package/scaffold/en/commands/dw-analyze-project.md +6 -11
  10. package/scaffold/en/commands/dw-autopilot.md +10 -17
  11. package/scaffold/en/commands/dw-brainstorm.md +2 -2
  12. package/scaffold/en/commands/dw-bugfix.md +1 -0
  13. package/scaffold/en/commands/dw-code-review.md +7 -5
  14. package/scaffold/en/commands/dw-commit.md +6 -0
  15. package/scaffold/en/commands/dw-create-prd.md +5 -4
  16. package/scaffold/en/commands/dw-create-techspec.md +7 -4
  17. package/scaffold/en/commands/dw-deep-research.md +6 -0
  18. package/scaffold/en/commands/dw-deps-audit.md +1 -0
  19. package/scaffold/en/commands/dw-find-skills.md +4 -4
  20. package/scaffold/en/commands/dw-fix-qa.md +1 -0
  21. package/scaffold/en/commands/dw-generate-pr.md +1 -0
  22. package/scaffold/en/commands/dw-help.md +10 -27
  23. package/scaffold/en/commands/dw-intel.md +99 -30
  24. package/scaffold/en/commands/dw-map-codebase.md +125 -0
  25. package/scaffold/en/commands/dw-new-project.md +1 -1
  26. package/scaffold/en/commands/dw-redesign-ui.md +5 -9
  27. package/scaffold/en/commands/dw-refactoring-analysis.md +8 -6
  28. package/scaffold/en/commands/dw-review-implementation.md +28 -2
  29. package/scaffold/en/commands/dw-run-plan.md +14 -20
  30. package/scaffold/en/commands/dw-run-task.md +5 -4
  31. package/scaffold/en/commands/dw-update.md +3 -1
  32. package/scaffold/en/templates/idea-onepager.md +2 -2
  33. package/scaffold/pt-br/commands/dw-analyze-project.md +6 -11
  34. package/scaffold/pt-br/commands/dw-autopilot.md +10 -17
  35. package/scaffold/pt-br/commands/dw-brainstorm.md +2 -2
  36. package/scaffold/pt-br/commands/dw-bugfix.md +1 -0
  37. package/scaffold/pt-br/commands/dw-code-review.md +7 -5
  38. package/scaffold/pt-br/commands/dw-commit.md +6 -0
  39. package/scaffold/pt-br/commands/dw-create-prd.md +5 -4
  40. package/scaffold/pt-br/commands/dw-create-techspec.md +7 -4
  41. package/scaffold/pt-br/commands/dw-deep-research.md +6 -0
  42. package/scaffold/pt-br/commands/dw-deps-audit.md +1 -0
  43. package/scaffold/pt-br/commands/dw-find-skills.md +4 -4
  44. package/scaffold/pt-br/commands/dw-fix-qa.md +1 -0
  45. package/scaffold/pt-br/commands/dw-generate-pr.md +1 -0
  46. package/scaffold/pt-br/commands/dw-help.md +10 -27
  47. package/scaffold/pt-br/commands/dw-intel.md +99 -30
  48. package/scaffold/pt-br/commands/dw-map-codebase.md +125 -0
  49. package/scaffold/pt-br/commands/dw-new-project.md +1 -1
  50. package/scaffold/pt-br/commands/dw-redesign-ui.md +5 -9
  51. package/scaffold/pt-br/commands/dw-refactoring-analysis.md +8 -6
  52. package/scaffold/pt-br/commands/dw-review-implementation.md +21 -2
  53. package/scaffold/pt-br/commands/dw-run-plan.md +16 -22
  54. package/scaffold/pt-br/commands/dw-run-task.md +5 -4
  55. package/scaffold/pt-br/commands/dw-update.md +3 -1
  56. package/scaffold/pt-br/templates/idea-onepager.md +2 -2
  57. package/scaffold/skills/dw-codebase-intel/SKILL.md +102 -0
  58. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +318 -0
  59. package/scaffold/skills/dw-codebase-intel/references/api-design-discipline.md +138 -0
  60. package/scaffold/skills/dw-codebase-intel/references/incremental-update.md +79 -0
  61. package/scaffold/skills/dw-codebase-intel/references/intel-format.md +208 -0
  62. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +148 -0
  63. package/scaffold/skills/dw-debug-protocol/SKILL.md +106 -0
  64. package/scaffold/skills/dw-debug-protocol/references/error-categorization.md +127 -0
  65. package/scaffold/skills/dw-debug-protocol/references/non-reproducible-strategy.md +108 -0
  66. package/scaffold/skills/dw-debug-protocol/references/six-step-triage.md +139 -0
  67. package/scaffold/skills/dw-debug-protocol/references/stop-the-line.md +52 -0
  68. package/scaffold/skills/dw-execute-phase/SKILL.md +133 -0
  69. package/scaffold/skills/dw-execute-phase/agents/executor.md +264 -0
  70. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +215 -0
  71. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +143 -0
  72. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +156 -0
  73. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +102 -0
  74. package/scaffold/skills/dw-git-discipline/SKILL.md +120 -0
  75. package/scaffold/skills/dw-git-discipline/references/atomic-commits-discipline.md +158 -0
  76. package/scaffold/skills/dw-git-discipline/references/branch-hygiene.md +150 -0
  77. package/scaffold/skills/dw-git-discipline/references/trunk-based-pattern.md +82 -0
  78. package/scaffold/skills/dw-memory/SKILL.md +1 -2
  79. package/scaffold/skills/dw-simplification/SKILL.md +142 -0
  80. package/scaffold/skills/dw-simplification/references/behavior-preserving.md +148 -0
  81. package/scaffold/skills/dw-simplification/references/chestertons-fence.md +152 -0
  82. package/scaffold/skills/dw-simplification/references/complexity-metrics.md +147 -0
  83. package/scaffold/skills/dw-source-grounding/SKILL.md +128 -0
  84. package/scaffold/skills/dw-source-grounding/references/citation-protocol.md +108 -0
  85. package/scaffold/skills/dw-source-grounding/references/freshness-check.md +108 -0
  86. package/scaffold/skills/dw-source-grounding/references/source-priority.md +146 -0
  87. package/scaffold/skills/dw-verify/SKILL.md +0 -1
  88. package/scaffold/skills/vercel-react-best-practices/SKILL.md +4 -0
  89. package/scaffold/skills/vercel-react-best-practices/references/perf-discipline.md +122 -0
  90. package/scaffold/skills/webapp-testing/SKILL.md +5 -0
  91. package/scaffold/skills/webapp-testing/references/security-boundary.md +115 -0
  92. package/scaffold/skills/webapp-testing/references/three-workflow-patterns.md +144 -0
  93. package/scaffold/en/commands/dw-quick.md +0 -85
  94. package/scaffold/en/commands/dw-resume.md +0 -82
  95. package/scaffold/pt-br/commands/dw-quick.md +0 -85
  96. package/scaffold/pt-br/commands/dw-resume.md +0 -82
@@ -0,0 +1,108 @@
1
+ # Non-reproducible bugs — strategy when you can't trigger it on demand
2
+
3
+ Some bugs only fire in production, only for some users, only some times. The protocol differs from normal debugging because step 1 (reproduce) is the open question. Don't fix what you haven't seen.
4
+
5
+ ## Don't fix on guess
6
+
7
+ The strongest urge with a non-reproducible bug is: "I bet I know what it is — let me push a fix and see if reports stop." This fails because:
8
+
9
+ 1. If the fix doesn't work, you wasted a deploy and learned nothing about the cause.
10
+ 2. If reports stop (correlation), you can't tell whether your fix worked or the trigger condition stopped occurring.
11
+ 3. You build a habit of guessing; the next bug, you guess wrong.
12
+
13
+ Instead: instrument first, fix second.
14
+
15
+ ## The four sub-strategies
16
+
17
+ ### A. Timing / race conditions
18
+
19
+ **Signs:** "Fails 1 out of N runs," "Worked locally, fails in CI," "Started failing after we sped up X."
20
+
21
+ **Strategy:**
22
+ 1. Add timing-stamped logs at every async boundary in the suspect path.
23
+ 2. Push to a branch with extra logging; run the suite multiple times in CI.
24
+ 3. Compare the timestamps of failure runs vs success runs. Look for: events arriving in different order, gaps that exceed expectations.
25
+ 4. Once you see the order anomaly, you have the reproduction (forced via test that constrains order).
26
+
27
+ **Tools:**
28
+ - `Date.now()` or `performance.now()` in logs.
29
+ - For network: response time logging.
30
+ - For tests: `--repeat 100` (Jest, Vitest) to amplify rare failures.
31
+ - Chaos: insert random `await sleep(rand)` at suspected boundaries to provoke order issues.
32
+
33
+ ### B. Environment-specific
34
+
35
+ **Signs:** "Works in dev, fails in staging," "Works for one user, fails for another," "Worked yesterday, fails today, no code changes."
36
+
37
+ **Strategy:**
38
+ 1. Diff the environments. Run a script that prints config (env vars, dependencies, OS, locale, feature flags) in both.
39
+ 2. Bisect by environment delta: change one variable at a time in the failing environment toward the working environment. The change that flips the bug is the cause.
40
+ 3. If user-specific: capture the user's state (account flags, history, A/B variants, browser, region) — diff against a working user.
41
+
42
+ **Tools:**
43
+ - Per-user replay: instrument enough that you can re-run a single user's session.
44
+ - A/B comparison: working vs failing pair.
45
+ - Feature flag audit: every flag that differs is a suspect.
46
+
47
+ ### C. State-dependent
48
+
49
+ **Signs:** "Happens to long-time users, never new ones," "Only after they've done X then Y," "Cache-related," "Database-state-related."
50
+
51
+ **Strategy:**
52
+ 1. Identify the state precondition. (Usually the failing user has a value or pattern in their data that the test fixtures don't.)
53
+ 2. Capture the failing user's state (sanitized DB rows, sanitized client state).
54
+ 3. Reproduce locally by seeding that exact state. Now you have a deterministic reproduction.
55
+ 4. Once reproduced, run the standard six-step protocol.
56
+
57
+ **Tools:**
58
+ - DB dump / sanitize / load locally.
59
+ - Client state export (localStorage, IndexedDB, in-memory store snapshot).
60
+ - Replay system that takes a captured state and replays user actions.
61
+
62
+ **Privacy:** Sanitize before capturing. Production user data should never sit in dev environments unsanitized.
63
+
64
+ ### D. Frequency-dependent (rare)
65
+
66
+ **Signs:** "We see this once a week," "Maybe 0.1% of requests," "Customer complained but logs don't show it."
67
+
68
+ **Strategy:**
69
+ 1. Add specific logging or telemetry that would catch the bug NEXT time it fires.
70
+ 2. Deploy the logging.
71
+ 3. Wait for next occurrence (set up an alert if possible).
72
+ 4. Use the captured event as your reproduction.
73
+
74
+ **Tools:**
75
+ - Structured logs filterable by error pattern.
76
+ - Sentry / Bugsnag / similar with breadcrumbs (action history before failure).
77
+ - Custom telemetry on the suspect code path.
78
+
79
+ **Time discipline:**
80
+ - Don't sit waiting forever. Set a deadline ("if no event in 7 days, escalate or reprioritize").
81
+ - Continue other work in parallel; this bug is "instrumented and waiting," not "actively in progress."
82
+
83
+ ## When to ship a guess
84
+
85
+ Sometimes the bug is high-impact and waiting for instrumentation isn't acceptable. In that case:
86
+
87
+ 1. Acknowledge it's a guess in the commit and PR. Don't pretend you reproduced it.
88
+ 2. Make the fix MINIMAL. Don't rewrite a module to fix an unconfirmed bug — you'll cause new bugs.
89
+ 3. Add monitoring/alerting that would catch the bug if it persists. The fix has a verification path: "no recurrence reports in N days."
90
+ 4. Plan a follow-up: if the bug returns, fall back to the instrument-first protocol.
91
+
92
+ A guess fix shipped with explicit acknowledgement is acceptable. A guess fix shipped pretending it was a real diagnosis is not — that pattern erodes the team's trust in fix quality.
93
+
94
+ ## Anti-patterns
95
+
96
+ - "Just add a try/catch and log it" → hides the bug; report stops; cause persists.
97
+ - "Restart the service / clear the cache" — operational mitigation, not a fix. Document it as such.
98
+ - Fix shipped without monitoring → no way to know if it worked.
99
+ - Fix shipped touching unrelated code → "while I was in there" expansion that turns one unverified change into many.
100
+ - Refusing to ship until reproduced when production is suffering — perfectionism that costs users. Use the "ship a minimal guess" path with clear acknowledgement.
101
+
102
+ ## When to escalate
103
+
104
+ After 4 hours instrumenting + waiting with no reproduction:
105
+
106
+ - Surface the situation: what's instrumented, what's expected, what window of time you're waiting.
107
+ - Ask whether to (a) keep waiting, (b) ship a minimal guess fix with monitoring, (c) reprioritize.
108
+ - The decision is the user/team's, not yours alone. Provide the trade-off.
@@ -0,0 +1,139 @@
1
+ # Six-step debug triage
2
+
3
+ Six discrete steps. Each has a specific output. Don't move to the next without finishing the current.
4
+
5
+ ## Step 1 — Reproduce
6
+
7
+ **Question:** Can I trigger this on demand?
8
+
9
+ **Output:** A failing test, a script, or a sequence of UI clicks that produces the bug. Save it. The reproduction IS the hypothesis test for your fix.
10
+
11
+ **How:**
12
+ - From a user report → ask: what version, what environment, what input, what was expected, what happened. Get all five before guessing.
13
+ - From a stack trace → identify the entry point (HTTP route, CLI command, UI event) and the input that triggered it.
14
+ - From a log line → find the surrounding context (request ID, user ID, timestamp); reconstruct the scenario.
15
+ - Write a failing test FIRST when the bug is in pure logic. The test commits the bug to record before you fix it.
16
+
17
+ **Common pitfall:** "It happens sometimes." This is not a reproduction. Either:
18
+ - Find a deterministic trigger (often there's a state precondition you missed), OR
19
+ - Quantify the rate (8/10 runs) and treat the test as flaky-but-progress.
20
+ - See `non-reproducible-strategy.md` for state/timing/env-dependent cases.
21
+
22
+ **Done when:** You have a one-line command (or a series of clicks) that produces the bug ≥80% of the time.
23
+
24
+ ## Step 2 — Localize
25
+
26
+ **Question:** Where does the invariant break?
27
+
28
+ **Output:** A file:line reference where state is wrong. Not where the symptom appears — where the cause lives.
29
+
30
+ **How:**
31
+ - Stack trace → walk UPWARDS from the failure point, asking at each frame: "is the input here valid?" The deepest frame with valid input is where the invariant breaks.
32
+ - Bisect the change history if a recent commit broke things: `git bisect start && git bisect bad HEAD && git bisect good <known-good-sha>`.
33
+ - Logs/instrumentation → add explicit log lines at suspected points; reproduce; narrow the window.
34
+ - Debugger → set breakpoints at boundaries (entry/exit of suspect functions); inspect state.
35
+
36
+ **Common pitfall:** Stopping at the first place that catches the error. The error often surfaces far from the cause.
37
+
38
+ **Done when:** You can point at one specific function (or 2-3 closely related lines) and say "the violation happens here."
39
+
40
+ ## Step 3 — Reduce
41
+
42
+ **Question:** What's the smallest input that triggers this?
43
+
44
+ **Output:** A minimal reproduction — ideally 1-3 lines of input or a 5-10 line test case.
45
+
46
+ **How:**
47
+ - Start with your full reproduction.
48
+ - Remove one element at a time (a config flag, a request field, a piece of state). Check if the bug still reproduces.
49
+ - Repeat until removing anything else makes the bug disappear.
50
+
51
+ **Why bother:**
52
+ - Smaller repros are faster to test (your fix loop runs in seconds, not minutes).
53
+ - Smaller repros surface the EXACT trigger; vague repros let you fool yourself.
54
+ - The minimal repro often makes the cause obvious: "oh, it only fails when the array is empty."
55
+
56
+ **Common pitfall:** Skipping this step because "I already know what's wrong." If you really know, the reduce takes 2 minutes. Do it.
57
+
58
+ **Done when:** Removing one more thing makes the bug disappear.
59
+
60
+ ## Step 4 — Fix root cause
61
+
62
+ **Question:** WHY is the invariant violated? Fix THAT.
63
+
64
+ **Output:** Code change that addresses the cause, not the symptom.
65
+
66
+ **How:**
67
+ - Ask "why?" until you reach a design or assumption that's wrong, not just a bad value.
68
+ - "X is null" — why?
69
+ - "Because Y returned null" — why?
70
+ - "Because the cache was empty when called from this path" — why was the cache empty?
71
+ - "Because the warm-up runs after this path is reachable" — root cause: ordering.
72
+ - Fix at the deepest "why" you can change without scope creep.
73
+ - If the root cause is too deep ("this whole module assumes synchronous I/O"), fix at the shallowest level that makes the bug not recur, AND open a follow-up issue for the deeper fix.
74
+
75
+ **Symptoms vs root cause — examples:**
76
+
77
+ | Symptom fix (don't) | Root cause fix (do) |
78
+ |---------------------|---------------------|
79
+ | Catch the null and return default | Find why null was produced and prevent it |
80
+ | Add a retry loop | Find why the first call failed |
81
+ | Increase the timeout | Find why the operation is slow |
82
+ | Add `if (process.env.NODE_ENV !== 'production')` guard | Find why prod has different behavior |
83
+ | Suppress the warning | Address what the warning is warning about |
84
+
85
+ **Common pitfall:** Adding `try/catch` around the symptom and moving on. This is hiding the bug, not fixing it.
86
+
87
+ **Done when:** Reproduction now passes; lint + tests + build all green.
88
+
89
+ ## Step 5 — Guard against recurrence
90
+
91
+ **Question:** What test would have caught this before deploy?
92
+
93
+ **Output:** A regression test (or two) added to the suite that fails without your fix and passes with it.
94
+
95
+ **How:**
96
+ - Take the reproduction from step 1 → make it a test.
97
+ - The test name should describe the bug ("returns empty list when cache warm-up is delayed", not "fix bug").
98
+ - The test should fail clearly if the bug returns: assertion error with a message naming the invariant.
99
+ - Place the test where future maintainers will find it (alongside the function with the cause, not in some catch-all "bugs.test.ts").
100
+
101
+ **When you can't add a test:**
102
+ - Bug requires production-only conditions: add a logging guard or a runtime invariant check that would fire on recurrence.
103
+ - Bug is in infra/config: add a CI check that validates the config matches expectations.
104
+ - Bug is in third-party library: open an upstream issue AND add a defensive wrapper with a test for your defense.
105
+
106
+ **Common pitfall:** "I'll add the test later." You won't. Add it now or the bug returns.
107
+
108
+ **Done when:** Test exists, was committed in same commit as fix, fails on `git revert <fix>`.
109
+
110
+ ## Step 6 — Verify end-to-end
111
+
112
+ **Question:** Does the original report scenario now pass?
113
+
114
+ **Output:** Proof — manual verification, screenshot, log trace, scripted E2E run.
115
+
116
+ **How:**
117
+ - Re-read the original bug report.
118
+ - Run through it as if you're the reporter — same inputs, same path, same environment if possible.
119
+ - Capture evidence (screenshot, terminal output, log line) that the issue no longer reproduces.
120
+
121
+ **Why this step matters:**
122
+ - Unit tests pass ≠ user-facing scenario works. The user's path may differ from the test's path.
123
+ - Confirms you fixed the user's bug, not just A bug.
124
+ - Catches "fixed it for case A but broke case B" regressions.
125
+
126
+ **Common pitfall:** Stopping at "tests pass" and skipping the user-facing verification. Tests are necessary, not sufficient.
127
+
128
+ **Done when:** You can confidently say "the original reporter would now see the expected behavior."
129
+
130
+ ## After all six steps
131
+
132
+ The fix is ready to commit and ship:
133
+
134
+ - Commit message: describes the bug, root cause, and fix in 1-3 sentences.
135
+ - The regression test goes in the same commit as the fix.
136
+ - If a deeper fix was deferred, the follow-up issue is linked from the commit.
137
+ - E2E verification evidence is in the PR description (screenshot, log, run output).
138
+
139
+ This is what "fixed" looks like. Anything less is "in progress."
@@ -0,0 +1,52 @@
1
+ # Stop the line — when to drop everything for a bug
2
+
3
+ The Toyota factory metaphor: any worker can pull the cord and halt production when they see a defect. The reason isn't dramatic — it's economic. Defects compound downstream. Fixing one now is cheaper than ten later, on top of all the work that built on the broken state.
4
+
5
+ In code, this means: when a real bug surfaces, you stop building features on top of unknown-state code.
6
+
7
+ ## What "stop the line" actually requires
8
+
9
+ 1. **Don't keep coding around it.** If a test is red, you don't merge other PRs that touch the same module until it's green.
10
+ 2. **Don't ignore "flaky" tests.** Flakiness is a bug — usually a race, sometimes a fixture. "Re-run the suite" is not a fix.
11
+ 3. **Don't downgrade priority without evidence.** "It's edge case" requires evidence the case is rare AND the impact is low. Often only one of those is true.
12
+ 4. **Document the pause.** A bug discovered → a tracking issue or task created → a clear "what's blocked by this" note.
13
+
14
+ ## When the rule bends
15
+
16
+ Stop-the-line is not absolute. It bends when:
17
+
18
+ - **The bug is in a parallel system you don't own.** Report it; continue your work. (Don't sit blocked waiting on someone else.)
19
+ - **Production isn't on fire AND a release is shipping in <24h.** Sometimes "ship the working subset, fix the broken one in the next release" is correct. But this requires explicit acknowledgment, not silent slipping.
20
+ - **The bug is informational, not blocking.** A console warning that doesn't affect behavior, a log noise, a deprecated-API notice — those go on a backlog, not stop the line.
21
+ - **Reproduction needs production data.** Continue feature work in parallel branches; don't merge them until repro is achieved or scope-isolated.
22
+
23
+ ## When the rule does NOT bend
24
+
25
+ - Tests are red and you don't know why → stop.
26
+ - A previous green build went red after a merge → stop and bisect.
27
+ - A user report can be reproduced → stop.
28
+ - "Build passes locally but fails CI" → stop. CI is closer to truth.
29
+ - Coverage drops below threshold without obvious reason → stop. (Removed a test silently?)
30
+
31
+ ## The cost of not stopping
32
+
33
+ Three failure modes when teams ignore stop-the-line:
34
+
35
+ 1. **Compounding defects.** Bug A masks bug B; you fix A and now B surfaces in production. The user reports it as a regression of A's fix.
36
+ 2. **Lost reproduction.** A bug seen in commit N is hard to reproduce by commit N+5 because the surrounding code moved. The fix becomes "rewrite this whole area" because nobody can isolate the original issue anymore.
37
+ 3. **Test debt.** Red tests get marked `.skip` "temporarily" — and never come back. Three months later half the suite is skipped and nobody trusts it.
38
+
39
+ ## How to communicate "I'm stopping the line"
40
+
41
+ - "Found a bug in X — pausing my current task to investigate. Will report status in 30 minutes."
42
+ - "I can reproduce the issue. Estimated fix path: Y. Do you want me to push through, or hand off?"
43
+ - "Stuck at localization for 60 minutes. Tried: A, B, C. Need fresh eyes."
44
+
45
+ Brief, factual, no apology. Stopping is the right call; you're naming it.
46
+
47
+ ## Anti-patterns to avoid
48
+
49
+ - "Quick fix and we'll come back to it" — almost never come back to it. Either fix root cause now or formally defer with a tracking issue.
50
+ - "It might be flaky" — investigate, don't speculate. Flakiness has a cause.
51
+ - Silently rolling back instead of investigating — you lost the chance to learn what broke.
52
+ - "Worked around it" with a `// TODO: actual fix` — the workaround is now load-bearing in 3 weeks.
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: dw-execute-phase
3
+ description: Phase execution and plan verification for dev-workflow. Two agents (executor for wave-based parallel task dispatch with deviation handling, plan-checker for goal-backward plan verification before execution). Used by /dw-execute-phase, /dw-plan-checker, /dw-run-plan, /dw-autopilot. Adapted from get-shit-done-cc (MIT).
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Bash
9
+ - Grep
10
+ - Glob
11
+ ---
12
+
13
+ # dw-execute-phase
14
+
15
+ Bundled skill providing **phase-level execution discipline** for dev-workflow: parallel task dispatch in waves, atomic commit per task, deviation handling mid-execution, and goal-backward plan verification before any execution burns context.
16
+
17
+ ## Why a skill (not inline)
18
+
19
+ - The execution discipline (wave coordination, deviation rules, checkpoint protocol) is a separate concern from the commands that invoke it. Bundling it as a skill lets multiple commands (`/dw-run-plan`, `/dw-autopilot`, `/dw-execute-phase` itself) reuse the same discipline.
20
+ - The plan-checker is a verification GATE — it must run before `/dw-run-plan`/`/dw-execute-phase` mutate code, and bundling it makes that contract visible.
21
+ - The agents own the protocol; the orchestrating commands just wire them up.
22
+
23
+ ## When to Use
24
+
25
+ Read this skill when:
26
+
27
+ - `/dw-execute-phase` is invoked to run a batch of tasks in parallel waves.
28
+ - `/dw-plan-checker` is invoked to verify a `tasks.md` file will achieve its PRD goal before execution.
29
+ - `/dw-run-plan` is invoked (it spawns the executor agent for each wave).
30
+ - `/dw-autopilot` enters the execution stage (it gates on plan-checker before invoking the executor).
31
+
32
+ Do NOT use when:
33
+
34
+ - A single one-off change is being made (use `/dw-run-task` directly — no waves needed).
35
+ - The user is exploring/brainstorming, not executing (use `/dw-brainstorm`).
36
+ - The plan hasn't been created yet (use `/dw-create-tasks` first).
37
+
38
+ ## Agents
39
+
40
+ | Agent | Responsibility | Spawn from |
41
+ |-------|----------------|------------|
42
+ | `agents/executor.md` | Runs tasks in waves, atomic commit per task, handles deviations (3 deviation rules), respects checkpoint markers, writes `SUMMARY.md` per phase | `/dw-execute-phase`, `/dw-run-plan` |
43
+ | `agents/plan-checker.md` | Goal-backward verification of `tasks.md` before execution. Checks: requirement coverage, task completeness, dependency soundness, artifact wiring, context budget. Returns PASS / REVISE / BLOCK. | `/dw-plan-checker`, `/dw-create-tasks` (auto-gate before declaring tasks ready) |
44
+
45
+ ## How the Two Agents Compose
46
+
47
+ The expected flow:
48
+
49
+ 1. `/dw-create-tasks` produces `.dw/spec/prd-<slug>/tasks.md` from PRD + TechSpec.
50
+ 2. **Plan-checker GATE** — `/dw-plan-checker .dw/spec/prd-<slug>/` spawns the plan-checker agent. The agent reads PRD/TechSpec/tasks.md and verifies tasks WILL achieve the goal. Returns one of: `PASS` (proceed), `REVISE` (issues found, planner re-runs), `BLOCK` (fundamental gap, abort).
51
+ 3. `/dw-execute-phase` spawns the executor agent ONLY if plan-checker returned `PASS`. The executor runs tasks in waves, commits atomically, handles deviations.
52
+ 4. `/dw-run-qa` runs after all waves complete to validate the implementation against PRD.
53
+
54
+ `/dw-autopilot` orchestrates this entire flow with hard gates between stages.
55
+
56
+ ## Wave Concept
57
+
58
+ Tasks in `tasks.md` are grouped into **waves** by their `Depends on:` frontmatter:
59
+
60
+ - Wave 1: tasks with no dependencies → run in parallel
61
+ - Wave 2: tasks that depend on Wave 1 → run after Wave 1 commits land
62
+ - Wave N: ...
63
+
64
+ Within a wave, tasks run in parallel via subagent dispatch. Across waves, sequential.
65
+
66
+ The executor calculates waves automatically by topologically sorting task dependencies. See `references/wave-coordination.md`.
67
+
68
+ ## Deviation Rules (during execution)
69
+
70
+ Mid-task, the executor may discover the plan is incomplete or contradicted by reality. Three rules:
71
+
72
+ 1. **Auto-add missing critical functionality** — if a task says "create endpoint" but no validation is specified and the project's CLAUDE.md/rules require it, add the validation as part of the same task. Note in the task's commit message.
73
+ 2. **Surface ambiguity, don't guess** — if the plan says "use the existing service" and 3 services match, STOP, write a deviation entry to `.dw/spec/prd-<slug>/deviations.md`, and ask the user.
74
+ 3. **Block on architectural conflicts** — if the task as planned would violate a locked decision in CONTEXT.md / project rules, abort the task and surface the conflict for re-planning.
75
+
76
+ Detail in `references/atomic-commits.md` (deviation entry format) and `references/plan-verification.md` (what plan-checker should catch BEFORE execution to prevent deviations).
77
+
78
+ ## Atomic Commit Protocol
79
+
80
+ Every task ends with exactly one git commit:
81
+
82
+ ```
83
+ feat(<scope>): <task title> (RF-XX)
84
+
85
+ <one-line summary of what this commit delivers>
86
+
87
+ - Files added: <list>
88
+ - Files modified: <list>
89
+ - Tests added/updated: <list>
90
+ - Deviations: <link to deviations.md entry, if any>
91
+
92
+ Closes RF-XX (partial — see tasks.md).
93
+ ```
94
+
95
+ The commit message format is consistent across waves so `/dw-generate-pr` can build a clean PR body. See `references/atomic-commits.md`.
96
+
97
+ ## Checkpoint Protocol
98
+
99
+ If the executor exhausts its context budget mid-phase OR the user signals stop:
100
+
101
+ - Write current progress to `.dw/spec/prd-<slug>/active-session.md` (last completed task, next task, blockers).
102
+ - Exit cleanly with status `CHECKPOINT`.
103
+ - Next invocation of `/dw-resume` reads this file and resumes from the last completed task.
104
+
105
+ ## Files in `.dw/spec/prd-<slug>/`
106
+
107
+ | File | Read by | Written by |
108
+ |------|---------|------------|
109
+ | `prd.md` | plan-checker, executor | `/dw-create-prd` |
110
+ | `techspec.md` | plan-checker, executor | `/dw-create-techspec` |
111
+ | `tasks.md` | plan-checker (verifies), executor (executes) | `/dw-create-tasks` |
112
+ | `<NN>_task.md` | executor (per-task detail) | `/dw-create-tasks` |
113
+ | `deviations.md` | plan-checker (next iteration), executor | executor (rule 1/2 deviations) |
114
+ | `active-session.md` | `/dw-resume`, executor (continuation) | executor (checkpoint) |
115
+ | `SUMMARY.md` | `/dw-generate-pr` | executor (after final wave) |
116
+
117
+ ## References
118
+
119
+ - `references/wave-coordination.md` — how the executor groups tasks into waves and dispatches them in parallel.
120
+ - `references/plan-verification.md` — the 6-dimension goal-backward analysis the plan-checker performs.
121
+ - `references/atomic-commits.md` — commit message format, deviation entry format, when to use Edit vs Write.
122
+
123
+ ## Rules
124
+
125
+ - **No execution without plan-checker PASS.** `/dw-execute-phase` and `/dw-run-plan` must call plan-checker first; if it returns REVISE or BLOCK, abort.
126
+ - **One commit per task, no exceptions.** Even trivial tasks commit. This drives traceability and revert safety.
127
+ - **Deviations are recorded, not silenced.** Every adjustment beyond the plan goes in `deviations.md` with reason.
128
+ - **Checkpoint > timeout.** When context budget is low, checkpoint cleanly rather than running tasks half-way.
129
+ - **Wave order is topological, not user-defined.** The executor computes wave boundaries from `Depends on:` fields; users can't override.
130
+
131
+ ## Inspired by
132
+
133
+ Adapted from [`get-shit-done-cc`](https://github.com/gsd-build/get-shit-done) (`gsd-executor`, `gsd-plan-checker`) by gsd-build (MIT license). Core protocols (goal-backward verification, atomic commits, deviation handling, checkpoint resume) preserved. Path conventions changed from `.planning/<phase>/` to `.dw/spec/prd-<slug>/`. SDK CLI calls (`gsd-sdk query init.execute-phase`) replaced by inline operations. The companion `gsd-debugger` agent (1452 lines) was NOT ported — its scope overlaps with the existing `/dw-bugfix` and `/dw-fix-qa` commands.