@nklisch/pi-agile-workflow 0.15.3

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 (203) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/.codex-plugin/plugin.json +28 -0
  3. package/CHANGELOG.md +591 -0
  4. package/README.md +107 -0
  5. package/docs/ARCHITECTURE.md +716 -0
  6. package/docs/MIGRATION.md +419 -0
  7. package/docs/PRINCIPLES.md +464 -0
  8. package/docs/ROADMAP.md +95 -0
  9. package/docs/SPEC.md +855 -0
  10. package/docs/VISION.md +106 -0
  11. package/extensions/agile-workflow.test.ts +419 -0
  12. package/extensions/agile-workflow.ts +467 -0
  13. package/hooks/hooks.json +52 -0
  14. package/hooks/scripts/prompt-context.py +628 -0
  15. package/hooks/scripts/substrate-maintainer.py +359 -0
  16. package/hooks/scripts/test_prompt_context.py +757 -0
  17. package/package.json +30 -0
  18. package/scripts/install-work-view.sh +165 -0
  19. package/scripts/tests/agent-metadata.test.sh +75 -0
  20. package/scripts/tests/bump-version.test.sh +552 -0
  21. package/scripts/tests/channel-parity.test.sh +117 -0
  22. package/scripts/tests/convert-content-integrity.test.sh +246 -0
  23. package/scripts/tests/convert-install-routing.test.sh +159 -0
  24. package/scripts/tests/install-work-view.test.sh +411 -0
  25. package/scripts/tests/pi-package-metadata.test.sh +119 -0
  26. package/scripts/tests/work-board-shim.test.sh +239 -0
  27. package/scripts/tests/work-view-dist-version.test.sh +105 -0
  28. package/scripts/work-board.sh +64 -0
  29. package/scripts/work-view.sh +423 -0
  30. package/skills/autopilot/SKILL.md +330 -0
  31. package/skills/autopilot/agents/openai.yaml +6 -0
  32. package/skills/board/SKILL.md +62 -0
  33. package/skills/board/agents/openai.yaml +6 -0
  34. package/skills/bold-refactor/SKILL.md +244 -0
  35. package/skills/bold-refactor/agents/openai.yaml +6 -0
  36. package/skills/bug-scan/SKILL.md +378 -0
  37. package/skills/bug-scan/agents/openai.yaml +6 -0
  38. package/skills/bug-scan/references/async-promises.md +119 -0
  39. package/skills/bug-scan/references/concurrency-races.md +148 -0
  40. package/skills/bug-scan/references/data-layer.md +167 -0
  41. package/skills/bug-scan/references/error-handling.md +197 -0
  42. package/skills/bug-scan/references/gate-item-template.md +94 -0
  43. package/skills/bug-scan/references/language-footguns.md +219 -0
  44. package/skills/bug-scan/references/parked-item-template.md +103 -0
  45. package/skills/bug-scan/references/report-template.md +115 -0
  46. package/skills/bug-scan/references/resource-leaks.md +199 -0
  47. package/skills/bug-scan/references/state-closures.md +148 -0
  48. package/skills/bug-scan/references/time-numbers.md +158 -0
  49. package/skills/convert/SKILL.md +1463 -0
  50. package/skills/convert/agents/openai.yaml +6 -0
  51. package/skills/convert/references/legacy-overlap-migration.md +179 -0
  52. package/skills/deep-code-scan/SKILL.md +378 -0
  53. package/skills/deep-code-scan/agents/openai.yaml +6 -0
  54. package/skills/deep-code-scan/references/artifact-ledger.md +148 -0
  55. package/skills/deep-code-scan/references/consolidation.md +91 -0
  56. package/skills/deep-code-scan/references/decomposition.md +127 -0
  57. package/skills/deep-code-scan/references/item-templates.md +263 -0
  58. package/skills/deep-code-scan/references/lane-catalog.md +129 -0
  59. package/skills/deep-code-scan/references/review-gauntlet.md +108 -0
  60. package/skills/deep-code-scan/references/scanner-brief.md +152 -0
  61. package/skills/e2e-test-design/SKILL.md +517 -0
  62. package/skills/e2e-test-design/references/anti-tautology.md +261 -0
  63. package/skills/e2e-test-design/references/service-mocks.md +234 -0
  64. package/skills/e2e-test-design/references/test-taxonomy.md +211 -0
  65. package/skills/epic-design/SKILL.md +476 -0
  66. package/skills/epicize/SKILL.md +210 -0
  67. package/skills/epicize/agents/openai.yaml +6 -0
  68. package/skills/feature-design/SKILL.md +472 -0
  69. package/skills/fix/SKILL.md +173 -0
  70. package/skills/gate-cruft/SKILL.md +258 -0
  71. package/skills/gate-docs/SKILL.md +278 -0
  72. package/skills/gate-patterns/SKILL.md +389 -0
  73. package/skills/gate-refactor/SKILL.md +408 -0
  74. package/skills/gate-security/SKILL.md +275 -0
  75. package/skills/gate-tests/SKILL.md +367 -0
  76. package/skills/groom/SKILL.md +162 -0
  77. package/skills/groom/agents/openai.yaml +6 -0
  78. package/skills/ideate/SKILL.md +185 -0
  79. package/skills/ideate/agents/openai.yaml +6 -0
  80. package/skills/implement/SKILL.md +288 -0
  81. package/skills/implement-orchestrator/SKILL.md +604 -0
  82. package/skills/park/SKILL.md +111 -0
  83. package/skills/perf-design/SKILL.md +427 -0
  84. package/skills/perf-scout/SKILL.md +404 -0
  85. package/skills/perf-scout/agents/openai.yaml +6 -0
  86. package/skills/perf-scout/references/algorithmic-and-data-structures.md +126 -0
  87. package/skills/perf-scout/references/approximation-and-precomputation.md +136 -0
  88. package/skills/perf-scout/references/caching-and-memoization.md +123 -0
  89. package/skills/perf-scout/references/compiler-runtime-and-language.md +136 -0
  90. package/skills/perf-scout/references/database-and-storage-internals.md +144 -0
  91. package/skills/perf-scout/references/distributed-systems.md +150 -0
  92. package/skills/perf-scout/references/game-engine-and-realtime.md +136 -0
  93. package/skills/perf-scout/references/gpu-and-accelerators.md +130 -0
  94. package/skills/perf-scout/references/idea-ranking.md +75 -0
  95. package/skills/perf-scout/references/io-and-batching.md +135 -0
  96. package/skills/perf-scout/references/memory-and-data-locality.md +137 -0
  97. package/skills/perf-scout/references/parallelism-and-vectorization.md +126 -0
  98. package/skills/perf-scout/references/parked-item-template.md +117 -0
  99. package/skills/perf-scout/references/peer-review-pass.md +150 -0
  100. package/skills/perf-scout/references/report-template.md +148 -0
  101. package/skills/principles/SKILL.md +678 -0
  102. package/skills/principles/references/models.md +191 -0
  103. package/skills/principles/references/subagents.md +158 -0
  104. package/skills/prose-author/SKILL.md +185 -0
  105. package/skills/refactor-conventions-creator/SKILL.md +359 -0
  106. package/skills/refactor-conventions-creator/agents/openai.yaml +6 -0
  107. package/skills/refactor-conventions-creator/references/common-structures.md +91 -0
  108. package/skills/refactor-conventions-creator/references/common-styles.md +90 -0
  109. package/skills/refactor-design/SKILL.md +384 -0
  110. package/skills/release-deploy/SKILL.md +667 -0
  111. package/skills/release-deploy/agents/openai.yaml +6 -0
  112. package/skills/research/SKILL.md +166 -0
  113. package/skills/research/agents/openai.yaml +6 -0
  114. package/skills/review/SKILL.md +267 -0
  115. package/skills/review/references/deep-review.md +98 -0
  116. package/skills/review/references/review-lenses.md +68 -0
  117. package/skills/review/references/substrate-side-effects.md +161 -0
  118. package/skills/review/references/target-resolution.md +52 -0
  119. package/skills/scope/SKILL.md +486 -0
  120. package/work-view/Cargo.lock +486 -0
  121. package/work-view/Cargo.toml +9 -0
  122. package/work-view/crates/cli/.work-view-version +1 -0
  123. package/work-view/crates/cli/Cargo.toml +18 -0
  124. package/work-view/crates/cli/src/actionable.rs +500 -0
  125. package/work-view/crates/cli/src/args.rs +792 -0
  126. package/work-view/crates/cli/src/board/assets/board.css +855 -0
  127. package/work-view/crates/cli/src/board/assets/board.js +259 -0
  128. package/work-view/crates/cli/src/board/assets/card.js +139 -0
  129. package/work-view/crates/cli/src/board/assets/components.css +290 -0
  130. package/work-view/crates/cli/src/board/assets/dependency.js +1193 -0
  131. package/work-view/crates/cli/src/board/assets/detail.js +256 -0
  132. package/work-view/crates/cli/src/board/assets/filters.js +389 -0
  133. package/work-view/crates/cli/src/board/assets/index.html +77 -0
  134. package/work-view/crates/cli/src/board/assets/kanban.js +231 -0
  135. package/work-view/crates/cli/src/board/assets/markdown.js +260 -0
  136. package/work-view/crates/cli/src/board/assets/motion.css +131 -0
  137. package/work-view/crates/cli/src/board/assets/state.js +245 -0
  138. package/work-view/crates/cli/src/board/assets/table.js +304 -0
  139. package/work-view/crates/cli/src/board/assets/tokens.css +602 -0
  140. package/work-view/crates/cli/src/board/assets/views.js +41 -0
  141. package/work-view/crates/cli/src/board/assets.rs +162 -0
  142. package/work-view/crates/cli/src/board/feed.rs +204 -0
  143. package/work-view/crates/cli/src/board/mod.rs +246 -0
  144. package/work-view/crates/cli/src/board/open.rs +144 -0
  145. package/work-view/crates/cli/src/board/server.rs +407 -0
  146. package/work-view/crates/cli/src/main.rs +195 -0
  147. package/work-view/crates/cli/src/render.rs +354 -0
  148. package/work-view/crates/cli/src/scope.rs +157 -0
  149. package/work-view/crates/cli/src/stale.rs +581 -0
  150. package/work-view/crates/cli/tests/board-js/dependency-table.test.mjs +64 -0
  151. package/work-view/crates/cli/tests/board-js/expanded-browsing.test.mjs +79 -0
  152. package/work-view/crates/cli/tests/board-js/harness-smoke.test.mjs +11 -0
  153. package/work-view/crates/cli/tests/board-js/harness.mjs +437 -0
  154. package/work-view/crates/cli/tests/board-js/kanban-detail.test.mjs +75 -0
  155. package/work-view/crates/cli/tests/board-js/markdown-filter.test.mjs +60 -0
  156. package/work-view/crates/cli/tests/fixtures/golden/.work/CONVENTIONS.md +3 -0
  157. package/work-view/crates/cli/tests/fixtures/golden/.work/active/epics/epic-alpha.md +16 -0
  158. package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-a.md +16 -0
  159. package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-b.md +16 -0
  160. package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-alpha-1.md +16 -0
  161. package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-research-1.md +19 -0
  162. package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-done.md +16 -0
  163. package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-shipped.md +18 -0
  164. package/work-view/crates/cli/tests/fixtures/golden/.work/backlog/idea-backlog.md +7 -0
  165. package/work-view/crates/cli/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
  166. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/CONVENTIONS.md +6 -0
  167. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-dep-done.md +17 -0
  168. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-design-ready.md +17 -0
  169. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-impl-ready.md +17 -0
  170. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/stories/story-review-ready.md +17 -0
  171. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/CONVENTIONS.md +4 -0
  172. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/epics/malformed-no-closing-fence.md +8 -0
  173. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/features/good-item.md +16 -0
  174. package/work-view/crates/cli/tests/integration.rs +2833 -0
  175. package/work-view/crates/core/Cargo.toml +13 -0
  176. package/work-view/crates/core/src/error.rs +61 -0
  177. package/work-view/crates/core/src/filter.rs +804 -0
  178. package/work-view/crates/core/src/graph.rs +324 -0
  179. package/work-view/crates/core/src/index.rs +590 -0
  180. package/work-view/crates/core/src/lib.rs +54 -0
  181. package/work-view/crates/core/src/model.rs +202 -0
  182. package/work-view/crates/core/src/parse.rs +494 -0
  183. package/work-view/crates/core/tests/fixtures/golden/.work/CONVENTIONS.md +15 -0
  184. package/work-view/crates/core/tests/fixtures/golden/.work/active/epics/epic-core.md +16 -0
  185. package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-parser.md +16 -0
  186. package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-query.md +16 -0
  187. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/malformed-no-id.md +15 -0
  188. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-parse-unit.md +16 -0
  189. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-security-gate.md +16 -0
  190. package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-old.md +16 -0
  191. package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-parser.md +17 -0
  192. package/work-view/crates/core/tests/fixtures/golden/.work/backlog/idea-future-board.md +7 -0
  193. package/work-view/crates/core/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
  194. package/work-view/crates/core/tests/fixtures/precedence/.work/CONVENTIONS.md +10 -0
  195. package/work-view/crates/core/tests/fixtures/precedence/.work/archive/dup-item.md +18 -0
  196. package/work-view/crates/core/tests/fixtures/precedence/.work/releases/v2.0/dup-item.md +18 -0
  197. package/work-view/crates/core/tests/integration.rs +541 -0
  198. package/work-view/dist/.gitattributes +1 -0
  199. package/work-view/dist/README.md +42 -0
  200. package/work-view/dist/aarch64-apple-darwin/work-view +0 -0
  201. package/work-view/dist/aarch64-unknown-linux-musl/work-view +0 -0
  202. package/work-view/dist/x86_64-apple-darwin/work-view +0 -0
  203. package/work-view/dist/x86_64-unknown-linux-musl/work-view +0 -0
@@ -0,0 +1,211 @@
1
+ # Test Taxonomy
2
+
3
+ The four test styles `e2e-test-design` covers, with when-to-apply rules,
4
+ structural patterns, examples, and anti-patterns. Reference from SKILL.md
5
+ Phase 5b.
6
+
7
+ ## 1. Golden-path tests
8
+
9
+ **What:** Realistic, successful user journeys exercised end-to-end against
10
+ the containerized product.
11
+
12
+ **When to apply:** Always. Every project has golden paths. If you can't name
13
+ 3-5 critical journeys, the project's purpose is unclear and that's a prior
14
+ problem.
15
+
16
+ **Structural pattern:**
17
+
18
+ ```
19
+ Test: <user-intent name>
20
+ Setup: docker-compose stack up; seed data via fixtures
21
+ Journey: step-by-step what the user does (real CLI commands, HTTP requests,
22
+ UI actions)
23
+ Invariant: <one-line user-visible outcome that must hold>
24
+ Assertions: outputs, files created, DB rows, side effects — all user-visible
25
+ Teardown: stack down; volumes wiped
26
+ ```
27
+
28
+ **Example (HTTP API):**
29
+
30
+ ```
31
+ Test: User registers, logs in, creates a project, sees it in their dashboard
32
+ Invariant: After registration → login → POST /projects → GET /dashboard,
33
+ the new project ID appears in the dashboard response
34
+ Setup: stack up (postgres + redis + smtp4dev); seed empty
35
+ Steps: POST /register → POST /login → POST /projects → GET /dashboard
36
+ Assertions: 201 from register, 200 from login (cookie set), 201 from projects
37
+ with new id, 200 from dashboard listing the new id
38
+ ```
39
+
40
+ **Categories to cover:**
41
+ - First-use / happy path (install/start → first successful operation)
42
+ - Core workflows (the 3-5 things users do most)
43
+ - Configuration variations (different valid configs)
44
+ - Multi-step workflows (operations that build on each other)
45
+
46
+ **Anti-patterns:**
47
+ - Asserting on internal state instead of user-visible output
48
+ - Skipping the docker-compose stack and using in-memory substitutes
49
+ - Testing one endpoint at a time rather than a journey
50
+
51
+ ## 2. Failure-mode tests
52
+
53
+ **What:** Verify the product fails gracefully under predictable wrong
54
+ conditions — invalid input, missing config, unavailable deps, boundary
55
+ values, permission errors, interrupted operations.
56
+
57
+ **When to apply:** Always. Failure handling is where most production bugs
58
+ hide. Skipping failure-mode tests means shipping a product that's fragile in
59
+ exactly the way users will hit first.
60
+
61
+ **Structural pattern:**
62
+
63
+ ```
64
+ Test: <what goes wrong>
65
+ Setup: stack up; configure the failure condition (e.g., invalid input,
66
+ killed dep)
67
+ Action: user-equivalent operation
68
+ Invariant: <one-line: how the product should respond>
69
+ Assertions: error message format, exit code, HTTP status, NO corrupted state
70
+ Teardown: stack down; verify cleanup happened
71
+ ```
72
+
73
+ **Categories to cover:**
74
+
75
+ User mistakes:
76
+ - Invalid input (wrong types, out-of-range, malformed)
77
+ - Missing required args/config
78
+ - Wrong order of operations (e.g., login before register)
79
+ - Permission issues
80
+ - Conflicting flags
81
+
82
+ Bad environment:
83
+ - Missing dependencies (kill a container before the test)
84
+ - Network failures (via Toxiproxy)
85
+ - Disk full (mount a tiny tmpfs)
86
+ - Missing/corrupted config files
87
+
88
+ Boundary:
89
+ - Empty input
90
+ - Extremely large input
91
+ - Special characters
92
+ - Interrupted operations (SIGINT mid-operation)
93
+
94
+ **Example (DB unavailable):**
95
+
96
+ ```
97
+ Test: API returns 503 with retry hint when DB is unreachable
98
+ Setup: stack up; then `docker compose stop postgres`
99
+ Action: POST /projects
100
+ Invariant: User sees 503 with a Retry-After header; no half-written rows
101
+ Assertions: status==503, Retry-After present, no orphan rows after Postgres
102
+ comes back
103
+ ```
104
+
105
+ **Anti-patterns:**
106
+ - Asserting *that* an error occurred without asserting *what* the error said
107
+ - Mocking the dep instead of actually stopping it
108
+ - Skipping the state-corruption check (real value of these tests)
109
+
110
+ ## 3. Chaos tests
111
+
112
+ **What:** Verify graceful degradation, retry behavior, and recovery under
113
+ random failures injected into the running stack.
114
+
115
+ **When to apply:** When the system has retry / fallback / graceful-degrade /
116
+ circuit-breaker / failover behaviors. **If the system has none of those,
117
+ chaos tests have nothing to verify.** Don't add chaos tests just to have
118
+ them — fix the missing resilience features first, or skip this layer.
119
+
120
+ **Common injection patterns:**
121
+
122
+ | Failure | Tool |
123
+ |---|---|
124
+ | Network latency | Toxiproxy (`latency` toxic) |
125
+ | Connection drop | Toxiproxy (`down` toxic), `docker compose pause` |
126
+ | Packet loss | Toxiproxy (`limit_data`, `bandwidth` toxics) |
127
+ | Container kill | Pumba (`pumba kill`) |
128
+ | Container pause | Pumba (`pumba pause`) |
129
+ | Clock skew | libfaketime (`LD_PRELOAD`) |
130
+ | Disk full | small tmpfs mount |
131
+ | CPU starvation | `docker update --cpus 0.1` |
132
+
133
+ **Structural pattern:**
134
+
135
+ ```
136
+ Test: <golden-path journey> survives <injected failure>
137
+ Setup: stack up; start the journey; inject failure mid-journey
138
+ Action: continue the journey
139
+ Invariant: <one-line: what graceful behavior must hold — retry succeeds,
140
+ degraded mode kicks in, error is clean, no data loss>
141
+ Assertions: final outcome matches invariant; no corrupted state
142
+ ```
143
+
144
+ **Example (retry on latency):**
145
+
146
+ ```
147
+ Test: Checkout completes despite 500ms upstream latency
148
+ Setup: stack up; Toxiproxy adds 500ms latency to the payment-gateway mock
149
+ Action: full checkout journey
150
+ Invariant: Checkout succeeds within the configured retry budget (3 attempts);
151
+ order row created; no duplicate charges
152
+ Assertions: order exists, exactly one charge row, response time < 5s
153
+ ```
154
+
155
+ **Anti-patterns:**
156
+ - Injecting a failure with no defined behavior to verify (the test passes if
157
+ *anything* happens — useless)
158
+ - Injecting at points the system was never designed to handle (testing wishes,
159
+ not contracts)
160
+ - Making chaos tests non-deterministic without seeding the chaos (then
161
+ failures aren't reproducible)
162
+
163
+ ## 4. Fuzzing tests
164
+
165
+ **What:** Generate inputs from a strategy and verify properties hold for all
166
+ generated inputs. Catches edge cases human-written tests miss.
167
+
168
+ **When to apply:** When the system has clear input boundaries — parsers,
169
+ serializers, validators, query builders, codec/encoding layers,
170
+ state-machine transition functions. Don't apply to systems whose only
171
+ "input" is high-level user intent (no parseable contract).
172
+
173
+ **Three flavors:**
174
+
175
+ | Flavor | Tooling | Use when |
176
+ |---|---|---|
177
+ | Property-based | Hypothesis (Python), fast-check (JS/TS), proptest (Rust), QuickCheck (Haskell/Erlang) | Inputs have a generative shape; you can state a property that must hold for all inputs |
178
+ | Mutation | AFL++, libFuzzer, Jazzer (Java) | Inputs are binary or close to it; you have a corpus of valid seeds; you want crash discovery |
179
+ | Grammar-based | Atheris with grammar, custom generators on Hypothesis | Inputs follow a formal grammar (SQL, JSON, protocol messages) |
180
+
181
+ **Structural pattern (property-based):**
182
+
183
+ ```
184
+ Test: parse(serialize(x)) == x for all x of shape T
185
+ Strategy: generate x from the shape (Hypothesis @given, fc.assert)
186
+ Invariant: round-trip preserves identity
187
+ Assertions: the property; shrinking reproduces minimal failing case
188
+ ```
189
+
190
+ **Properties worth fuzzing:**
191
+ - Round-trip: `decode(encode(x)) == x`
192
+ - Idempotence: `f(f(x)) == f(x)`
193
+ - Commutativity: `merge(a, b) == merge(b, a)`
194
+ - Invariants: result.size >= input.size, sum(parts) == whole
195
+ - Negative space: malformed input never produces a panic / exception leak
196
+
197
+ **Example (HTTP parser round-trip):**
198
+
199
+ ```
200
+ Test: parse_request(format_request(req)) == req for arbitrary valid requests
201
+ Strategy: Hypothesis generates valid request structs (method, headers, body)
202
+ Invariant: round-trip preserves the request semantically
203
+ Assertions: structural equality after the round-trip
204
+ ```
205
+
206
+ **Anti-patterns:**
207
+ - Fuzzing without a property to assert (just running random inputs through
208
+ a function and noting it didn't crash — that's coverage theater)
209
+ - Fuzzing with too-strict generators (every generated input is trivially
210
+ valid; the bugs hide in the inputs you excluded)
211
+ - Not seeding the random source (failures aren't reproducible)
@@ -0,0 +1,476 @@
1
+ ---
2
+ name: epic-design
3
+ description: >
4
+ ALWAYS invoke this skill when the user asks to design, decompose, or pick up an epic at
5
+ stage:drafting. Reads the epic, foundation docs, and codebase; identifies child feature arcs; writes
6
+ feature files with parent and depends_on metadata; updates the epic body with the realized
7
+ decomposition; and advances drafting to implementing. When ux-ui-design is installed, includes
8
+ mockup planning for net-new screens and journeys.
9
+ ---
10
+
11
+ # Epic-Design
12
+
13
+ You design an epic in the agile-workflow substrate. The decomposition lives in
14
+ the epic item's body (replacing the provisional "Anticipated child features"
15
+ sketch with the realized list), and child feature files are spawned at
16
+ `.work/active/features/` with declared `depends_on` chains. When the
17
+ decomposition is done, you advance the epic's stage `drafting → implementing`.
18
+
19
+ This skill is the design-family entry point for `kind: epic`. The downstream
20
+ feature-design family (`design`, `refactor-design`, `perf-design`) then runs
21
+ on each child feature individually.
22
+
23
+ ## Trigger
24
+
25
+ Auto-triggers when the agent identifies an epic at `stage: drafting` ready for
26
+ decomposition — often inside an active autopilot goal.
27
+ Common phrases:
28
+ - "design epic X"
29
+ - "decompose this epic"
30
+ - "this epic is ready to break down"
31
+
32
+ User-invocable too when the user wants to break down a specific epic without
33
+ running full autopilot.
34
+
35
+ ## Invocation modes
36
+
37
+ | Invocation | Behavior |
38
+ |---|---|
39
+ | `epic-design <id>` (default) | Full design pass on one epic — workflow Phases 1-7. |
40
+ | `epic-design --only-questions <id>` | Question-only pass on one epic — runs read/ground phases, surfaces strategic ambiguities (Phase 4.7), captures answers under `## Design decisions`, does NOT decompose or advance stage. |
41
+ | `epic-design --only-questions <id1> <id2> ...` | Question-only pass over each listed epic, in order. |
42
+ | `epic-design --only-questions --all` | Question-only pass over every epic at `stage: drafting` in `.work/active/epics/`. Iterate in dependency order. |
43
+
44
+ `--only-questions` mode requires interactive mode — refuse to run when an
45
+ active autopilot run or harness goal is driving the session (matches
46
+ feature-design's rule). When the design family runs later, captured answers are
47
+ inherited from each epic body, so autopilot no longer has to use judgment on
48
+ those points.
49
+
50
+ ## Anti-patterns
51
+
52
+ These mirror `epicize`'s anti-patterns at the next level down:
53
+
54
+ - **Don't produce a phase plan.** Features are containment shapes, not temporal
55
+ slots. Use the dependency graph; let the autopilot pick what's ready.
56
+ - **Don't split by layer.** Feature-DB / Feature-API / Feature-UI under one
57
+ epic is an anti-pattern unless the layers are genuinely independent
58
+ deliverables. Split by capability.
59
+ - **Don't pad with refactor or test features.** Refactoring happens incrementally
60
+ via `/agile-workflow:refactor-design` on tagged features when actual smells
61
+ surface. Don't manufacture features for either.
62
+ - **Don't design the features.** That's the per-feature design pass. Here you
63
+ write a brief and declare dependencies — the feature body fills in interfaces,
64
+ signatures, and test approach when its own design pass runs.
65
+ - **Don't pre-bind to releases.** Child features get `release_binding: null`.
66
+ - **Don't pre-populate child feature stages beyond `drafting`.** Stage advances
67
+ through actual work.
68
+
69
+ ## Workflow — `--only-questions` mode
70
+
71
+ Use this path when invoked with `--only-questions`. Iterate over the target set
72
+ (one epic, an explicit list, or every drafting epic under `--all`):
73
+
74
+ For each epic:
75
+ 1. Read the epic file; skip if `kind` is not `epic` or `stage` is not `drafting`
76
+ 2. Ground yourself (Phase 2 below — foundation docs + AGENTS.md / CLAUDE.md + parent if any; AGENTS is canonical)
77
+ 3. Map the codebase lightly — direct Read/Glob/Grep first; use one Task
78
+ Explore over the epic's area only when local reading leaves a real unknown
79
+ 4. **Run Phase 4.6 (UI surface alignment)** — `--only-questions` is the
80
+ visual alignment gate, not just the textual one. When `ux-ui-design` is
81
+ installed, run the full Phase 4.6 pass; reference resulting paths in
82
+ the epic body's `## Mockups` section.
83
+ 5. Run Phase 4.7 (Surface high-level design ambiguities) in the interactive
84
+ branch, always using `structured question tool`
85
+ 6. Capture answers under `## Design decisions` in the epic body (merge with
86
+ existing entries; don't overwrite without flagging)
87
+ 7. Do NOT decompose into child features or advance stage
88
+ 8. Commit per epic: `epic-design --only-questions: <id>`
89
+
90
+ Requires interactive mode; refuse to run under an active autopilot run or goal.
91
+ Do not run cross-model advisory review in this mode — the user is the alignment
92
+ signal.
93
+
94
+ ## Workflow
95
+
96
+ ### Phase 1: Read the epic
97
+
98
+ Read `.work/active/epics/<id>.md`. Confirm:
99
+ - `kind: epic`
100
+ - `stage: drafting`
101
+ - No direct children yet (see Phase 1.5)
102
+
103
+ Note the epic's `tags` — if `[refactor]` or `[perf]`, propagate the tag to
104
+ child features so the right design-family skill picks them up.
105
+
106
+ ### Phase 1.5: Children-already-exist short-circuit
107
+
108
+ Run:
109
+
110
+ ```bash
111
+ .work/bin/work-view --parent <epic-id> --paths
112
+ ```
113
+
114
+ If direct children already exist, the decomposition was done previously (manually
115
+ via `scope`, or by an upstream skill like `bold-refactor`). Don't re-decompose.
116
+ Instead:
117
+
118
+ 1. Verify the children form a coherent decomposition (every child has a
119
+ sensible `parent: <epic-id>`, no obvious capability gaps relative to the
120
+ brief).
121
+ 2. Append a short note to the epic body: "Decomposition pre-existed — N child
122
+ features, listed below."
123
+ 3. Advance epic stage `drafting → implementing` and commit.
124
+ 4. Skip Phases 2-7. Go to Output.
125
+
126
+ ### Phase 2: Ground yourself
127
+
128
+ The principles skill auto-loads — both code-design (Ports & Adapters, SSOT,
129
+ Generated Contracts, Fail Fast) and substrate-execution (Item-IS-the-Work,
130
+ Rolling-Foundation, Late-Binding) are active.
131
+
132
+ Read:
133
+ 1. `docs/VISION.md`, `docs/SPEC.md`, `docs/ARCHITECTURE.md` — foundation that
134
+ constrains this epic
135
+ 2. `AGENTS.md` / `CLAUDE.md` (project conventions; AGENTS is canonical)
136
+ 2a. `.agents/rules/*.md` (if present) — the project's force-loaded agent rules
137
+ (tag semantics, test integrity, review policy)
138
+ 3. `docs/PRINCIPLES.md` if it exists
139
+ 4. The epic's parent if `parent` is set (rare — epics usually top-level)
140
+ 5. Sibling epics in `.work/active/epics/` — to see what they cover and avoid
141
+ straddling boundaries
142
+ 6. Research docs in `docs/research/` for any libraries the epic mentions
143
+ that you haven't verified
144
+
145
+ ### Phase 3: Map the codebase
146
+
147
+ Run a read-first scope-size probe before spawning exploratory sub-agents:
148
+
149
+ 1. Use Glob/`rg --files` to identify likely directories, entry points, active
150
+ sibling work, and tests.
151
+ 2. Use Grep/`rg` for epic terms, capability names, exported types, route names,
152
+ and shared integration points.
153
+ 3. Read 2-5 representative source, test, and sibling item files yourself.
154
+
155
+ Then choose the dispatch size:
156
+
157
+ - **Small/bounded epic** — one known subsystem with obvious seams: skip exploratory fanout
158
+ and map it directly.
159
+ - **Medium/unclear epic** — one area but missing ownership or dependency
160
+ clarity: spawn one read-only exploratory sub-agent.
161
+ - **Broad/cross-cutting epic** — several independent surfaces or sibling-work
162
+ interactions: spawn parallel read-only exploratory sub-agents.
163
+
164
+ For exploratory fanout:
165
+ - Use the host's generic/general-purpose subagent prompted with the explorer
166
+ capsule from `../principles/references/subagents.md`, at medium reasoning by
167
+ default.
168
+ - Use high or strongest reviewer reasoning for large or complex codebases.
169
+ - If no generic subagent adapter is available, keep direct host-local mapping.
170
+
171
+ Possible prompts:
172
+ 1. **Existing surface in this epic's area** — what modules, components, or
173
+ integration points already exist that this epic will extend or touch?
174
+ Report file paths and brief responsibility per finding.
175
+ 2. **Cross-cutting touchpoints** — what areas does this epic interact with
176
+ (auth, persistence, transport, UI shell, etc.)? Each touchpoint is a
177
+ candidate for a dedicated feature OR a constraint on existing features.
178
+ 3. **Already-scoped sibling work** — features and stories under sibling epics
179
+ in `.work/active/`. Report any overlap or shared types that imply a
180
+ dependency edge from this epic's children to a sibling epic.
181
+
182
+ After direct reading or Explore results, **read 2-3 key source files yourself**
183
+ to verify findings.
184
+
185
+ ### Phase 4: Identify feature arcs
186
+
187
+ Look for natural decomposition seams within the epic:
188
+
189
+ - The epic body's "Anticipated child features" sketch (if any) is your seed —
190
+ it's provisional, but the user wrote it for a reason. Honor the spirit, refine
191
+ the shape.
192
+ - Foundation-doc sections within the epic's scope often map to features.
193
+ - Capability arcs from the brief — "users can do X" usually maps to one feature;
194
+ "system supports Y constraint" might be its own feature or fold into an
195
+ existing one.
196
+ - Sequencing implied by the brief or the architecture (foundation systems
197
+ before consumers, contracts before clients) — these become `depends_on`
198
+ edges.
199
+
200
+ **Sizing rule (from epicize, mirrored down a level):** each child feature
201
+ should fit comfortably in one `/agile-workflow:feature-design` →
202
+ `/agile-workflow:implement` pass — 5-15 implementation units. If a single
203
+ candidate feature would need more, split it. If candidates feel tiny (1-2
204
+ units each), collapse them into one feature.
205
+
206
+ Aim for 2-6 child features per epic. Fewer than 2 means the epic was probably
207
+ sized as a feature; flag the user. More than 6 means you're slicing too thin;
208
+ collapse.
209
+
210
+ ### Phase 4.5: Identify cross-feature dependencies
211
+
212
+ For each candidate feature, ask:
213
+ - What must be done first before this can be designed and implemented?
214
+ - Does this feature share types or contracts with another candidate? If yes,
215
+ the producer of the type is a `depends_on`.
216
+ - Independent features (no shared types, no cross-cutting concerns) have no
217
+ dependencies and can be parallelized by autopilot.
218
+
219
+ Cycle check: for every candidate `depends_on` edge, verify no cycle. Once the
220
+ child files exist (Phase 6) you'll re-check via `work-view --blocking`. For
221
+ now, sanity-check by hand.
222
+
223
+ ### Phase 4.6: UI surface alignment (PRIMARY mockup tier — runs when ux-ui-design is installed)
224
+
225
+ This is the primary mockup tier per `ux-ui-principles`. Run the full UI
226
+ alignment pass against the candidate arcs from Phase 4. Err on mocking —
227
+ `feature-design` Phase 4.6 is the fallback, not a planned second pass.
228
+
229
+ 1. **Palette** — if `.mockups/design-system/tokens.css` doesn't exist,
230
+ invoke `/ux-ui-design:palette` first so subsequent mocks inherit tokens.
231
+ 2. **Screens** — for every candidate feature with a net-new screen, page,
232
+ modal, or major component, invoke `/ux-ui-design:screens <feature-id>`
233
+ using the future child feature id (e.g. `epic-auth-login`).
234
+ 3. **Flows** — for every multi-screen journey within the epic, invoke
235
+ `/ux-ui-design:flows <flow-name>`.
236
+ 4. **Existing-surface composition / no UI** — skip.
237
+
238
+ The `screens`/`flows` skills write a `## Mockups` section into each item
239
+ body automatically; reference those paths from the child feature briefs in
240
+ Phase 6 so `feature-design` inherits direction by reference.
241
+
242
+ **Caller awareness.** Under autopilot delegation, the mockup skills cannot
243
+ run (they need interactive input). Append a `## UI alignment deferred`
244
+ note to the epic body listing the surfaces, recommend the user run
245
+ `/agile-workflow:epic-design --only-questions <epic-id>`, and continue
246
+ decomposition. Child briefs note "mockups pending — see parent epic" so
247
+ `feature-design` knows to fall back. Every other invocation runs in full.
248
+
249
+ Skip this phase entirely if `ux-ui-design` is not installed.
250
+
251
+ ### Phase 4.7: Surface high-level design ambiguities
252
+
253
+ Read the epic and the candidate decomposition you've sketched, and derive
254
+ specific, concrete high-level design questions about *this* epic's actual
255
+ work. These are the directional choices that, if locked in now, will keep
256
+ every child feature's later design pass aligned. Examples of the *shape* of
257
+ question to surface (the actual content must come from the epic):
258
+
259
+ - "For this epic's auth surface, do we use OAuth via the existing provider,
260
+ or roll a local session model?"
261
+ - "Should the new sync engine push from server to client, pull from client
262
+ on-demand, or both?"
263
+ - "Are we committing to multi-tenant data isolation in this epic, or is
264
+ single-tenant acceptable for v1?"
265
+ - "Does the import pipeline need to handle CSV and Parquet, or just CSV?"
266
+
267
+ These are product/architecture/scope questions specific to the epic in
268
+ front of you — not generic prompts about boundaries, naming, or sizing.
269
+ Skip anything you can answer from the epic body, foundation docs, or
270
+ codebase. Skip anything that's safely a downstream feature-design call
271
+ (function signatures, exact file paths, per-unit test approach).
272
+
273
+ Aim for the smallest set of questions that meaningfully resolve direction
274
+ — typically 2-5. Zero is fine if the epic body and foundation docs already
275
+ pin every directional choice.
276
+
277
+ **Cross-model advisory review under autopilot.** If this skill is running as a
278
+ delegation from active autopilot, the epic has large/risky architectural
279
+ decisions, and the body does not already contain useful `## Design decisions`
280
+ from a prior `--only-questions` pass, apply the cross-model advisory review
281
+ policy from `principles/SKILL.md` before resolving the questions yourself.
282
+
283
+ Use one focused `peer` pass only when a different model class is available.
284
+ Ask for missing questions, risks, ambiguous constraints, and alternatives for
285
+ this epic's decomposition — not for a final verdict. Do not run the multi-pass
286
+ `peer-review` loop during routine autopilot design. If peeragent is
287
+ unavailable, the peer would use the same model class, or the invocation fails,
288
+ continue with host judgment and note that the advisory pass was skipped.
289
+ If the peeragent target is Claude Opus, allow 10 to 30 minutes for a large
290
+ review; no return after a few minutes is not evidence that it has hung.
291
+
292
+ Summarize the useful output under `## Other agent review` in the epic body and
293
+ fold accepted questions/risks into the decisions you log. Do not paste the peer
294
+ transcript into the item.
295
+
296
+ If this skill is running **as a delegation from an active autopilot run or
297
+ harness goal**, resolve each question with judgment (prioritize: consistent
298
+ with foundation docs > simpler option > defers irreversible decisions) and log
299
+ under `## Design decisions` in the epic body:
300
+
301
+ ```markdown
302
+ ## Design decisions
303
+ - **<question>**: <choice> — <one-line rationale>
304
+ ```
305
+
306
+ In every other invocation — including direct user invocation under harness
307
+ auto mode (`permissions.defaultMode: "auto"`) — ask the user via
308
+ `structured question tool` before locking in, then write the answers under `## Design
309
+ decisions` in the epic body. Harness-level "work without pausing" reminders
310
+ do **not** suppress these checkpoints. See `principles/SKILL.md` Part III
311
+ for the full caller-awareness rule.
312
+
313
+ The child feature briefs you write in Phase 6 should reference the relevant
314
+ design decisions so each feature's later design pass inherits the locked-in
315
+ direction.
316
+
317
+ The exception under autopilot: a 50/50 between two large irreversible
318
+ choices (e.g., SQL vs document store for this epic's persistence layer).
319
+ Append a `## Blocker` section and return without advancing — autopilot will
320
+ skip and surface the blocker.
321
+
322
+ ### Phase 5: Pre-mortem
323
+
324
+ Before writing files, attack the decomposition:
325
+ - What's the riskiest feature? Is it sized correctly?
326
+ - What capability is least clearly assigned to a feature? Is there a gap?
327
+ - Are any features so tightly coupled they should be one feature?
328
+ - Does the dependency chain create a critical path that defeats the parallelism
329
+ intent?
330
+
331
+ Revise the decomposition if anything surfaces. Document discovered risks in a
332
+ `## Decomposition risks` section in the epic body.
333
+
334
+ ### Phase 6: Write child feature files
335
+
336
+ For each child feature, create `.work/active/features/<feature-id>.md`:
337
+
338
+ ```yaml
339
+ ---
340
+ id: <epic-slug>-<feature-slug>
341
+ kind: feature
342
+ stage: drafting
343
+ tags: [<inherited from epic if [refactor] or [perf]>, ...]
344
+ parent: <epic-id>
345
+ depends_on: [<feature-id>, ...]
346
+ release_binding: null
347
+ gate_origin: null
348
+ created: YYYY-MM-DD
349
+ updated: YYYY-MM-DD
350
+ ---
351
+
352
+ # <Feature Name>
353
+
354
+ ## Brief
355
+ <two to three paragraphs: what this feature delivers within the epic, what
356
+ capability it covers, why it exists in this epic, what it does NOT cover>
357
+
358
+ ## Epic context
359
+ - Parent epic: `<epic-id>`
360
+ - Position in epic: <e.g., "foundation feature — others depend on its types"
361
+ / "consumer of feature-X" / "independent capability">
362
+
363
+ ## Foundation references
364
+ - `docs/VISION.md` — relevant section(s) (only if directly relevant)
365
+ - `docs/ARCHITECTURE.md` — relevant component(s)
366
+ - (other foundation docs as relevant)
367
+
368
+ ## Mockups
369
+ <!-- Only present when Phase 4.6 produced or inherited mocks covering this
370
+ feature. Reference the parent epic's chosen options by path; do NOT re-mock
371
+ at the feature tier. -->
372
+ - Inherits design system: `.mockups/design-system/tokens.css`
373
+ - Screens: `.mockups/screens/<feature-id>/index.html` — selected option-N
374
+ - Flow (if applicable): `.mockups/flows/<flow-name>/index.html`
375
+
376
+ <!-- The design pass on this feature (`/agile-workflow:feature-design`,
377
+ refactor-design, or perf-design) will fill in interfaces, signatures, and
378
+ implementation units. -->
379
+ ```
380
+
381
+ Naming convention: `<epic-slug>-<feature-slug>` — e.g., epic `epic-auth`
382
+ spawns features `epic-auth-login`, `epic-auth-session`, `epic-auth-recovery`.
383
+ This makes parent-child relationships obvious from filenames at a glance.
384
+
385
+ ### Phase 6.5: Cycle check
386
+
387
+ For every child feature with non-empty `depends_on`, run:
388
+
389
+ ```bash
390
+ .work/bin/work-view --blocking <feature-id> --paths
391
+ ```
392
+
393
+ If any candidate dependency appears in that output, the edge would create a
394
+ cycle. Drop or reroute the edge before continuing.
395
+
396
+ ### Phase 7: Write decomposition INTO epic body
397
+
398
+ Update the epic file. Replace the provisional "Anticipated child features"
399
+ section (if present) with a `## Decomposition` section listing the realized
400
+ features:
401
+
402
+ ```markdown
403
+ ## Decomposition
404
+
405
+ <one-paragraph summary of the chosen decomposition and why this shape over
406
+ alternatives — e.g., "Split by capability: login flow, session handling, and
407
+ recovery are independent enough to parallelize after the shared session-type
408
+ feature lands.">
409
+
410
+ ### Child features
411
+
412
+ - `<feature-id-1>` — <one-line description> — depends on: `[]`
413
+ - `<feature-id-2>` — <one-line description> — depends on: `[<feature-id-1>]`
414
+ - `<feature-id-3>` — <one-line description> — depends on: `[<feature-id-1>]`
415
+
416
+ ### Decomposition risks
417
+
418
+ <from pre-mortem, if any. Otherwise omit the section.>
419
+ ```
420
+
421
+ Do NOT write design content (interfaces, signatures, test plans) into the epic
422
+ body. That's feature-level work.
423
+
424
+ ### Phase 8: Advance epic stage and commit
425
+
426
+ 1. Edit the epic file's frontmatter: `stage: drafting → implementing`. The
427
+ PostToolUse hook auto-bumps `updated:`.
428
+ 2. Commit:
429
+
430
+ ```bash
431
+ git add .work/active/epics/<epic-id>.md .work/active/features/<epic-id>-*.md
432
+ git commit -m "epic-design: <epic-id> (<N> child features)"
433
+ ```
434
+
435
+ ## Output
436
+
437
+ In conversation:
438
+ - **Decomposed**: `<epic-id>` advanced to `stage: implementing`
439
+ - **Child features**: list with `depends_on` chains, e.g.:
440
+ - `epic-auth-session` — depends on: `[]`
441
+ - `epic-auth-login` — depends on: `[epic-auth-session]`
442
+ - `epic-auth-recovery` — depends on: `[epic-auth-session]`
443
+ - **Tags propagated**: list (or "none — greenfield")
444
+ - **Decomposition risks flagged**: list (or "none")
445
+ - **Next**: each child feature is at `stage: drafting` ready for the
446
+ feature-design family (`/agile-workflow:feature-design`,
447
+ `/agile-workflow:refactor-design`, or `/agile-workflow:perf-design` based on
448
+ tags). Autopilot will pick them up automatically.
449
+
450
+ ## Guardrails
451
+
452
+ - The decomposition lives in the epic's body. NEVER create
453
+ `docs/designs/epic-<name>.md` — that's a workflow-plugin pattern;
454
+ agile-workflow uses item-IS-the-work.
455
+ - **Phase 4.6 is the primary UI/UX mockup tier.** Don't defer net-new
456
+ surfaces to `feature-design` — its mockup phase is a fallback only.
457
+ - **`--only-questions` always runs the mockup pass** — that mode IS the
458
+ visual alignment gate.
459
+ - Child features are at `stage: drafting` — they get DESIGNED next, not
460
+ implemented next. Don't pre-populate them at `implementing`.
461
+ - Don't write feature-level design content (interfaces, signatures, tests)
462
+ into the epic body or the child feature briefs. That belongs in each
463
+ feature's own design pass.
464
+ - Propagate `[refactor]` or `[perf]` tags from the epic to child features so
465
+ the right design-family skill picks them up. Greenfield epics produce
466
+ greenfield features.
467
+ - Aim for 2-6 child features per epic. Outside that range, ask whether the
468
+ epic is sized correctly.
469
+ - Cycle prevention is mandatory for `depends_on`. Use `work-view --blocking`.
470
+ - If the epic already has direct children (Phase 1.5), short-circuit — advance
471
+ the stage and stop. Don't re-decompose work the user or another skill
472
+ already did.
473
+ - Don't pre-bind child features to releases. `release_binding` stays `null`
474
+ until `/agile-workflow:release-deploy` runs.
475
+ - Don't manufacture refactor/test/deployment features just to have them.
476
+ Those surface organically from gates and refactor-tagged work.