bigpowers 2.2.0 → 2.4.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 (147) hide show
  1. package/.pi/package.json +16 -0
  2. package/.pi/prompts/assess-impact.md +76 -0
  3. package/.pi/prompts/audit-code.md +156 -0
  4. package/.pi/prompts/build-epic.md +44 -0
  5. package/.pi/prompts/change-request.md +105 -0
  6. package/.pi/prompts/commit-message.md +135 -0
  7. package/.pi/prompts/compose-workflow.md +40 -0
  8. package/.pi/prompts/craft-skill.md +150 -0
  9. package/.pi/prompts/deepen-architecture.md +235 -0
  10. package/.pi/prompts/define-language.md +79 -0
  11. package/.pi/prompts/define-success.md +62 -0
  12. package/.pi/prompts/delegate-task.md +76 -0
  13. package/.pi/prompts/design-interface.md +96 -0
  14. package/.pi/prompts/develop-tdd.md +375 -0
  15. package/.pi/prompts/diagnose-root.md +23 -0
  16. package/.pi/prompts/dispatch-agents.md +83 -0
  17. package/.pi/prompts/edit-document.md +22 -0
  18. package/.pi/prompts/elaborate-spec.md +81 -0
  19. package/.pi/prompts/enforce-first.md +77 -0
  20. package/.pi/prompts/evolve-skill.md +38 -0
  21. package/.pi/prompts/execute-plan.md +54 -0
  22. package/.pi/prompts/fix-bug.md +36 -0
  23. package/.pi/prompts/grill-me.md +95 -0
  24. package/.pi/prompts/grill-with-docs.md +37 -0
  25. package/.pi/prompts/guard-git.md +212 -0
  26. package/.pi/prompts/hook-commits.md +93 -0
  27. package/.pi/prompts/inspect-quality.md +105 -0
  28. package/.pi/prompts/investigate-bug.md +117 -0
  29. package/.pi/prompts/kickoff-branch.md +99 -0
  30. package/.pi/prompts/map-codebase.md +70 -0
  31. package/.pi/prompts/migrate-spec.md +482 -0
  32. package/.pi/prompts/model-domain.md +227 -0
  33. package/.pi/prompts/orchestrate-project.md +161 -0
  34. package/.pi/prompts/organize-workspace.md +159 -0
  35. package/.pi/prompts/plan-refactor.md +77 -0
  36. package/.pi/prompts/plan-release.md +145 -0
  37. package/.pi/prompts/plan-work.md +161 -0
  38. package/.pi/prompts/release-branch.md +158 -0
  39. package/.pi/prompts/request-review.md +70 -0
  40. package/.pi/prompts/research-first.md +62 -0
  41. package/.pi/prompts/reset-baseline.md +20 -0
  42. package/.pi/prompts/respond-review.md +70 -0
  43. package/.pi/prompts/run-evals.md +56 -0
  44. package/.pi/prompts/run-planning.md +26 -0
  45. package/.pi/prompts/scope-work.md +23 -0
  46. package/.pi/prompts/search-skills.md +21 -0
  47. package/.pi/prompts/seed-conventions.md +132 -0
  48. package/.pi/prompts/session-state.md +146 -0
  49. package/.pi/prompts/setup-environment.md +23 -0
  50. package/.pi/prompts/simulate-agents.md +25 -0
  51. package/.pi/prompts/slice-tasks.md +23 -0
  52. package/.pi/prompts/spike-prototype.md +94 -0
  53. package/.pi/prompts/stocktake-skills.md +40 -0
  54. package/.pi/prompts/survey-context.md +129 -0
  55. package/.pi/prompts/terse-mode.md +37 -0
  56. package/.pi/prompts/trace-requirement.md +68 -0
  57. package/.pi/prompts/using-bigpowers.md +105 -0
  58. package/.pi/prompts/validate-fix.md +98 -0
  59. package/.pi/prompts/verify-work.md +125 -0
  60. package/.pi/prompts/visual-dashboard.md +51 -0
  61. package/.pi/prompts/wire-observability.md +92 -0
  62. package/.pi/prompts/write-document.md +244 -0
  63. package/.pi/skills/assess-impact/SKILL.md +77 -0
  64. package/.pi/skills/audit-code/SKILL.md +157 -0
  65. package/.pi/skills/build-epic/SKILL.md +45 -0
  66. package/.pi/skills/change-request/SKILL.md +106 -0
  67. package/.pi/skills/commit-message/SKILL.md +136 -0
  68. package/.pi/skills/compose-workflow/SKILL.md +41 -0
  69. package/.pi/skills/craft-skill/SKILL.md +151 -0
  70. package/.pi/skills/deepen-architecture/SKILL.md +236 -0
  71. package/.pi/skills/define-language/SKILL.md +80 -0
  72. package/.pi/skills/define-success/SKILL.md +63 -0
  73. package/.pi/skills/delegate-task/SKILL.md +77 -0
  74. package/.pi/skills/design-interface/SKILL.md +97 -0
  75. package/.pi/skills/develop-tdd/SKILL.md +376 -0
  76. package/.pi/skills/diagnose-root/SKILL.md +24 -0
  77. package/.pi/skills/dispatch-agents/SKILL.md +84 -0
  78. package/.pi/skills/edit-document/SKILL.md +23 -0
  79. package/.pi/skills/elaborate-spec/SKILL.md +82 -0
  80. package/.pi/skills/enforce-first/SKILL.md +78 -0
  81. package/.pi/skills/evolve-skill/SKILL.md +39 -0
  82. package/.pi/skills/execute-plan/SKILL.md +55 -0
  83. package/.pi/skills/fix-bug/SKILL.md +37 -0
  84. package/.pi/skills/grill-me/SKILL.md +96 -0
  85. package/.pi/skills/grill-with-docs/SKILL.md +38 -0
  86. package/.pi/skills/guard-git/SKILL.md +213 -0
  87. package/.pi/skills/hook-commits/SKILL.md +94 -0
  88. package/.pi/skills/inspect-quality/SKILL.md +106 -0
  89. package/.pi/skills/investigate-bug/SKILL.md +118 -0
  90. package/.pi/skills/kickoff-branch/SKILL.md +100 -0
  91. package/.pi/skills/map-codebase/SKILL.md +71 -0
  92. package/.pi/skills/migrate-spec/SKILL.md +483 -0
  93. package/.pi/skills/model-domain/SKILL.md +228 -0
  94. package/.pi/skills/orchestrate-project/SKILL.md +162 -0
  95. package/.pi/skills/organize-workspace/SKILL.md +160 -0
  96. package/.pi/skills/plan-refactor/SKILL.md +78 -0
  97. package/.pi/skills/plan-release/SKILL.md +146 -0
  98. package/.pi/skills/plan-work/SKILL.md +162 -0
  99. package/.pi/skills/release-branch/SKILL.md +159 -0
  100. package/.pi/skills/request-review/SKILL.md +71 -0
  101. package/.pi/skills/research-first/SKILL.md +63 -0
  102. package/.pi/skills/reset-baseline/SKILL.md +21 -0
  103. package/.pi/skills/respond-review/SKILL.md +71 -0
  104. package/.pi/skills/run-evals/SKILL.md +57 -0
  105. package/.pi/skills/run-planning/SKILL.md +27 -0
  106. package/.pi/skills/scope-work/SKILL.md +24 -0
  107. package/.pi/skills/search-skills/SKILL.md +22 -0
  108. package/.pi/skills/seed-conventions/SKILL.md +133 -0
  109. package/.pi/skills/session-state/SKILL.md +147 -0
  110. package/.pi/skills/setup-environment/SKILL.md +24 -0
  111. package/.pi/skills/simulate-agents/SKILL.md +26 -0
  112. package/.pi/skills/slice-tasks/SKILL.md +24 -0
  113. package/.pi/skills/spike-prototype/SKILL.md +95 -0
  114. package/.pi/skills/stocktake-skills/SKILL.md +41 -0
  115. package/.pi/skills/survey-context/SKILL.md +130 -0
  116. package/.pi/skills/terse-mode/SKILL.md +38 -0
  117. package/.pi/skills/trace-requirement/SKILL.md +69 -0
  118. package/.pi/skills/using-bigpowers/SKILL.md +106 -0
  119. package/.pi/skills/validate-fix/SKILL.md +99 -0
  120. package/.pi/skills/verify-work/SKILL.md +126 -0
  121. package/.pi/skills/visual-dashboard/SKILL.md +52 -0
  122. package/.pi/skills/wire-observability/SKILL.md +93 -0
  123. package/.pi/skills/write-document/SKILL.md +245 -0
  124. package/CHANGELOG.md +14 -0
  125. package/README.md +27 -1
  126. package/deepen-architecture/SKILL.md +2 -0
  127. package/define-language/SKILL.md +2 -0
  128. package/diagnose-root/SKILL.md +2 -0
  129. package/edit-document/SKILL.md +2 -0
  130. package/fix-bug/SKILL.md +3 -1
  131. package/grill-me/SKILL.md +3 -1
  132. package/grill-with-docs/SKILL.md +3 -1
  133. package/investigate-bug/SKILL.md +5 -11
  134. package/map-codebase/SKILL.md +3 -1
  135. package/model-domain/SKILL.md +2 -0
  136. package/package.json +11 -2
  137. package/plan-release/SKILL.md +1 -1
  138. package/plan-work/SKILL.md +3 -1
  139. package/release-branch/SKILL.md +4 -2
  140. package/run-planning/SKILL.md +3 -2
  141. package/scope-work/SKILL.md +3 -1
  142. package/scripts/sync-skills.sh +48 -3
  143. package/scripts/validate-doctrine.sh +24 -9
  144. package/seed-conventions/SKILL.md +2 -0
  145. package/slice-tasks/SKILL.md +3 -1
  146. package/survey-context/SKILL.md +3 -1
  147. package/write-document/SKILL.md +2 -0
@@ -0,0 +1,96 @@
1
+ ---
2
+ description: Generate multiple radically different interface designs for a module using parallel sub-agents, then compare trade-offs. Based on "Design It Twice" from A Philosophy of Software Design. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".
3
+ ---
4
+
5
+
6
+ # Design Interface
7
+
8
+ Based on "Design It Twice" from "A Philosophy of Software Design": your first idea is unlikely to be the best. Generate multiple radically different designs, then compare.
9
+
10
+ > **HARD GATE** — Multiple design options must be explored. Do NOT settle on first idea. Compare trade-offs (UX, complexity, extensibility, performance) before committing.
11
+
12
+ ## Workflow
13
+
14
+ ### 1. Gather Requirements
15
+
16
+ Before designing, understand:
17
+
18
+ - [ ] What problem does this module solve?
19
+ - [ ] Who are the callers? (other modules, external users, tests)
20
+ - [ ] What are the key operations?
21
+ - [ ] Any constraints? (performance, compatibility, existing patterns)
22
+ - [ ] What should be hidden inside vs exposed?
23
+
24
+ Ask: "What does this module need to do? Who will use it?"
25
+
26
+ ### 2. Generate Designs (Parallel Sub-Agents)
27
+
28
+ Spawn 3+ sub-agents simultaneously using Task tool. Each must produce a **radically different** approach.
29
+
30
+ ```
31
+ Prompt template for each sub-agent:
32
+
33
+ Design an interface for: [module description]
34
+
35
+ Requirements: [gathered requirements]
36
+
37
+ Constraints for this design: [assign a different constraint to each agent]
38
+ - Agent 1: "Minimize method count - aim for 1-3 methods max"
39
+ - Agent 2: "Maximize flexibility - support many use cases"
40
+ - Agent 3: "Optimize for the most common case"
41
+ - Agent 4: "Take inspiration from [specific paradigm/library]"
42
+
43
+ Output format:
44
+ 1. Interface signature (types/methods)
45
+ 2. Usage example (how caller uses it)
46
+ 3. What this design hides internally
47
+ 4. Trade-offs of this approach
48
+ ```
49
+
50
+ ### 3. Present Designs
51
+
52
+ Show each design with:
53
+
54
+ 1. **Interface signature** — types, methods, params
55
+ 2. **Usage examples** — how callers actually use it in practice
56
+ 3. **What it hides** — complexity kept internal
57
+
58
+ Present designs sequentially so user can absorb each approach before comparison.
59
+
60
+ ### 4. Compare Designs
61
+
62
+ After showing all designs, compare them on:
63
+
64
+ - **Interface simplicity**: fewer methods, simpler params
65
+ - **General-purpose vs specialized**: flexibility vs focus
66
+ - **Implementation efficiency**: does shape allow efficient internals?
67
+ - **Depth**: small interface hiding significant complexity (good) vs large interface with thin implementation (bad)
68
+ - **Ease of correct use** vs **ease of misuse**
69
+
70
+ Discuss trade-offs in prose, not tables. Highlight where designs diverge most.
71
+
72
+ ### 5. Synthesize
73
+
74
+ Often the best design combines insights from multiple options. Ask:
75
+
76
+ - "Which design best fits your primary use case?"
77
+ - "Any elements from other designs worth incorporating?"
78
+
79
+ ## Evaluation Criteria
80
+
81
+ From "A Philosophy of Software Design":
82
+
83
+ **Interface simplicity**: Fewer methods, simpler params = easier to learn and use correctly.
84
+
85
+ **General-purpose**: Can handle future use cases without changes. But beware over-generalization.
86
+
87
+ **Implementation efficiency**: Does interface shape allow efficient implementation? Or force awkward internals?
88
+
89
+ **Depth**: Small interface hiding significant complexity = deep module (good). Large interface with thin implementation = shallow module (avoid).
90
+
91
+ ## Anti-Patterns
92
+
93
+ - Don't let sub-agents produce similar designs — enforce radical difference
94
+ - Don't skip comparison — the value is in contrast
95
+ - Don't implement — this is purely about interface shape
96
+ - Don't evaluate based on implementation effort
@@ -0,0 +1,375 @@
1
+ ---
2
+ description: Test-driven development with red-green-refactor loop using vertical slices. Use for features (epic tasks) or bugs (specs/bugs/BUG-*.md).
3
+ ---
4
+
5
+
6
+ # Develop TDD
7
+
8
+ > **HARD GATE** — Do NOT proceed if on `main` or `master`. Run `kickoff-branch` first to create a feature branch or worktree.
9
+ >
10
+ > **HARD GATE** — Do NOT write code before you have a plan. New feature: `plan-work` → epic capsule tasks. Bug: `investigate-bug` → `specs/bugs/BUG-*.md` (or use `fix-bug` orchestrator).
11
+ >
12
+ > **RECURSIVE DISCIPLINE** — This lifecycle applies to EVERY task, including updating these skills. Never skip planning because a task is "meta" or "just documentation."
13
+
14
+ ## Philosophy
15
+
16
+ Tests verify behavior through public interfaces, not implementation details. A good test reads like a specification. See [REFERENCE.md](REFERENCE.md) for the horizontal-slice anti-pattern and TDD phase detail.
17
+
18
+ ## Red Flags
19
+
20
+ If you catch yourself thinking these, stop and reconsider — you are likely deviating from production-grade craft.
21
+
22
+ | Red Flag | Reality |
23
+ | :--- | :--- |
24
+ | "This is too simple to need tests." | Simple code is where bugs hide. If it's simple, the test is cheap. |
25
+ | "I'll refactor this later." | "Later" is when technical debt becomes bankruptcy. Refactor while Green. |
26
+ | "The tests are already comprehensive." | If you're adding behavior, you need a new test. Coverage ≠ Correctness. |
27
+ | "I'm just fixing a small bug." | Small bugs often indicate deep interface flaws. Investigate root cause. |
28
+ | "I need to mock this internal class." | Mocking internals couples tests to implementation. Mock only I/O. |
29
+ | "This refactor is out of scope." | Leave the code cleaner than you found it (Boy Scout Rule). |
30
+
31
+ ## Workflow
32
+
33
+ ### 1. Planning
34
+
35
+ - [ ] Read active `specs/epics/*/epic.yaml` story tasks or `specs/bugs/BUG-*.md` — understand verify steps
36
+ - [ ] Confirm interface changes and behaviors to test (prioritize)
37
+ - [ ] Design interfaces for testability — identify [deep modules](deep-modules.md) opportunities
38
+ - [ ] Get user approval on the plan
39
+
40
+ Apply the **enforce-first** F.I.R.S.T rubric: Fast, Independent, Repeatable, Self-Validating, Timely.
41
+
42
+ ### 2. Tracer Bullet
43
+
44
+ Write ONE test that confirms ONE thing about the system:
45
+
46
+ ```
47
+ RED: Write test for first behavior → test fails → commit: test(<scope>): ...
48
+ GREEN: Write minimal code to pass → test passes → commit: feat(<scope>): ...
49
+ REFACTOR (optional): clean up → commit: refactor(<scope>): ...
50
+ ```
51
+
52
+ ### 3. Incremental Loop
53
+
54
+ > **STREAM CONTINUITY** — When writing file content, output in continuous chunks of ~200 lines. Do not pause. Emit a placeholder comment rather than going silent.
55
+
56
+ For each remaining behavior: RED → GREEN → REFACTOR (optional). One test at a time. Commit after every GREEN phase.
57
+
58
+ ### 4. Visual Slices (UI alternate workflow)
59
+
60
+ For UI components where behavioral unit testing is brittle: extract logic into a Controller/ViewModel/Hook (pure TDD), then use Visual Slices for the View layer. See [REFERENCE.md](REFERENCE.md) for the full Visual Slices procedure.
61
+
62
+ ### 5. Refactor
63
+
64
+ After all tests pass: extract duplication, deepen modules, apply SOLID principles. **Never refactor while RED.**
65
+
66
+ ### 6. Verify
67
+
68
+ After every behavior cycle, run the verify command from the active epic task. Show evidence before declaring the step done.
69
+
70
+ ### 7. Manual Verification Handover
71
+
72
+ Once all tests pass: locate the Verification Script in the active epic capsule, present it to the user step-by-step, and wait for confirmation of behavioral correctness.
73
+
74
+ ## Checklist Per Cycle
75
+
76
+ ```
77
+ [ ] Test describes behavior, not implementation
78
+ [ ] No test is ignored without an explicit ambiguity note (T4)
79
+ [ ] Boundary conditions tested: empty, max, min, off-by-one (T5)
80
+ [ ] Tests verify behavior through public interface only — no private methods (T8)
81
+ [ ] Test would survive internal refactor
82
+ [ ] Code is minimal for this test
83
+ [ ] No speculative features added
84
+ [ ] Every new abstraction has an explicit "Reason for Depth" justification
85
+ [ ] Progress committed (Conventional Commits)
86
+ [ ] verify: command passes
87
+ ```
88
+
89
+ ## Handoff
90
+
91
+ Gate: READY -> next: verify-work
92
+ Writes: state.yaml handoff.next_skill = verify-work
93
+
94
+ ---
95
+
96
+ # Develop TDD — Reference
97
+
98
+ ## Anti-Pattern: Horizontal Slices
99
+
100
+ **DO NOT write all tests first, then all implementation.** This is "horizontal slicing" — treating RED as "write all tests" and GREEN as "write all code."
101
+
102
+ This produces **crap tests**:
103
+ - Tests written in bulk test _imagined_ behavior, not _actual_ behavior
104
+ - You end up testing the _shape_ of things rather than user-facing behavior
105
+ - Tests become insensitive to real changes
106
+
107
+ **Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat.
108
+
109
+ ```
110
+ WRONG (horizontal):
111
+ RED: test1, test2, test3, test4, test5
112
+ GREEN: impl1, impl2, impl3, impl4, impl5
113
+
114
+ RIGHT (vertical):
115
+ RED→GREEN: test1→impl1
116
+ RED→GREEN: test2→impl2
117
+ RED→GREEN: test3→impl3
118
+ ...
119
+ ```
120
+
121
+ > The Red Flags table lives in [SKILL.md](SKILL.md#red-flags) — it is core behavioral guidance, not reference detail.
122
+
123
+ ## TDD Phases (Detail)
124
+
125
+ ### Red Phase
126
+
127
+ Write a failing test first:
128
+ - Test describes the desired observable behavior through the public interface
129
+ - Run the test to confirm it fails for the right reason (not a syntax error, not a typo)
130
+ - Commit: `git commit -m "test(<scope>): <description>"`
131
+
132
+ ### Green Phase
133
+
134
+ Write the minimum code to make the test pass:
135
+ - No extra logic, no anticipated future cases, no premature optimization
136
+ - Focus only on making the current test pass
137
+ - Commit: `git commit -m "feat(<scope>): <description>"` or `"fix(<scope>): <description>"`
138
+
139
+ ### Refactor Phase
140
+
141
+ Improve structure without changing behavior:
142
+ - Extract duplication, apply SOLID principles where natural, deepen modules
143
+ - Run tests after each refactor step to ensure behavior is preserved
144
+ - Commit: `git commit -m "refactor(<scope>): <description>"`
145
+ - Apply the Boy Scout Rule: leave the code cleaner than you found it
146
+
147
+ ## Visual Slices (UI Alternate Workflow)
148
+
149
+ For UI components (SwiftUI, React, Flutter) where behavioral unit testing is brittle or low-signal:
150
+
151
+ 1. **Test-First Logic**: Extract logic (state transitions, formatting, validation) into a Controller, ViewModel, or Hook. This logic MUST follow pure TDD.
152
+ 2. **Visual Verification**: For the View/Component itself:
153
+ - **RED**: Write the component signature and a basic preview/snapshot that fails (or displays placeholder).
154
+ - **GREEN**: Implement the UI and verify visually via manual run, preview, or snapshot test.
155
+ - **REFINE**: Adjust styling and layout until it matches the design.
156
+ 3. **COMMIT**: `git commit -m "feat(ui): <component name> visual slice verified"`
157
+
158
+ ---
159
+
160
+ # Deep Modules
161
+
162
+ From "A Philosophy of Software Design":
163
+
164
+ **Deep module** = small interface + lots of implementation
165
+
166
+ ```
167
+ ┌─────────────────────┐
168
+ │ Small Interface │ ← Few methods, simple params
169
+ ├─────────────────────┤
170
+ │ │
171
+ │ │
172
+ │ Deep Implementation│ ← Complex logic hidden
173
+ │ │
174
+ │ │
175
+ └─────────────────────┘
176
+ ```
177
+
178
+ **Shallow module** = large interface + little implementation (avoid)
179
+
180
+ ```
181
+ ┌─────────────────────────────────┐
182
+ │ Large Interface │ ← Many methods, complex params
183
+ ├─────────────────────────────────┤
184
+ │ Thin Implementation │ ← Just passes through
185
+ └─────────────────────────────────┘
186
+ ```
187
+
188
+ When designing interfaces, ask:
189
+
190
+ - Can I reduce the number of methods?
191
+ - Can I simplify the parameters?
192
+ - Can I hide more complexity inside?
193
+
194
+ ---
195
+
196
+ # Interface Design for Testability
197
+
198
+ Good interfaces make testing natural:
199
+
200
+ 1. **Accept dependencies, don't create them**
201
+
202
+ ```typescript
203
+ // Testable
204
+ function processOrder(order, paymentGateway) {}
205
+
206
+ // Hard to test
207
+ function processOrder(order) {
208
+ const gateway = new StripeGateway();
209
+ }
210
+ ```
211
+
212
+ 2. **Return results, don't produce side effects**
213
+
214
+ ```typescript
215
+ // Testable
216
+ function calculateDiscount(cart): Discount {}
217
+
218
+ // Hard to test
219
+ function applyDiscount(cart): void {
220
+ cart.total -= discount;
221
+ }
222
+ ```
223
+
224
+ 3. **Small surface area**
225
+ - Fewer methods = fewer tests needed
226
+ - Fewer params = simpler test setup
227
+
228
+ ---
229
+
230
+ # When to Mock
231
+
232
+ Mock at **system boundaries** only:
233
+
234
+ - External APIs (payment, email, etc.)
235
+ - Databases (sometimes - prefer test DB)
236
+ - Time/randomness
237
+ - File system (sometimes)
238
+
239
+ Don't mock:
240
+
241
+ - Your own classes/modules
242
+ - Internal collaborators
243
+ - Anything you control
244
+
245
+ ## Designing for Mockability
246
+
247
+ At system boundaries, design interfaces that are easy to mock:
248
+
249
+ **1. Use dependency injection**
250
+
251
+ Pass external dependencies in rather than creating them internally:
252
+
253
+ ```typescript
254
+ // Easy to mock
255
+ function processPayment(order, paymentClient) {
256
+ return paymentClient.charge(order.total);
257
+ }
258
+
259
+ // Hard to mock
260
+ function processPayment(order) {
261
+ const client = new StripeClient(process.env.STRIPE_KEY);
262
+ return client.charge(order.total);
263
+ }
264
+ ```
265
+
266
+ **2. Prefer SDK-style interfaces over generic fetchers**
267
+
268
+ Create specific functions for each external operation instead of one generic function with conditional logic:
269
+
270
+ ```typescript
271
+ // GOOD: Each function is independently mockable
272
+ const api = {
273
+ getUser: (id) => fetch(`/users/${id}`),
274
+ getOrders: (userId) => fetch(`/users/${userId}/orders`),
275
+ createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
276
+ };
277
+
278
+ // BAD: Mocking requires conditional logic inside the mock
279
+ const api = {
280
+ fetch: (endpoint, options) => fetch(endpoint, options),
281
+ };
282
+ ```
283
+
284
+ The SDK approach means:
285
+ - Each mock returns one specific shape
286
+ - No conditional logic in test setup
287
+ - Easier to see which endpoints a test exercises
288
+ - Type safety per endpoint
289
+
290
+ ---
291
+
292
+ # Refactor Candidates
293
+
294
+ After TDD cycle, look for:
295
+
296
+ - **Duplication** → Extract function/class
297
+ - **Long methods** → Break into private helpers (keep tests on public interface)
298
+ - **Shallow modules** → Combine or deepen
299
+ - **Feature envy** → Move logic to where data lives
300
+ - **Primitive obsession** → Introduce value objects
301
+ - **Existing code** the new code reveals as problematic
302
+
303
+ ---
304
+
305
+ # Good and Bad Tests
306
+
307
+ ## Good Tests
308
+
309
+ **Integration-style**: Test through real interfaces, not mocks of internal parts.
310
+
311
+ ```typescript
312
+ // GOOD: Tests observable behavior
313
+ test("user can checkout with valid cart", async () => {
314
+ const cart = createCart();
315
+ cart.add(product);
316
+ const result = await checkout(cart, paymentMethod);
317
+ expect(result.status).toBe("confirmed");
318
+ });
319
+ ```
320
+
321
+ Characteristics:
322
+
323
+ - Tests behavior users/callers care about
324
+ - Uses public API only
325
+ - Survives internal refactors
326
+ - Describes WHAT, not HOW
327
+ - One logical assertion per test
328
+
329
+ ## Bad Tests
330
+
331
+ **Implementation-detail tests**: Coupled to internal structure.
332
+
333
+ ```typescript
334
+ // BAD: Tests implementation details
335
+ test("checkout calls paymentService.process", async () => {
336
+ const mockPayment = jest.mock(paymentService);
337
+ await checkout(cart, payment);
338
+ expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
339
+ });
340
+ ```
341
+
342
+ Red flags:
343
+
344
+ - Mocking internal collaborators
345
+ - Testing private methods
346
+ - Asserting on call counts/order
347
+ - Test breaks when refactoring without behavior change
348
+ - Test name describes HOW not WHAT
349
+ - Verifying through external means instead of interface
350
+
351
+ ```typescript
352
+ // BAD: Bypasses interface to verify
353
+ test("createUser saves to database", async () => {
354
+ await createUser({ name: "Alice" });
355
+ const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
356
+ expect(row).toBeDefined();
357
+ });
358
+
359
+ // GOOD: Verifies through interface
360
+ test("createUser makes user retrievable", async () => {
361
+ const user = await createUser({ name: "Alice" });
362
+ const retrieved = await getUser(user.id);
363
+ expect(retrieved.name).toBe("Alice");
364
+ });
365
+ ```
366
+
367
+ ## Clean Test Heuristics (Uncle Bob, Ch 17)
368
+
369
+ Apply these specific heuristics to maintain a high-quality suite:
370
+
371
+ - **T1: Insufficient Tests**: A test suite should test everything that could possibly break. Don't stop at "it seems to work."
372
+ - **T4: Ignored Tests**: Never ignore a test without documenting the ambiguity. An ignored test is a silent warning of a gap in understanding.
373
+ - **T5: Test Boundary Conditions**: Most bugs happen at the edges. Test the exact boundaries (e.g., empty strings, max integers, off-by-one indices).
374
+ - **T6: Exhaustively Test Near Bugs**: Bugs congregate. If you find one, there are likely others nearby; test that area thoroughly.
375
+ - **T9: Tests Should Be Fast**: Slow tests don't get run. Keep them fast so they remain part of the core developer loop.
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Run 4-phase root cause analysis — reproduce, isolate, hypothesize, verify. Use when a bug is confirmed but root cause is unclear, after investigate-bug, or when user mentions root cause analysis.model: sonnet
3
+ ---
4
+
5
+
6
+ # Diagnose Root
7
+
8
+ **Boundary**: Canonical, reusable 4-phase RCA engine. Invoked by `investigate-bug` (as step 2 of the end-to-end flow) and by `fix-bug` (when no bug file exists). Does not write the bug file — that is `investigate-bug`'s responsibility.
9
+
10
+ Four phases — do not skip. Update the active `specs/bugs/BUG-*.md` file at each phase.
11
+
12
+ ## Phases
13
+
14
+ 1. **Reproduce** — minimal steps; record environment; capture logs.
15
+ 2. **Isolate** — narrow to module/function; binary-search commits or config.
16
+ 3. **Hypothesize** — list ranked hypotheses with falsification test each.
17
+ 4. **Verify** — run falsification; confirm single root cause; link to fix plan.
18
+
19
+ > **HARD GATE** — Do not propose a fix until phase 4 confirms one root cause with evidence.
20
+
21
+ ## Verify
22
+
23
+ → verify: `BUG_FILE=$(ls -t specs/bugs/BUG-*.md 2>/dev/null | head -1); test -n "$BUG_FILE" && grep -cE "Reproduce|Isolate|Hypothesize|Verify" "$BUG_FILE" | awk '{if($1>=4) print "OK"; else print "INCOMPLETE"}' || echo "MISSING"`
@@ -0,0 +1,83 @@
1
+ ---
2
+ description: Dispatch multiple subagents in parallel on independent tasks. No waiting between them — all run concurrently. Use when tasks are truly decoupled and speed matters. Distinct from delegate-task (concurrent here, no inter-task review gate).
3
+ ---
4
+
5
+
6
+ # Dispatch Agents
7
+ > **HARD GATE** — **HARD GATE** — Agent work must be parallelizable and have explicit synchronization points. Do NOT dispatch work that has hidden dependencies between agents.
8
+
9
+
10
+ Run multiple subagents in parallel on independent tasks. Use when tasks are genuinely decoupled — no agent needs the output of another to start.
11
+
12
+ **Distinct from `delegate-task`:** This skill maximizes throughput via concurrency. There is no sequential review gate between tasks. Use `delegate-task` instead when a single task needs careful two-stage oversight before proceeding.
13
+
14
+ ## When to use
15
+
16
+ - Tasks that can run simultaneously without shared state
17
+ - Large plans that can be broken into parallel workstreams
18
+ - Exploration: gather information from multiple parts of the codebase at once
19
+
20
+ ## When NOT to use
21
+
22
+ - Task B depends on Task A's output
23
+ - You need to review Task A before Task B can start safely
24
+ - The tasks share a file and concurrent edits would conflict
25
+
26
+ ## Process
27
+
28
+ ### 1. Confirm independence
29
+
30
+ Before dispatching, verify each task pair is truly independent:
31
+ - No shared files being written
32
+ - No shared state (DB migrations, config files)
33
+ - No ordering dependency between outcomes
34
+
35
+ If any two tasks conflict, sequence them with `delegate-task` or `execute-plan` instead.
36
+
37
+ ### 2. Write task briefs
38
+
39
+ Before writing briefs, read `specs/state.yaml` if it exists — each agent gets only the decisions relevant to its task, nothing else.
40
+
41
+ For each task, use this minimal template (each agent starts cold — brief size directly controls token cost and hallucination risk):
42
+
43
+ ```
44
+ Goal: [one sentence — what success looks like]
45
+ In scope: [explicit file or module list]
46
+ Out of bounds: [what NOT to touch]
47
+ Verify: [runnable command]
48
+ Prior decisions: [relevant entries from specs/state.yaml — omit section if none apply]
49
+ ```
50
+
51
+ Do not include the full conversation, full file contents, or decisions unrelated to this agent's task.
52
+
53
+ ### 3. Iterative retrieval (max 3 cycles)
54
+
55
+ After each wave completes:
56
+ 1. **Dispatch** — run parallel agents with briefs.
57
+ 2. **Evaluate** — read outputs; list gaps vs goal.
58
+ 3. **Refine** — tighten briefs or spawn follow-up agents (max **3 cycles** total).
59
+
60
+ Stop when gaps empty or cycle 3 reached — escalate to user.
61
+
62
+ ### 4. Dispatch in parallel
63
+
64
+ Spawn all agents in a single message using multiple Agent tool calls. Each agent gets its own complete brief.
65
+
66
+ ```
67
+ Agent 1: brief for task A
68
+ Agent 2: brief for task B
69
+ Agent 3: brief for task C
70
+ ```
71
+
72
+ ### 5. Collect and review results
73
+
74
+ When all agents return:
75
+ - Review each result independently
76
+ - Run all verify commands
77
+ - Check diffs for scope violations or CONVENTIONS.md breaches
78
+
79
+ ### 6. Integrate
80
+
81
+ Merge accepted results. If any agent's result conflicts with another, resolve manually and note the conflict.
82
+
83
+ Report a summary: which tasks succeeded, which need revision, and overall verify status.
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Edit and improve documents by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, restructure, or improve any document — including specs/ files, articles, READMEs, or technical writing.
3
+ ---
4
+
5
+
6
+ # Edit Document
7
+
8
+ **Distinct from `write-document`:** Use this skill when the document already exists and needs restructuring, clarity, or prose improvements. Use `write-document` to create a document from scratch.
9
+
10
+ > **HARD GATE** — Document edits must preserve intent and accuracy. Do NOT remove or contradict existing content without understanding why it was written. Check git history for context.
11
+
12
+ ## Process
13
+
14
+ 1. First, divide the document into sections based on its headings. Think about the main points made in each section.
15
+
16
+ Consider that information is a directed acyclic graph, and that pieces of information can depend on other pieces of information. Make sure that the order of the sections and their contents respects these dependencies.
17
+
18
+ Confirm the sections with the user.
19
+
20
+ 2. For each section:
21
+
22
+ 2a. Rewrite the section to improve clarity, coherence, and flow. Use maximum 240 characters per paragraph.
@@ -0,0 +1,81 @@
1
+ ---
2
+ description: Refine a rough idea into a clear, detailed specification through dialogue. Does not produce code. Use when user has a vague idea, wants to think through a feature before planning, or needs to turn "I want X" into a concrete spec.
3
+ ---
4
+
5
+
6
+ # Elaborate Spec
7
+
8
+ Turn a rough idea into a clear specification through focused dialogue. No code is written during this skill — the output is shared understanding and a refined problem statement.
9
+
10
+ > **HARD GATE** — Do NOT proceed with planning or implementation until the problem space is clearly understood. Success criteria, actors, and scope must be explicit before drafting a plan.
11
+
12
+ ## Process
13
+
14
+ ### 1. Listen first
15
+
16
+ Let the user describe their idea in their own words. Do not interrupt or redirect. Take notes on:
17
+ - The core problem they're trying to solve
18
+ - Who is affected (actors)
19
+ - What success looks like to them
20
+ - Any constraints they've already identified
21
+
22
+ ### 2. Ask clarifying questions
23
+
24
+ Ask one question at a time. Work through these areas:
25
+
26
+ **Problem clarity**
27
+ - What is the current behavior (or lack of behavior) that prompted this?
28
+ - Who experiences this problem? How often?
29
+ - What's the cost of not solving it?
30
+
31
+ **Solution boundaries**
32
+ - What is explicitly IN scope?
33
+ - What is explicitly OUT of scope?
34
+ - Are there existing solutions (internal or external) this replaces or integrates with?
35
+
36
+ **Success criteria**
37
+ - How will you know this is done?
38
+ - What does the happy path look like end-to-end?
39
+ - What are the key failure modes to handle?
40
+
41
+ **Constraints**
42
+ - Any performance requirements?
43
+ - Any compatibility constraints (existing APIs, data formats)?
44
+ - Any non-negotiable implementation decisions already made?
45
+
46
+ ### 2.5. Multiple Interpretations (HARD GATE)
47
+
48
+ > **HARD GATE** — If the request admits ≥2 valid interpretations, do NOT guess. You must list them and ask the user to choose before proceeding. Proceeding with unresolved ambiguity is a failure of integrity.
49
+
50
+ Present the options clearly:
51
+ > "I see two ways to read this:
52
+ > 1. [Interpretation A] — my recommendation because [reason]
53
+ > 2. [Interpretation B]
54
+ > Which is closer to what you mean?"
55
+
56
+ ### 3. Surface hidden assumptions
57
+
58
+ Once the user has answered the main questions, probe for assumptions:
59
+ - "You mentioned X — does that mean Y is also true?"
60
+ - "What happens when Z fails?"
61
+ - "Is this for internal users, external users, or both?"
62
+
63
+ ### 4. Synthesize and confirm
64
+
65
+ Summarize your understanding in 3–5 bullet points aligned with [countable-story-format.md](file:///Users/danielvm/Developer/bigpowers/countable-story-format.md):
66
+ - The problem (feeds into §1 Business narrative)
67
+ - The solution and main flow (feeds into §5)
68
+ - The key constraints and alternative flows (feeds into §6)
69
+ - The success criteria (feeds into §17 Gherkin)
70
+ - What's out of scope (feeds into §18)
71
+
72
+ Ask: "Is this an accurate summary? Anything missing or wrong?"
73
+
74
+ ### 5. Suggest next skill
75
+
76
+ Once the spec is clear, recommend the next step:
77
+ - If domain model needs work → `model-domain`
78
+ - If ready to plan → `plan-release` (creates epic capsules with `epic.yaml` + story `.md` + `-tasks.yaml`) then `plan-work` per story
79
+ - If a spike is needed first → `spike-prototype`
80
+ - If architecture decisions are needed → `deepen-architecture` or `grill-me`
81
+ - If the plan depends on a specific library or API → `grill-me` in docs mode