workspace-maxxing 0.1.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 (198) hide show
  1. package/.agents/skills/workspace-maxxing/.workspace-templates/CONTEXT.md +44 -0
  2. package/.agents/skills/workspace-maxxing/.workspace-templates/SYSTEM.md +44 -0
  3. package/.agents/skills/workspace-maxxing/.workspace-templates/references/anti-patterns.md +16 -0
  4. package/.agents/skills/workspace-maxxing/.workspace-templates/references/iron-laws.md +26 -0
  5. package/.agents/skills/workspace-maxxing/.workspace-templates/references/reporting-format.md +52 -0
  6. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/benchmark.ts +171 -0
  7. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/dispatch.ts +473 -0
  8. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/generate-tests.ts +158 -0
  9. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/install-tool.ts +82 -0
  10. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/iterate.ts +265 -0
  11. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/orchestrator.ts +539 -0
  12. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/scaffold.ts +282 -0
  13. package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/validate.ts +452 -0
  14. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/architecture/SKILL.md +95 -0
  15. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/fixer/SKILL.md +109 -0
  16. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/iteration/SKILL.md +89 -0
  17. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
  18. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/research/SKILL.md +94 -0
  19. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/testing/SKILL.md +89 -0
  20. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/tooling/SKILL.md +87 -0
  21. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/validation/SKILL.md +103 -0
  22. package/.agents/skills/workspace-maxxing/.workspace-templates/skills/worker/SKILL.md +79 -0
  23. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
  24. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
  25. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
  26. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
  27. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
  28. package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/README.md +14 -0
  29. package/.agents/skills/workspace-maxxing/SKILL.md +312 -0
  30. package/.agents/skills/workspace-maxxing/scripts/benchmark.ts +171 -0
  31. package/.agents/skills/workspace-maxxing/scripts/dispatch.ts +473 -0
  32. package/.agents/skills/workspace-maxxing/scripts/generate-tests.ts +158 -0
  33. package/.agents/skills/workspace-maxxing/scripts/install-tool.ts +82 -0
  34. package/.agents/skills/workspace-maxxing/scripts/iterate.ts +265 -0
  35. package/.agents/skills/workspace-maxxing/scripts/orchestrator.ts +539 -0
  36. package/.agents/skills/workspace-maxxing/scripts/scaffold.ts +282 -0
  37. package/.agents/skills/workspace-maxxing/scripts/validate.ts +452 -0
  38. package/README.md +144 -0
  39. package/dist/agent-creator.d.ts +9 -0
  40. package/dist/agent-creator.d.ts.map +1 -0
  41. package/dist/agent-creator.js +199 -0
  42. package/dist/agent-creator.js.map +1 -0
  43. package/dist/agent-iterator.d.ts +38 -0
  44. package/dist/agent-iterator.d.ts.map +1 -0
  45. package/dist/agent-iterator.js +327 -0
  46. package/dist/agent-iterator.js.map +1 -0
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +197 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/install.d.ts +18 -0
  52. package/dist/install.d.ts.map +1 -0
  53. package/dist/install.js +117 -0
  54. package/dist/install.js.map +1 -0
  55. package/dist/platforms/claude.d.ts +7 -0
  56. package/dist/platforms/claude.d.ts.map +1 -0
  57. package/dist/platforms/claude.js +70 -0
  58. package/dist/platforms/claude.js.map +1 -0
  59. package/dist/platforms/copilot.d.ts +7 -0
  60. package/dist/platforms/copilot.d.ts.map +1 -0
  61. package/dist/platforms/copilot.js +75 -0
  62. package/dist/platforms/copilot.js.map +1 -0
  63. package/dist/platforms/gemini.d.ts +7 -0
  64. package/dist/platforms/gemini.d.ts.map +1 -0
  65. package/dist/platforms/gemini.js +81 -0
  66. package/dist/platforms/gemini.js.map +1 -0
  67. package/dist/platforms/index.d.ts +8 -0
  68. package/dist/platforms/index.d.ts.map +1 -0
  69. package/dist/platforms/index.js +41 -0
  70. package/dist/platforms/index.js.map +1 -0
  71. package/dist/platforms/opencode.d.ts +7 -0
  72. package/dist/platforms/opencode.d.ts.map +1 -0
  73. package/dist/platforms/opencode.js +70 -0
  74. package/dist/platforms/opencode.js.map +1 -0
  75. package/dist/scripts/benchmark.d.ts +20 -0
  76. package/dist/scripts/benchmark.d.ts.map +1 -0
  77. package/dist/scripts/benchmark.js +170 -0
  78. package/dist/scripts/benchmark.js.map +1 -0
  79. package/dist/scripts/dispatch.d.ts +32 -0
  80. package/dist/scripts/dispatch.d.ts.map +1 -0
  81. package/dist/scripts/dispatch.js +386 -0
  82. package/dist/scripts/dispatch.js.map +1 -0
  83. package/dist/scripts/generate-tests.d.ts +11 -0
  84. package/dist/scripts/generate-tests.d.ts.map +1 -0
  85. package/dist/scripts/generate-tests.js +118 -0
  86. package/dist/scripts/generate-tests.js.map +1 -0
  87. package/dist/scripts/install-tool.d.ts +8 -0
  88. package/dist/scripts/install-tool.d.ts.map +1 -0
  89. package/dist/scripts/install-tool.js +98 -0
  90. package/dist/scripts/install-tool.js.map +1 -0
  91. package/dist/scripts/iterate.d.ts +44 -0
  92. package/dist/scripts/iterate.d.ts.map +1 -0
  93. package/dist/scripts/iterate.js +260 -0
  94. package/dist/scripts/iterate.js.map +1 -0
  95. package/dist/scripts/orchestrator.d.ts +40 -0
  96. package/dist/scripts/orchestrator.d.ts.map +1 -0
  97. package/dist/scripts/orchestrator.js +378 -0
  98. package/dist/scripts/orchestrator.js.map +1 -0
  99. package/dist/scripts/scaffold.d.ts +8 -0
  100. package/dist/scripts/scaffold.d.ts.map +1 -0
  101. package/dist/scripts/scaffold.js +279 -0
  102. package/dist/scripts/scaffold.js.map +1 -0
  103. package/dist/scripts/validate.d.ts +11 -0
  104. package/dist/scripts/validate.d.ts.map +1 -0
  105. package/dist/scripts/validate.js +472 -0
  106. package/dist/scripts/validate.js.map +1 -0
  107. package/docs/superpowers/plans/2026-04-07-autonomous-iteration-plan.md +1123 -0
  108. package/docs/superpowers/plans/2026-04-07-autonomous-iteration-sub-agent-batches.md +1923 -0
  109. package/docs/superpowers/plans/2026-04-07-autonomous-workflow-sub-skill-plan.md +1505 -0
  110. package/docs/superpowers/plans/2026-04-07-benchmarking-multi-agent-plan.md +854 -0
  111. package/docs/superpowers/plans/2026-04-07-workspace-builder-logic-plan.md +1426 -0
  112. package/docs/superpowers/plans/2026-04-07-workspace-maxxing-plan.md +1299 -0
  113. package/docs/superpowers/plans/2026-04-08-session-294c-subagent-invocation-plan.md +320 -0
  114. package/docs/superpowers/plans/2026-04-08-workflow-prompt-hardening-plan.md +1025 -0
  115. package/docs/superpowers/plans/2026-04-12-workspace-agent-creation-plan.md +992 -0
  116. package/docs/superpowers/specs/2026-04-07-autonomous-iteration-design.md +214 -0
  117. package/docs/superpowers/specs/2026-04-07-autonomous-iteration-sub-agent-batches-design.md +188 -0
  118. package/docs/superpowers/specs/2026-04-07-autonomous-workflow-sub-skill-design.md +137 -0
  119. package/docs/superpowers/specs/2026-04-07-benchmarking-multi-agent-design.md +105 -0
  120. package/docs/superpowers/specs/2026-04-07-workspace-builder-logic-design.md +179 -0
  121. package/docs/superpowers/specs/2026-04-07-workspace-maxxing-design.md +227 -0
  122. package/docs/superpowers/specs/2026-04-08-session-294c-subagent-invocation-design.md +265 -0
  123. package/docs/superpowers/specs/2026-04-08-workflow-prompt-hardening-design.md +146 -0
  124. package/docs/superpowers/specs/2026-04-12-workspace-agent-creation-design.md +239 -0
  125. package/jest.config.js +8 -0
  126. package/package.json +32 -0
  127. package/src/agent-creator.ts +180 -0
  128. package/src/agent-iterator.ts +397 -0
  129. package/src/index.ts +189 -0
  130. package/src/install.ts +105 -0
  131. package/src/platforms/claude.ts +40 -0
  132. package/src/platforms/copilot.ts +50 -0
  133. package/src/platforms/gemini.ts +55 -0
  134. package/src/platforms/index.ts +45 -0
  135. package/src/platforms/opencode.ts +41 -0
  136. package/src/scripts/benchmark.ts +171 -0
  137. package/src/scripts/dispatch.ts +473 -0
  138. package/src/scripts/generate-tests.ts +112 -0
  139. package/src/scripts/install-tool.ts +82 -0
  140. package/src/scripts/iterate.ts +271 -0
  141. package/src/scripts/orchestrator.ts +539 -0
  142. package/src/scripts/scaffold.ts +282 -0
  143. package/src/scripts/validate.ts +516 -0
  144. package/templates/.workspace-templates/CONTEXT.md +44 -0
  145. package/templates/.workspace-templates/SYSTEM.md +44 -0
  146. package/templates/.workspace-templates/references/anti-patterns.md +16 -0
  147. package/templates/.workspace-templates/references/iron-laws.md +26 -0
  148. package/templates/.workspace-templates/references/reporting-format.md +52 -0
  149. package/templates/.workspace-templates/scripts/benchmark.ts +171 -0
  150. package/templates/.workspace-templates/scripts/dispatch.ts +473 -0
  151. package/templates/.workspace-templates/scripts/generate-tests.ts +158 -0
  152. package/templates/.workspace-templates/scripts/install-tool.ts +82 -0
  153. package/templates/.workspace-templates/scripts/iterate.ts +265 -0
  154. package/templates/.workspace-templates/scripts/orchestrator.ts +539 -0
  155. package/templates/.workspace-templates/scripts/scaffold.ts +282 -0
  156. package/templates/.workspace-templates/scripts/validate.ts +452 -0
  157. package/templates/.workspace-templates/skills/architecture/SKILL.md +95 -0
  158. package/templates/.workspace-templates/skills/fixer/SKILL.md +109 -0
  159. package/templates/.workspace-templates/skills/iteration/SKILL.md +89 -0
  160. package/templates/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
  161. package/templates/.workspace-templates/skills/research/SKILL.md +94 -0
  162. package/templates/.workspace-templates/skills/testing/SKILL.md +89 -0
  163. package/templates/.workspace-templates/skills/tooling/SKILL.md +87 -0
  164. package/templates/.workspace-templates/skills/validation/SKILL.md +103 -0
  165. package/templates/.workspace-templates/skills/worker/SKILL.md +79 -0
  166. package/templates/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
  167. package/templates/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
  168. package/templates/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
  169. package/templates/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
  170. package/templates/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
  171. package/templates/.workspace-templates/workspace/README.md +14 -0
  172. package/templates/SKILL.md +347 -0
  173. package/tests/benchmark.test.ts +158 -0
  174. package/tests/cli.test.ts +109 -0
  175. package/tests/dispatch-parallel.test.ts +124 -0
  176. package/tests/dispatch.test.ts +218 -0
  177. package/tests/fixer-skill.test.ts +203 -0
  178. package/tests/generate-tests.test.ts +101 -0
  179. package/tests/install-tool.test.ts +141 -0
  180. package/tests/install.test.ts +144 -0
  181. package/tests/integration.test.ts +324 -0
  182. package/tests/iterate.test.ts +219 -0
  183. package/tests/orchestrator.test.ts +710 -0
  184. package/tests/scaffold.test.ts +238 -0
  185. package/tests/templates-enhanced.test.ts +208 -0
  186. package/tests/templates.test.ts +219 -0
  187. package/tests/validate.test.ts +421 -0
  188. package/tests/validation-enhanced.test.ts +303 -0
  189. package/tests/worker-skill.test.ts +88 -0
  190. package/tsconfig.json +19 -0
  191. package/workspace/00-meta/CONTEXT.md +3 -0
  192. package/workspace/00-meta/execution-log.md +17 -0
  193. package/workspace/00-meta/tools.md +11 -0
  194. package/workspace/01-input/CONTEXT.md +27 -0
  195. package/workspace/CONTEXT.md +35 -0
  196. package/workspace/README.md +14 -0
  197. package/workspace/SYSTEM.md +36 -0
  198. package/workspace-maxxing-0.1.0.tgz +0 -0
@@ -0,0 +1,1505 @@
1
+ # Autonomous Workflow & Sub-Skill Framework Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Transform workspace-maxxing into a comprehensive autonomous workflow system with 7 sub-skills, shared references, and a dispatch script following obra/superpowers patterns.
6
+
7
+ **Architecture:** Main SKILL.md rewritten with YAML frontmatter and hybrid flow. 7 sub-skills in `templates/.workspace-templates/skills/`. 3 shared references in `templates/.workspace-templates/references/`. New `dispatch.ts` script for sub-skill invocation. Installer enhanced to copy new directories.
8
+
9
+ **Tech Stack:** TypeScript, Node.js builtins only (fs, path, process), Jest for testing.
10
+
11
+ ---
12
+
13
+ ### Task 1: Create Shared References
14
+
15
+ **Files:**
16
+ - Create: `templates/.workspace-templates/references/anti-patterns.md`
17
+ - Create: `templates/.workspace-templates/references/reporting-format.md`
18
+ - Create: `templates/.workspace-templates/references/iron-laws.md`
19
+ - Test: `tests/templates-enhanced.test.ts`
20
+
21
+ - [ ] **Step 1: Create anti-patterns.md**
22
+
23
+ ```markdown
24
+ # Anti-Patterns & Rationalization Prevention
25
+
26
+ Common rationalizations agents use to skip steps, with reality checks.
27
+
28
+ | Thought | Reality |
29
+ |---------|---------|
30
+ | "This workspace looks good enough" | Good enough is the enemy of excellent. Run validation. |
31
+ | "I'll skip research and go straight to building" | Building without research produces generic, non-optimal workspaces. |
32
+ | "The user didn't ask for tests" | Autonomous workflows require self-verification. Tests are mandatory. |
33
+ | "I'll fix this later" | Later never comes. Fix it now or escalate. |
34
+ | "This sub-skill doesn't apply here" | If there's a 1% chance it applies, dispatch it. |
35
+ | "The score is fine" | Fine is not good. Target > 85. |
36
+ | "I already validated this" | Validation is a snapshot. Re-validate after every change. |
37
+ | "This prompt update is cosmetic" | Prompt quality directly impacts agent behavior. No cosmetic-only changes. |
38
+ | "I'll do all phases at once" | Phases exist for a reason. Complete each before moving to the next. |
39
+ | "The user will review anyway" | Autonomous means autonomous. Deliver quality without requiring human review. |
40
+ ```
41
+
42
+ - [ ] **Step 2: Create reporting-format.md**
43
+
44
+ ```markdown
45
+ # Sub-Skill Report Format
46
+
47
+ All sub-skills return a structured JSON report. Use this exact format.
48
+
49
+ ## Report Structure
50
+
51
+ ```json
52
+ {
53
+ "skill": "<skill-name>",
54
+ "status": "passed|failed|escalated",
55
+ "timestamp": "<ISO-8601 timestamp>",
56
+ "findings": [
57
+ "<specific finding 1>",
58
+ "<specific finding 2>"
59
+ ],
60
+ "recommendations": [
61
+ "<actionable recommendation 1>",
62
+ "<actionable recommendation 2>"
63
+ ],
64
+ "metrics": {
65
+ "<metric-name>": <value>,
66
+ "score": <0-100>,
67
+ "itemsChecked": <number>,
68
+ "itemsPassed": <number>
69
+ },
70
+ "nextSkill": "<next-skill-name>|none"
71
+ }
72
+ ```
73
+
74
+ ## Field Descriptions
75
+
76
+ - `skill`: Name of the sub-skill that generated this report
77
+ - `status`: One of "passed", "failed", or "escalated"
78
+ - `passed`: All checks passed, no critical issues
79
+ - `failed`: One or more checks failed, actionable items exist
80
+ - `escalated`: Cannot proceed, requires human intervention
81
+ - `timestamp`: ISO-8601 timestamp of report generation
82
+ - `findings`: Array of specific observations (both positive and negative)
83
+ - `recommendations`: Array of actionable next steps
84
+ - `metrics`: Quantitative measurements from the sub-skill
85
+ - `score`: 0-100 quality score
86
+ - `itemsChecked`: Total items evaluated
87
+ - `itemsPassed`: Items that passed evaluation
88
+ - `nextSkill`: Suggested next sub-skill to dispatch, or "none" if workflow is complete
89
+
90
+ ## Usage
91
+
92
+ Print the report as JSON to stdout when the sub-skill completes:
93
+
94
+ ```bash
95
+ echo '{"skill":"validation","status":"passed",...}'
96
+ ```
97
+ ```
98
+
99
+ - [ ] **Step 3: Create iron-laws.md**
100
+
101
+ ```markdown
102
+ # Iron Laws
103
+
104
+ These rules are absolute. No exceptions. No rationalizations.
105
+
106
+ ## The Iron Laws of Workspace Building
107
+
108
+ 1. **NO BUILD WITHOUT PLAN** — Every workspace must have an approved architecture plan before scaffold.ts runs.
109
+
110
+ 2. **NO PLAN WITHOUT RESEARCH** — Architecture decisions must be informed by pattern research and context gathering.
111
+
112
+ 3. **NO IMPROVEMENT WITHOUT VALIDATION** — Never claim a workspace improved without running validate.ts before and after.
113
+
114
+ 4. **NO COMPLETION CLAIM WITHOUT VERIFICATION** — Run the full test suite and validation checks before declaring delivery.
115
+
116
+ 5. **NO SKIPPING PHASES** — The hybrid flow exists for a reason. Complete each phase before moving to the next.
117
+
118
+ 6. **NO SILENT FAILURES** — If a sub-skill fails, report it. Do not continue as if nothing happened.
119
+
120
+ ## Enforcement
121
+
122
+ Before any action, ask: "Which iron law does this touch?" If the answer is "none," you're probably about to break one.
123
+
124
+ Violation of any iron law requires immediate escalation to the human with:
125
+ - Which law was violated
126
+ - Why it was violated
127
+ - Proposed fix
128
+ ```
129
+
130
+ - [ ] **Step 4: Write tests for references**
131
+
132
+ ```typescript
133
+ // tests/templates-enhanced.test.ts
134
+ import * as fs from 'fs';
135
+ import * as path from 'path';
136
+
137
+ describe('Shared References', () => {
138
+ const templatesDir = path.join(__dirname, '..', 'templates', '.workspace-templates');
139
+
140
+ describe('references/ directory', () => {
141
+ it('contains anti-patterns.md', () => {
142
+ const filePath = path.join(templatesDir, 'references', 'anti-patterns.md');
143
+ expect(fs.existsSync(filePath)).toBe(true);
144
+ const content = fs.readFileSync(filePath, 'utf-8');
145
+ expect(content).toContain('Rationalization');
146
+ expect(content).toContain('Thought');
147
+ expect(content).toContain('Reality');
148
+ });
149
+
150
+ it('contains reporting-format.md', () => {
151
+ const filePath = path.join(templatesDir, 'references', 'reporting-format.md');
152
+ expect(fs.existsSync(filePath)).toBe(true);
153
+ const content = fs.readFileSync(filePath, 'utf-8');
154
+ expect(content).toContain('skill');
155
+ expect(content).toContain('status');
156
+ expect(content).toContain('findings');
157
+ expect(content).toContain('recommendations');
158
+ expect(content).toContain('nextSkill');
159
+ });
160
+
161
+ it('contains iron-laws.md', () => {
162
+ const filePath = path.join(templatesDir, 'references', 'iron-laws.md');
163
+ expect(fs.existsSync(filePath)).toBe(true);
164
+ const content = fs.readFileSync(filePath, 'utf-8');
165
+ expect(content).toContain('NO BUILD WITHOUT PLAN');
166
+ expect(content).toContain('NO PLAN WITHOUT RESEARCH');
167
+ expect(content).toContain('NO IMPROVEMENT WITHOUT VALIDATION');
168
+ expect(content).toContain('NO COMPLETION CLAIM WITHOUT VERIFICATION');
169
+ });
170
+ });
171
+ });
172
+ ```
173
+
174
+ - [ ] **Step 5: Run tests to verify they fail**
175
+
176
+ Run: `npm test -- tests/templates-enhanced.test.ts`
177
+ Expected: FAIL with "ENOENT: no such file or directory"
178
+
179
+ - [ ] **Step 6: Create the references directory and files**
180
+
181
+ ```bash
182
+ mkdir -p templates/.workspace-templates/references
183
+ ```
184
+
185
+ Then write the three files from Steps 1-3.
186
+
187
+ - [ ] **Step 7: Run tests to verify they pass**
188
+
189
+ Run: `npm test -- tests/templates-enhanced.test.ts`
190
+ Expected: All 3 tests pass
191
+
192
+ - [ ] **Step 8: Commit**
193
+
194
+ ```bash
195
+ git add templates/.workspace-templates/references/ tests/templates-enhanced.test.ts
196
+ git commit -m "feat: add shared references (anti-patterns, reporting-format, iron-laws)"
197
+ ```
198
+
199
+ ---
200
+
201
+ ### Task 2: Create Validation Sub-Skill
202
+
203
+ **Files:**
204
+ - Create: `templates/.workspace-templates/skills/validation/SKILL.md`
205
+ - Test: `tests/templates-enhanced.test.ts` (add validation sub-skill tests)
206
+
207
+ - [ ] **Step 1: Write test for validation sub-skill**
208
+
209
+ ```typescript
210
+ // Add to tests/templates-enhanced.test.ts
211
+ describe('Sub-Skills', () => {
212
+ const skillsDir = path.join(templatesDir, 'skills');
213
+
214
+ describe('validation', () => {
215
+ it('has SKILL.md with required sections', () => {
216
+ const filePath = path.join(skillsDir, 'validation', 'SKILL.md');
217
+ expect(fs.existsSync(filePath)).toBe(true);
218
+ const content = fs.readFileSync(filePath, 'utf-8');
219
+ expect(content).toContain('---'); // YAML frontmatter
220
+ expect(content).toContain('name:');
221
+ expect(content).toContain('description:');
222
+ expect(content).toContain('## Overview');
223
+ expect(content).toContain('## When to Use');
224
+ expect(content).toContain('## The Process');
225
+ expect(content).toContain('## Red Flags');
226
+ expect(content).toContain('## Report Format');
227
+ expect(content).toContain('## Integration');
228
+ });
229
+
230
+ it('references validate.ts script', () => {
231
+ const filePath = path.join(skillsDir, 'validation', 'SKILL.md');
232
+ const content = fs.readFileSync(filePath, 'utf-8');
233
+ expect(content).toContain('validate.ts');
234
+ });
235
+ });
236
+ });
237
+ ```
238
+
239
+ - [ ] **Step 2: Run test to verify it fails**
240
+
241
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "validation"`
242
+ Expected: FAIL with "ENOENT: no such file or directory"
243
+
244
+ - [ ] **Step 3: Create validation SKILL.md**
245
+
246
+ ```markdown
247
+ ---
248
+ name: validation
249
+ description: "Checks workspace ICM compliance, runs validate.ts, and reports findings. Use when validating a workspace, checking compliance, running validation, or after making changes to workspace structure."
250
+ ---
251
+
252
+ ## Overview
253
+
254
+ Ensure workspace meets ICM standards through systematic validation.
255
+
256
+ ## When to Use
257
+
258
+ - After workspace scaffolding
259
+ - After any structural change
260
+ - Before claiming delivery
261
+ - When score drops below threshold
262
+
263
+ ## The Process
264
+
265
+ 1. **Run validate.ts** — Execute `node scripts/validate.ts --workspace <path>`
266
+ 2. **Parse results** — Read exit code and output
267
+ 3. **Check CONTEXT.md files** — Verify each numbered folder has non-empty CONTEXT.md
268
+ 4. **Check SYSTEM.md** — Verify folder map and rules exist
269
+ 5. **Check routing table** — Verify CONTEXT.md references all numbered folders
270
+ 6. **Generate report** — Output structured JSON report
271
+
272
+ ## Red Flags
273
+
274
+ - Empty CONTEXT.md files
275
+ - Missing SYSTEM.md
276
+ - Routing table doesn't match folder structure
277
+ - Duplicate content across files
278
+ - validate.ts exit code 1
279
+
280
+ ## Report Format
281
+
282
+ ```json
283
+ {
284
+ "skill": "validation",
285
+ "status": "passed|failed|escalated",
286
+ "timestamp": "<ISO-8601>",
287
+ "findings": ["<finding>"],
288
+ "recommendations": ["<recommendation>"],
289
+ "metrics": {
290
+ "score": <0-100>,
291
+ "itemsChecked": <number>,
292
+ "itemsPassed": <number>
293
+ },
294
+ "nextSkill": "prompt-engineering|iteration|none"
295
+ }
296
+ ```
297
+
298
+ ## Integration
299
+
300
+ - If validation fails → recommend prompt-engineering to fix content gaps
301
+ - If validation passes → recommend testing sub-skill
302
+ - If critical failures (missing SYSTEM.md) → escalate to human
303
+ ```
304
+
305
+ - [ ] **Step 4: Run tests to verify they pass**
306
+
307
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "validation"`
308
+ Expected: All validation tests pass
309
+
310
+ - [ ] **Step 5: Commit**
311
+
312
+ ```bash
313
+ git add templates/.workspace-templates/skills/validation/ tests/templates-enhanced.test.ts
314
+ git commit -m "feat: add validation sub-skill"
315
+ ```
316
+
317
+ ---
318
+
319
+ ### Task 3: Create Research Sub-Skill
320
+
321
+ **Files:**
322
+ - Create: `templates/.workspace-templates/skills/research/SKILL.md`
323
+ - Test: `tests/templates-enhanced.test.ts` (add research sub-skill tests)
324
+
325
+ - [ ] **Step 1: Write test for research sub-skill**
326
+
327
+ ```typescript
328
+ // Add to tests/templates-enhanced.test.ts
329
+ describe('research', () => {
330
+ it('has SKILL.md with required sections', () => {
331
+ const filePath = path.join(skillsDir, 'research', 'SKILL.md');
332
+ expect(fs.existsSync(filePath)).toBe(true);
333
+ const content = fs.readFileSync(filePath, 'utf-8');
334
+ expect(content).toContain('---');
335
+ expect(content).toContain('name:');
336
+ expect(content).toContain('description:');
337
+ expect(content).toContain('## Overview');
338
+ expect(content).toContain('## When to Use');
339
+ expect(content).toContain('## The Process');
340
+ expect(content).toContain('## Red Flags');
341
+ expect(content).toContain('## Report Format');
342
+ expect(content).toContain('## Integration');
343
+ });
344
+ });
345
+ ```
346
+
347
+ - [ ] **Step 2: Run test to verify it fails**
348
+
349
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "research"`
350
+ Expected: FAIL
351
+
352
+ - [ ] **Step 3: Create research SKILL.md**
353
+
354
+ ```markdown
355
+ ---
356
+ name: research
357
+ description: "Investigates patterns, gathers context, and identifies best practices for workspace design. Use when starting a new workspace, researching workflow patterns, or before architecture planning."
358
+ ---
359
+
360
+ ## Overview
361
+
362
+ Gather context and identify patterns before building.
363
+
364
+ ## When to Use
365
+
366
+ - Phase 1 of hybrid flow (always first)
367
+ - Before architecture planning
368
+ - When user asks for a novel workflow type
369
+ - When existing patterns don't fit the use case
370
+
371
+ ## The Process
372
+
373
+ 1. **Identify workflow type** — What kind of process is being automated?
374
+ 2. **Research similar patterns** — Look at existing workspaces, documentation, best practices
375
+ 3. **Identify key stages** — What are the natural phases of this workflow?
376
+ 4. **Determine inputs/outputs** — What goes in, what comes out at each stage?
377
+ 5. **Identify tooling needs** — What tools are commonly used for this workflow?
378
+ 6. **Document findings** — Create a research summary for the architecture phase
379
+
380
+ ## Red Flags
381
+
382
+ - Research is too generic (not specific to the workflow type)
383
+ - Missing input/output analysis
384
+ - No tooling assessment
385
+ - Skipping to architecture without completing research
386
+
387
+ ## Report Format
388
+
389
+ ```json
390
+ {
391
+ "skill": "research",
392
+ "status": "passed|failed|escalated",
393
+ "timestamp": "<ISO-8601>",
394
+ "findings": ["<finding>"],
395
+ "recommendations": ["<recommendation>"],
396
+ "metrics": {
397
+ "score": <0-100>,
398
+ "itemsChecked": <number>,
399
+ "itemsPassed": <number>
400
+ },
401
+ "nextSkill": "architecture"
402
+ }
403
+ ```
404
+
405
+ ## Integration
406
+
407
+ - Always dispatches to architecture sub-skill next
408
+ - Research findings inform architecture decisions
409
+ - If research is inconclusive → escalate to human for clarification
410
+ ```
411
+
412
+ - [ ] **Step 4: Run tests to verify they pass**
413
+
414
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "research"`
415
+ Expected: All research tests pass
416
+
417
+ - [ ] **Step 5: Commit**
418
+
419
+ ```bash
420
+ git add templates/.workspace-templates/skills/research/ tests/templates-enhanced.test.ts
421
+ git commit -m "feat: add research sub-skill"
422
+ ```
423
+
424
+ ---
425
+
426
+ ### Task 4: Create Architecture Sub-Skill
427
+
428
+ **Files:**
429
+ - Create: `templates/.workspace-templates/skills/architecture/SKILL.md`
430
+ - Test: `tests/templates-enhanced.test.ts` (add architecture sub-skill tests)
431
+
432
+ - [ ] **Step 1: Write test for architecture sub-skill**
433
+
434
+ ```typescript
435
+ describe('architecture', () => {
436
+ it('has SKILL.md with required sections', () => {
437
+ const filePath = path.join(skillsDir, 'architecture', 'SKILL.md');
438
+ expect(fs.existsSync(filePath)).toBe(true);
439
+ const content = fs.readFileSync(filePath, 'utf-8');
440
+ expect(content).toContain('---');
441
+ expect(content).toContain('name:');
442
+ expect(content).toContain('description:');
443
+ expect(content).toContain('## Overview');
444
+ expect(content).toContain('## When to Use');
445
+ expect(content).toContain('## The Process');
446
+ expect(content).toContain('## Red Flags');
447
+ expect(content).toContain('## Report Format');
448
+ expect(content).toContain('## Integration');
449
+ });
450
+ });
451
+ ```
452
+
453
+ - [ ] **Step 2: Run test to verify it fails**
454
+
455
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "architecture"`
456
+ Expected: FAIL
457
+
458
+ - [ ] **Step 3: Create architecture SKILL.md**
459
+
460
+ ```markdown
461
+ ---
462
+ name: architecture
463
+ description: "Designs workspace structure, plans folder layout, and creates the build plan. Use when planning workspace structure, designing folder hierarchy, or after research phase."
464
+ ---
465
+
466
+ ## Overview
467
+
468
+ Design the workspace structure based on research findings.
469
+
470
+ ## When to Use
471
+
472
+ - Phase 2 of hybrid flow (after research)
473
+ - When research is complete and building is next
474
+ - When restructuring an existing workspace
475
+
476
+ ## The Process
477
+
478
+ 1. **Review research findings** — Read the research sub-skill report
479
+ 2. **Define stage folders** — Determine numbered folder structure (01-xxx, 02-xxx, etc.)
480
+ 3. **Design routing table** — Plan CONTEXT.md routing for each stage
481
+ 4. **Define SYSTEM.md** — Plan folder map, rules, and tool inventory
482
+ 5. **Plan CONTEXT.md content** — Define what each stage's CONTEXT.md should contain
483
+ 6. **Create build plan** — Document the scaffold.ts command with all parameters
484
+ 7. **Get approval** — Present plan to user before building
485
+
486
+ ## Red Flags
487
+
488
+ - Stage folders don't follow sequential numbering
489
+ - Routing table doesn't reference all stages
490
+ - Missing SYSTEM.md plan
491
+ - Build plan doesn't specify all scaffold.ts parameters
492
+ - Skipping user approval before building
493
+
494
+ ## Report Format
495
+
496
+ ```json
497
+ {
498
+ "skill": "architecture",
499
+ "status": "passed|failed|escalated",
500
+ "timestamp": "<ISO-8601>",
501
+ "findings": ["<finding>"],
502
+ "recommendations": ["<recommendation>"],
503
+ "metrics": {
504
+ "score": <0-100>,
505
+ "itemsChecked": <number>,
506
+ "itemsPassed": <number>
507
+ },
508
+ "nextSkill": "none"
509
+ }
510
+ ```
511
+
512
+ ## Integration
513
+
514
+ - Receives input from research sub-skill
515
+ - Output informs scaffold.ts execution
516
+ - After approval → main skill runs scaffold.ts
517
+ - If architecture is unclear → escalate to human
518
+ ```
519
+
520
+ - [ ] **Step 4: Run tests to verify they pass**
521
+
522
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "architecture"`
523
+ Expected: All architecture tests pass
524
+
525
+ - [ ] **Step 5: Commit**
526
+
527
+ ```bash
528
+ git add templates/.workspace-templates/skills/architecture/ tests/templates-enhanced.test.ts
529
+ git commit -m "feat: add architecture sub-skill"
530
+ ```
531
+
532
+ ---
533
+
534
+ ### Task 5: Create Prompt-Engineering Sub-Skill
535
+
536
+ **Files:**
537
+ - Create: `templates/.workspace-templates/skills/prompt-engineering/SKILL.md`
538
+ - Test: `tests/templates-enhanced.test.ts` (add prompt-engineering sub-skill tests)
539
+
540
+ - [ ] **Step 1: Write test for prompt-engineering sub-skill**
541
+
542
+ ```typescript
543
+ describe('prompt-engineering', () => {
544
+ it('has SKILL.md with required sections', () => {
545
+ const filePath = path.join(skillsDir, 'prompt-engineering', 'SKILL.md');
546
+ expect(fs.existsSync(filePath)).toBe(true);
547
+ const content = fs.readFileSync(filePath, 'utf-8');
548
+ expect(content).toContain('---');
549
+ expect(content).toContain('name:');
550
+ expect(content).toContain('description:');
551
+ expect(content).toContain('## Overview');
552
+ expect(content).toContain('## When to Use');
553
+ expect(content).toContain('## The Process');
554
+ expect(content).toContain('## Red Flags');
555
+ expect(content).toContain('## Report Format');
556
+ expect(content).toContain('## Integration');
557
+ });
558
+ });
559
+ ```
560
+
561
+ - [ ] **Step 2: Run test to verify it fails**
562
+
563
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "prompt-engineering"`
564
+ Expected: FAIL
565
+
566
+ - [ ] **Step 3: Create prompt-engineering SKILL.md**
567
+
568
+ ```markdown
569
+ ---
570
+ name: prompt-engineering
571
+ description: "Improves CONTEXT.md and SYSTEM.md prompts for better agent behavior. Use when workspace score is below 80, prompts need improvement, or after validation identifies content gaps."
572
+ ---
573
+
574
+ ## Overview
575
+
576
+ Optimize workspace prompts for clarity, completeness, and agent guidance.
577
+
578
+ ## When to Use
579
+
580
+ - Score < 80 in benchmark results
581
+ - Validation identifies missing content
582
+ - Prompts are vague or incomplete
583
+ - Agent behavior doesn't match expectations
584
+
585
+ ## The Process
586
+
587
+ 1. **Identify weak prompts** — Read benchmark findings and validation failures
588
+ 2. **Analyze current prompts** — What's missing, vague, or unclear?
589
+ 3. **Apply prompt patterns** — Use clear structure, examples, constraints, and output formats
590
+ 4. **Update CONTEXT.md files** — Improve stage-specific instructions
591
+ 5. **Update SYSTEM.md if needed** — Improve folder map, rules, or tool inventory
592
+ 6. **Re-run validation** — Verify improvements didn't break anything
593
+ 7. **Re-run benchmark** — Check if score improved
594
+
595
+ ## Red Flags
596
+
597
+ - Making cosmetic changes without functional improvement
598
+ - Changing prompts without re-validating
599
+ - Removing content instead of improving it
600
+ - Not checking if score actually improved
601
+
602
+ ## Report Format
603
+
604
+ ```json
605
+ {
606
+ "skill": "prompt-engineering",
607
+ "status": "passed|failed|escalated",
608
+ "timestamp": "<ISO-8601>",
609
+ "findings": ["<finding>"],
610
+ "recommendations": ["<recommendation>"],
611
+ "metrics": {
612
+ "score": <0-100>,
613
+ "itemsChecked": <number>,
614
+ "itemsPassed": <number>,
615
+ "scoreBefore": <number>,
616
+ "scoreAfter": <number>
617
+ },
618
+ "nextSkill": "testing|iteration|none"
619
+ }
620
+ ```
621
+
622
+ ## Integration
623
+
624
+ - Dispatched when score < 80
625
+ - After improvements → dispatch testing to verify
626
+ - If score doesn't improve → dispatch iteration for deeper fixes
627
+ ```
628
+
629
+ - [ ] **Step 4: Run tests to verify they pass**
630
+
631
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "prompt-engineering"`
632
+ Expected: All prompt-engineering tests pass
633
+
634
+ - [ ] **Step 5: Commit**
635
+
636
+ ```bash
637
+ git add templates/.workspace-templates/skills/prompt-engineering/ tests/templates-enhanced.test.ts
638
+ git commit -m "feat: add prompt-engineering sub-skill"
639
+ ```
640
+
641
+ ---
642
+
643
+ ### Task 6: Create Testing Sub-Skill
644
+
645
+ **Files:**
646
+ - Create: `templates/.workspace-templates/skills/testing/SKILL.md`
647
+ - Test: `tests/templates-enhanced.test.ts` (add testing sub-skill tests)
648
+
649
+ - [ ] **Step 1: Write test for testing sub-skill**
650
+
651
+ ```typescript
652
+ describe('testing', () => {
653
+ it('has SKILL.md with required sections', () => {
654
+ const filePath = path.join(skillsDir, 'testing', 'SKILL.md');
655
+ expect(fs.existsSync(filePath)).toBe(true);
656
+ const content = fs.readFileSync(filePath, 'utf-8');
657
+ expect(content).toContain('---');
658
+ expect(content).toContain('name:');
659
+ expect(content).toContain('description:');
660
+ expect(content).toContain('## Overview');
661
+ expect(content).toContain('## When to Use');
662
+ expect(content).toContain('## The Process');
663
+ expect(content).toContain('## Red Flags');
664
+ expect(content).toContain('## Report Format');
665
+ expect(content).toContain('## Integration');
666
+ });
667
+ });
668
+ ```
669
+
670
+ - [ ] **Step 2: Run test to verify it fails**
671
+
672
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "testing"`
673
+ Expected: FAIL
674
+
675
+ - [ ] **Step 3: Create testing SKILL.md**
676
+
677
+ ```markdown
678
+ ---
679
+ name: testing
680
+ description: "Generates and runs test cases, evaluates results, and identifies gaps. Use when testing workspace quality, generating test cases, or after prompt improvements."
681
+ ---
682
+
683
+ ## Overview
684
+
685
+ Verify workspace quality through systematic testing.
686
+
687
+ ## When to Use
688
+
689
+ - After prompt-engineering improvements
690
+ - When no tests exist for the workspace
691
+ - Before claiming delivery
692
+ - When score is above 80 but quality is uncertain
693
+
694
+ ## The Process
695
+
696
+ 1. **Generate test cases** — Run `node scripts/generate-tests.ts --workspace <path> --output ./tests.json`
697
+ 2. **Read test cases** — Parse the generated test cases
698
+ 3. **Run generation tests** — For each test case, create sample content the stage should produce
699
+ 4. **Run evaluation tests** — Review CONTEXT.md files against test cases
700
+ 5. **Aggregate results** — Identify patterns and gaps
701
+ 6. **Document findings** — Create test report with pass/fail per test case
702
+
703
+ ## Red Flags
704
+
705
+ - Skipping test generation
706
+ - Not running both generation and evaluation tests
707
+ - Ignoring failed test cases
708
+ - Not documenting patterns in failures
709
+
710
+ ## Report Format
711
+
712
+ ```json
713
+ {
714
+ "skill": "testing",
715
+ "status": "passed|failed|escalated",
716
+ "timestamp": "<ISO-8601>",
717
+ "findings": ["<finding>"],
718
+ "recommendations": ["<recommendation>"],
719
+ "metrics": {
720
+ "score": <0-100>,
721
+ "itemsChecked": <number>,
722
+ "itemsPassed": <number>,
723
+ "testCasesGenerated": <number>,
724
+ "testCasesPassed": <number>
725
+ },
726
+ "nextSkill": "iteration|none"
727
+ }
728
+ ```
729
+
730
+ ## Integration
731
+
732
+ - Dispatched after prompt-engineering
733
+ - If tests fail → dispatch iteration for fixes
734
+ - If tests pass → workflow is nearly complete
735
+ ```
736
+
737
+ - [ ] **Step 4: Run tests to verify they pass**
738
+
739
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "testing"`
740
+ Expected: All testing tests pass
741
+
742
+ - [ ] **Step 5: Commit**
743
+
744
+ ```bash
745
+ git add templates/.workspace-templates/skills/testing/ tests/templates-enhanced.test.ts
746
+ git commit -m "feat: add testing sub-skill"
747
+ ```
748
+
749
+ ---
750
+
751
+ ### Task 7: Create Iteration Sub-Skill
752
+
753
+ **Files:**
754
+ - Create: `templates/.workspace-templates/skills/iteration/SKILL.md`
755
+ - Test: `tests/templates-enhanced.test.ts` (add iteration sub-skill tests)
756
+
757
+ - [ ] **Step 1: Write test for iteration sub-skill**
758
+
759
+ ```typescript
760
+ describe('iteration', () => {
761
+ it('has SKILL.md with required sections', () => {
762
+ const filePath = path.join(skillsDir, 'iteration', 'SKILL.md');
763
+ expect(fs.existsSync(filePath)).toBe(true);
764
+ const content = fs.readFileSync(filePath, 'utf-8');
765
+ expect(content).toContain('---');
766
+ expect(content).toContain('name:');
767
+ expect(content).toContain('description:');
768
+ expect(content).toContain('## Overview');
769
+ expect(content).toContain('## When to Use');
770
+ expect(content).toContain('## The Process');
771
+ expect(content).toContain('## Red Flags');
772
+ expect(content).toContain('## Report Format');
773
+ expect(content).toContain('## Integration');
774
+ });
775
+ });
776
+ ```
777
+
778
+ - [ ] **Step 2: Run test to verify it fails**
779
+
780
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "iteration"`
781
+ Expected: FAIL
782
+
783
+ - [ ] **Step 3: Create iteration SKILL.md**
784
+
785
+ ```markdown
786
+ ---
787
+ name: iteration
788
+ description: "Runs autonomous improvement loops with benchmark scoring. Use when score plateaued, deeper fixes needed, or after testing identifies patterns."
789
+ ---
790
+
791
+ ## Overview
792
+
793
+ Execute improvement loops until quality thresholds are met.
794
+
795
+ ## When to Use
796
+
797
+ - Score plateaued (no improvement between runs)
798
+ - Testing identified patterns requiring deeper fixes
799
+ - Validation failures persist after prompt-engineering
800
+ - As part of the condition-driven improvement loop
801
+
802
+ ## The Process
803
+
804
+ 1. **Run iterate.ts** — Execute `node scripts/iterate.ts --workspace <path> --max-retries 3`
805
+ 2. **Read benchmark results** — Parse the JSON output
806
+ 3. **Identify improvement areas** — Read fixSuggestions and improvementPotential
807
+ 4. **Apply fixes** — Address each suggestion systematically
808
+ 5. **Re-run iteration** — Check if score improved
809
+ 6. **Repeat until threshold** — Continue until score > 85 or no improvement possible
810
+ 7. **Escalate if stuck** — If score doesn't improve after 3 attempts, escalate to human
811
+
812
+ ## Red Flags
813
+
814
+ - Claiming improvement without re-running benchmark
815
+ - Skipping fix suggestions
816
+ - Infinite iteration loops (always re-run with max 3 attempts)
817
+ - Not escalating when stuck
818
+
819
+ ## Report Format
820
+
821
+ ```json
822
+ {
823
+ "skill": "iteration",
824
+ "status": "passed|failed|escalated",
825
+ "timestamp": "<ISO-8601>",
826
+ "findings": ["<finding>"],
827
+ "recommendations": ["<recommendation>"],
828
+ "metrics": {
829
+ "score": <0-100>,
830
+ "itemsChecked": <number>,
831
+ "itemsPassed": <number>,
832
+ "iterationsRun": <number>,
833
+ "scoreBefore": <number>,
834
+ "scoreAfter": <number>
835
+ },
836
+ "nextSkill": "none"
837
+ }
838
+ ```
839
+
840
+ ## Integration
841
+
842
+ - Dispatched when score plateaued
843
+ - After iteration → re-run validation and benchmark
844
+ - If score > 85 → workflow complete
845
+ - If stuck after 3 attempts → escalate to human
846
+ ```
847
+
848
+ - [ ] **Step 4: Run tests to verify they pass**
849
+
850
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "iteration"`
851
+ Expected: All iteration tests pass
852
+
853
+ - [ ] **Step 5: Commit**
854
+
855
+ ```bash
856
+ git add templates/.workspace-templates/skills/iteration/ tests/templates-enhanced.test.ts
857
+ git commit -m "feat: add iteration sub-skill"
858
+ ```
859
+
860
+ ---
861
+
862
+ ### Task 8: Create Tooling Sub-Skill
863
+
864
+ **Files:**
865
+ - Create: `templates/.workspace-templates/skills/tooling/SKILL.md`
866
+ - Test: `tests/templates-enhanced.test.ts` (add tooling sub-skill tests)
867
+
868
+ - [ ] **Step 1: Write test for tooling sub-skill**
869
+
870
+ ```typescript
871
+ describe('tooling', () => {
872
+ it('has SKILL.md with required sections', () => {
873
+ const filePath = path.join(skillsDir, 'tooling', 'SKILL.md');
874
+ expect(fs.existsSync(filePath)).toBe(true);
875
+ const content = fs.readFileSync(filePath, 'utf-8');
876
+ expect(content).toContain('---');
877
+ expect(content).toContain('name:');
878
+ expect(content).toContain('description:');
879
+ expect(content).toContain('## Overview');
880
+ expect(content).toContain('## When to Use');
881
+ expect(content).toContain('## The Process');
882
+ expect(content).toContain('## Red Flags');
883
+ expect(content).toContain('## Report Format');
884
+ expect(content).toContain('## Integration');
885
+ });
886
+ });
887
+ ```
888
+
889
+ - [ ] **Step 2: Run test to verify it fails**
890
+
891
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "tooling"`
892
+ Expected: FAIL
893
+
894
+ - [ ] **Step 3: Create tooling SKILL.md**
895
+
896
+ ```markdown
897
+ ---
898
+ name: tooling
899
+ description: "Assesses, installs, and configures tools for the workspace. Use when tools are missing, tool inventory needs updating, or workspace requires specific dependencies."
900
+ ---
901
+
902
+ ## Overview
903
+
904
+ Ensure workspace has the right tools installed and configured.
905
+
906
+ ## When to Use
907
+
908
+ - Tool inventory is empty or incomplete
909
+ - Workspace requires specific dependencies
910
+ - After architecture phase identifies tooling needs
911
+ - When user requests specific tool installation
912
+
913
+ ## The Process
914
+
915
+ 1. **Scan current tools** — Read SYSTEM.md tool inventory
916
+ 2. **Identify missing tools** — Compare against workspace requirements
917
+ 3. **Propose tools** — List recommended tools with justifications
918
+ 4. **Get approval** — Present tool list to user for approval
919
+ 5. **Install tools** — Run `node scripts/install-tool.ts --tool <name> --manager <mgr> --workspace <path>`
920
+ 6. **Update inventory** — Verify tool inventory is updated
921
+ 7. **Verify installation** — Confirm tools are accessible
922
+
923
+ ## Red Flags
924
+
925
+ - Installing tools without user approval
926
+ - Not updating tool inventory after installation
927
+ - Installing unnecessary tools
928
+ - Skipping verification after installation
929
+
930
+ ## Report Format
931
+
932
+ ```json
933
+ {
934
+ "skill": "tooling",
935
+ "status": "passed|failed|escalated",
936
+ "timestamp": "<ISO-8601>",
937
+ "findings": ["<finding>"],
938
+ "recommendations": ["<recommendation>"],
939
+ "metrics": {
940
+ "score": <0-100>,
941
+ "itemsChecked": <number>,
942
+ "itemsPassed": <number>,
943
+ "toolsInstalled": <number>,
944
+ "toolsProposed": <number>
945
+ },
946
+ "nextSkill": "none"
947
+ }
948
+ ```
949
+
950
+ ## Integration
951
+
952
+ - Dispatched when tools are missing
953
+ - After installation → workflow continues to next phase
954
+ - If tool installation fails → escalate to human
955
+ ```
956
+
957
+ - [ ] **Step 4: Run tests to verify they pass**
958
+
959
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "tooling"`
960
+ Expected: All tooling tests pass
961
+
962
+ - [ ] **Step 5: Commit**
963
+
964
+ ```bash
965
+ git add templates/.workspace-templates/skills/tooling/ tests/templates-enhanced.test.ts
966
+ git commit -m "feat: add tooling sub-skill"
967
+ ```
968
+
969
+ ---
970
+
971
+ ### Task 9: Create Dispatch Script
972
+
973
+ **Files:**
974
+ - Create: `src/scripts/dispatch.ts`
975
+ - Test: `tests/dispatch.test.ts`
976
+
977
+ - [ ] **Step 1: Write tests for dispatch.ts**
978
+
979
+ ```typescript
980
+ // tests/dispatch.test.ts
981
+ import * as fs from 'fs';
982
+ import * as path from 'path';
983
+ import * as os from 'os';
984
+ import { dispatchSkill, DispatchReport } from '../src/scripts/dispatch';
985
+
986
+ describe('dispatchSkill', () => {
987
+ let tempDir: string;
988
+
989
+ beforeEach(() => {
990
+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'dispatch-test-'));
991
+ });
992
+
993
+ afterEach(() => {
994
+ fs.rmSync(tempDir, { recursive: true, force: true });
995
+ });
996
+
997
+ it('loads and returns report for a valid sub-skill', () => {
998
+ const skillsDir = path.join(tempDir, 'skills');
999
+ fs.mkdirSync(path.join(skillsDir, 'validation'), { recursive: true });
1000
+ fs.writeFileSync(path.join(skillsDir, 'validation', 'SKILL.md'), '---\nname: validation\ndescription: test\n---\n\n## Overview\nTest');
1001
+
1002
+ const result = dispatchSkill('validation', skillsDir);
1003
+
1004
+ expect(result.skill).toBe('validation');
1005
+ expect(result.status).toBeDefined();
1006
+ expect(result.timestamp).toBeDefined();
1007
+ });
1008
+
1009
+ it('returns failed status for non-existent skill', () => {
1010
+ const skillsDir = path.join(tempDir, 'skills');
1011
+ fs.mkdirSync(skillsDir, { recursive: true });
1012
+
1013
+ const result = dispatchSkill('nonexistent', skillsDir);
1014
+
1015
+ expect(result.skill).toBe('nonexistent');
1016
+ expect(result.status).toBe('failed');
1017
+ expect(result.findings.length).toBeGreaterThan(0);
1018
+ });
1019
+
1020
+ it('includes nextSkill recommendation in report', () => {
1021
+ const skillsDir = path.join(tempDir, 'skills');
1022
+ fs.mkdirSync(path.join(skillsDir, 'validation'), { recursive: true });
1023
+ fs.writeFileSync(path.join(skillsDir, 'validation', 'SKILL.md'), '---\nname: validation\ndescription: test\n---\n\n## Overview\nTest');
1024
+
1025
+ const result = dispatchSkill('validation', skillsDir);
1026
+
1027
+ expect(result.nextSkill).toBeDefined();
1028
+ });
1029
+ });
1030
+ ```
1031
+
1032
+ - [ ] **Step 2: Run tests to verify they fail**
1033
+
1034
+ Run: `npm test -- tests/dispatch.test.ts`
1035
+ Expected: FAIL with "Cannot find module '../src/scripts/dispatch'"
1036
+
1037
+ - [ ] **Step 3: Implement dispatch.ts**
1038
+
1039
+ ```typescript
1040
+ import * as fs from 'fs';
1041
+ import * as path from 'path';
1042
+
1043
+ export interface DispatchReport {
1044
+ skill: string;
1045
+ status: 'passed' | 'failed' | 'escalated';
1046
+ timestamp: string;
1047
+ findings: string[];
1048
+ recommendations: string[];
1049
+ metrics: Record<string, number>;
1050
+ nextSkill: string;
1051
+ }
1052
+
1053
+ const SKILL_NEXT_MAP: Record<string, string> = {
1054
+ research: 'architecture',
1055
+ architecture: 'none',
1056
+ validation: 'prompt-engineering',
1057
+ 'prompt-engineering': 'testing',
1058
+ testing: 'iteration',
1059
+ iteration: 'none',
1060
+ tooling: 'none',
1061
+ };
1062
+
1063
+ export function dispatchSkill(skillName: string, skillsDir: string): DispatchReport {
1064
+ const skillPath = path.join(skillsDir, skillName, 'SKILL.md');
1065
+
1066
+ if (!fs.existsSync(skillPath)) {
1067
+ return {
1068
+ skill: skillName,
1069
+ status: 'failed',
1070
+ timestamp: new Date().toISOString(),
1071
+ findings: [`Sub-skill SKILL.md not found: ${skillPath}`],
1072
+ recommendations: ['Ensure the sub-skill directory and SKILL.md exist'],
1073
+ metrics: {},
1074
+ nextSkill: 'none',
1075
+ };
1076
+ }
1077
+
1078
+ const content = fs.readFileSync(skillPath, 'utf-8');
1079
+
1080
+ // Parse frontmatter to extract name
1081
+ const nameMatch = content.match(/^---\nname:\s*(.+)$/m);
1082
+ const skill = nameMatch ? nameMatch[1].trim() : skillName;
1083
+
1084
+ return {
1085
+ skill,
1086
+ status: 'passed',
1087
+ timestamp: new Date().toISOString(),
1088
+ findings: [`Sub-skill "${skill}" loaded successfully`],
1089
+ recommendations: ['Follow the sub-skill instructions to complete the task'],
1090
+ metrics: {
1091
+ contentLength: content.length,
1092
+ },
1093
+ nextSkill: SKILL_NEXT_MAP[skillName] ?? 'none',
1094
+ };
1095
+ }
1096
+
1097
+ if (require.main === module) {
1098
+ const args = process.argv.slice(2);
1099
+ const parseArg = (flag: string): string | undefined => {
1100
+ const idx = args.indexOf(flag);
1101
+ return idx !== -1 ? args[idx + 1] : undefined;
1102
+ };
1103
+
1104
+ const skill = parseArg('--skill');
1105
+ const workspace = parseArg('--workspace');
1106
+
1107
+ if (!skill) {
1108
+ console.error('Usage: node dispatch.ts --skill <name> --workspace <path>');
1109
+ process.exit(1);
1110
+ }
1111
+
1112
+ const skillsDir = workspace
1113
+ ? path.join(workspace, '.agents', 'skills', 'workspace-maxxing', 'skills')
1114
+ : path.join(process.cwd(), 'skills');
1115
+
1116
+ const result = dispatchSkill(skill, skillsDir);
1117
+ console.log(JSON.stringify(result, null, 2));
1118
+ }
1119
+ ```
1120
+
1121
+ - [ ] **Step 4: Run tests to verify they pass**
1122
+
1123
+ Run: `npm test -- tests/dispatch.test.ts`
1124
+ Expected: All 3 tests pass
1125
+
1126
+ - [ ] **Step 5: Commit**
1127
+
1128
+ ```bash
1129
+ git add src/scripts/dispatch.ts tests/dispatch.test.ts
1130
+ git commit -m "feat: add dispatch script for sub-skill invocation"
1131
+ ```
1132
+
1133
+ ---
1134
+
1135
+ ### Task 10: Rewrite Main SKILL.md with obra patterns
1136
+
1137
+ **Files:**
1138
+ - Modify: `templates/SKILL.md`
1139
+ - Test: `tests/templates.test.ts` (update existing tests)
1140
+
1141
+ - [ ] **Step 1: Write test for rewritten SKILL.md**
1142
+
1143
+ ```typescript
1144
+ // Add to tests/templates.test.ts
1145
+ describe('Main SKILL.md with obra patterns', () => {
1146
+ it('has YAML frontmatter with name and description', () => {
1147
+ const skillPath = path.join(__dirname, '..', 'templates', 'SKILL.md');
1148
+ const content = fs.readFileSync(skillPath, 'utf-8');
1149
+ expect(content).toMatch(/^---\nname:/m);
1150
+ expect(content).toMatch(/description:/);
1151
+ });
1152
+
1153
+ it('has required sections', () => {
1154
+ const skillPath = path.join(__dirname, '..', 'templates', 'SKILL.md');
1155
+ const content = fs.readFileSync(skillPath, 'utf-8');
1156
+ expect(content).toContain('## Overview');
1157
+ expect(content).toContain('## When to Use');
1158
+ expect(content).toContain('## The Iron Law');
1159
+ expect(content).toContain('## Hybrid Flow');
1160
+ expect(content).toContain('## Sub-Skill Dispatch');
1161
+ expect(content).toContain('## Available Scripts');
1162
+ expect(content).toContain('## Anti-Rationalization Table');
1163
+ expect(content).toContain('## Integration');
1164
+ });
1165
+
1166
+ it('references all 7 sub-skills', () => {
1167
+ const skillPath = path.join(__dirname, '..', 'templates', 'SKILL.md');
1168
+ const content = fs.readFileSync(skillPath, 'utf-8');
1169
+ expect(content).toContain('validation');
1170
+ expect(content).toContain('research');
1171
+ expect(content).toContain('prompt-engineering');
1172
+ expect(content).toContain('testing');
1173
+ expect(content).toContain('iteration');
1174
+ expect(content).toContain('architecture');
1175
+ expect(content).toContain('tooling');
1176
+ });
1177
+ });
1178
+ ```
1179
+
1180
+ - [ ] **Step 2: Run tests to verify they fail**
1181
+
1182
+ Run: `npm test -- tests/templates.test.ts -t "obra patterns"`
1183
+ Expected: FAIL (sections don't exist yet)
1184
+
1185
+ - [ ] **Step 3: Rewrite SKILL.md**
1186
+
1187
+ ```markdown
1188
+ ---
1189
+ name: workspace-maxxing
1190
+ description: "Autonomously creates, validates, and improves ICM-compliant workspaces. Use when user asks to 'build a workspace', 'create a workflow', 'automate a process', 'improve this workspace', 'validate this workspace', or 'iterate on this workspace'."
1191
+ ---
1192
+
1193
+ # Workspace-Maxxing Skill
1194
+
1195
+ ## Overview
1196
+
1197
+ Autonomous workflow system that creates, validates, and improves ICM-compliant workspaces through phased execution and condition-driven improvement loops.
1198
+
1199
+ ## When to Use
1200
+
1201
+ - User asks to build, create, or automate a workflow
1202
+ - User asks to improve, validate, or iterate on an existing workspace
1203
+ - User asks for workspace architecture or structure design
1204
+ - User asks to assess or install tools for a workspace
1205
+
1206
+ ## When Not to Use
1207
+
1208
+ - Simple file creation or editing (use direct file operations)
1209
+ - Questions about ICM methodology (answer directly)
1210
+ - Non-workspace tasks (check for other applicable skills first)
1211
+
1212
+ ## The Iron Law
1213
+
1214
+ NO BUILD WITHOUT PLAN
1215
+ NO PLAN WITHOUT RESEARCH
1216
+ NO IMPROVEMENT WITHOUT VALIDATION
1217
+ NO COMPLETION CLAIM WITHOUT VERIFICATION
1218
+
1219
+ ## Hybrid Flow
1220
+
1221
+ ```
1222
+ Phase 1: RESEARCH (dispatch research sub-skill)
1223
+
1224
+ Phase 2: ARCHITECTURE (dispatch architecture sub-skill)
1225
+
1226
+ Phase 3: BUILD (use scaffold.ts script)
1227
+
1228
+ Phase 4: VALIDATE (dispatch validation sub-skill)
1229
+
1230
+ Condition Loop (repeat until score > 85 AND all validations pass):
1231
+ ├─ If validation failed → dispatch validation sub-skill
1232
+ ├─ If score < 80 → dispatch prompt-engineering sub-skill
1233
+ ├─ If no tests exist → dispatch testing sub-skill
1234
+ ├─ If score plateaued → dispatch iteration sub-skill
1235
+ └─ If tools missing → dispatch tooling sub-skill
1236
+
1237
+ Phase 5: DELIVER
1238
+ ```
1239
+
1240
+ ## Sub-Skill Dispatch
1241
+
1242
+ | Condition | Sub-Skill | Command |
1243
+ |-----------|-----------|---------|
1244
+ | Starting new workflow | `research` | `node scripts/dispatch.ts --skill research --workspace ./workspace` |
1245
+ | After research complete | `architecture` | `node scripts/dispatch.ts --skill architecture --workspace ./workspace` |
1246
+ | After architecture approved | (use scaffold.ts) | `node scripts/scaffold.ts --name "<name>" --stages "<stages>" --output ./workspace` |
1247
+ | After building | `validation` | `node scripts/dispatch.ts --skill validation --workspace ./workspace` |
1248
+ | Validation failed | `validation` | Re-run validation sub-skill |
1249
+ | Score < 80 | `prompt-engineering` | `node scripts/dispatch.ts --skill prompt-engineering --workspace ./workspace` |
1250
+ | No tests exist | `testing` | `node scripts/dispatch.ts --skill testing --workspace ./workspace` |
1251
+ | Score plateaued | `iteration` | `node scripts/dispatch.ts --skill iteration --workspace ./workspace` |
1252
+ | Tools missing | `tooling` | `node scripts/dispatch.ts --skill tooling --workspace ./workspace` |
1253
+
1254
+ ## Available Scripts
1255
+
1256
+ ### scaffold.ts — Generate ICM Workspace
1257
+
1258
+ Creates a complete ICM workspace structure from a plan.
1259
+
1260
+ ```bash
1261
+ node scripts/scaffold.ts --name "research" --stages "01-research,02-analysis,03-report" --output ./workspace
1262
+ ```
1263
+
1264
+ Options:
1265
+ - `--name <name>` — Workspace name
1266
+ - `--stages <s1,s2,...>` — Comma-separated stage folder names
1267
+ - `--output <path>` — Where to create the workspace
1268
+ - `--force` — Overwrite if output directory already exists
1269
+
1270
+ ### validate.ts — Check ICM Compliance
1271
+
1272
+ Validates a workspace against ICM rules.
1273
+
1274
+ ```bash
1275
+ node scripts/validate.ts --workspace ./workspace
1276
+ ```
1277
+
1278
+ Exit code: 0 = all pass, 1 = some failed
1279
+
1280
+ ### install-tool.ts — Install Packages
1281
+
1282
+ Installs a tool and updates the workspace inventory.
1283
+
1284
+ ```bash
1285
+ node scripts/install-tool.ts --tool "pdf-lib" --manager npm --workspace ./workspace
1286
+ ```
1287
+
1288
+ Supported managers: `npm`, `pip`, `npx`, `brew`
1289
+
1290
+ ### iterate.ts — Autonomous Iteration
1291
+
1292
+ Runs a 3-pass improvement loop: validate-fix → score → checklist.
1293
+
1294
+ ```bash
1295
+ node scripts/iterate.ts --workspace ./workspace --max-retries 3
1296
+ ```
1297
+
1298
+ ### generate-tests.ts — Generate Test Cases
1299
+
1300
+ Creates test cases for each stage (sample, edge-case, empty).
1301
+
1302
+ ```bash
1303
+ node scripts/generate-tests.ts --workspace ./workspace --output ./tests.json
1304
+ ```
1305
+
1306
+ ### benchmark.ts — Weighted Benchmark Scoring
1307
+
1308
+ Runs weighted benchmark scoring on a workspace.
1309
+
1310
+ ```bash
1311
+ node scripts/benchmark.ts --workspace ./workspace
1312
+ ```
1313
+
1314
+ ### dispatch.ts — Sub-Skill Dispatcher
1315
+
1316
+ Loads and executes sub-skill workflows.
1317
+
1318
+ ```bash
1319
+ node scripts/dispatch.ts --skill <name> --workspace ./workspace
1320
+ ```
1321
+
1322
+ ## Anti-Rationalization Table
1323
+
1324
+ | Thought | Reality |
1325
+ |---------|---------|
1326
+ | "This workspace looks good enough" | Good enough is the enemy of excellent. Run validation. |
1327
+ | "I'll skip research and go straight to building" | Building without research produces generic, non-optimal workspaces. |
1328
+ | "The user didn't ask for tests" | Autonomous workflows require self-verification. Tests are mandatory. |
1329
+ | "I'll fix this later" | Later never comes. Fix it now or escalate. |
1330
+ | "This sub-skill doesn't apply here" | If there's a 1% chance it applies, dispatch it. |
1331
+ | "The score is fine" | Fine is not good. Target > 85. |
1332
+ | "I already validated this" | Validation is a snapshot. Re-validate after every change. |
1333
+ | "I'll do all phases at once" | Phases exist for a reason. Complete each before moving to the next. |
1334
+
1335
+ ## Integration
1336
+
1337
+ - Sub-skills live in `skills/` directory, loaded via dispatch.ts
1338
+ - Shared references in `references/` directory (anti-patterns, reporting-format, iron-laws)
1339
+ - All sub-skills return structured JSON reports
1340
+ - Condition loop continues until score > 85 AND all validations pass
1341
+ - Escalate to human if stuck after 3 iteration attempts
1342
+
1343
+ ## ICM Rules
1344
+ - Canonical sources: each fact lives in exactly one file
1345
+ - One-way dependencies only: A → B, never B → A
1346
+ - Selective loading: route to sections, not whole files
1347
+ - Numbered folders for workflow stages
1348
+
1349
+ ## Output Format
1350
+ - workspace/ — the built workspace
1351
+ - .agents/skills/<workspace-name>/ — installable skill
1352
+ - USAGE.md — how to use this workspace in future sessions
1353
+ ```
1354
+
1355
+ - [ ] **Step 4: Run tests to verify they pass**
1356
+
1357
+ Run: `npm test -- tests/templates.test.ts`
1358
+ Expected: All template tests pass (including new obra pattern tests)
1359
+
1360
+ - [ ] **Step 5: Commit**
1361
+
1362
+ ```bash
1363
+ git add templates/SKILL.md tests/templates.test.ts
1364
+ git commit -m "feat: rewrite SKILL.md with obra patterns and sub-skill dispatch"
1365
+ ```
1366
+
1367
+ ---
1368
+
1369
+ ### Task 11: Enhance Installer for Sub-Skills
1370
+
1371
+ **Files:**
1372
+ - Modify: `src/install.ts`
1373
+ - Test: `tests/install.test.ts` (add sub-skill installation tests)
1374
+
1375
+ - [ ] **Step 1: Write tests for sub-skill installation**
1376
+
1377
+ ```typescript
1378
+ // Add to tests/install.test.ts
1379
+ describe('sub-skill installation', () => {
1380
+ it('copies skills directory during install', async () => {
1381
+ const projectDir = path.join(tempDir, 'my-project');
1382
+ fs.mkdirSync(projectDir, { recursive: true });
1383
+ fs.writeFileSync(path.join(projectDir, 'package.json'), '{}');
1384
+
1385
+ const templatesDir = path.join(__dirname, '..', 'templates');
1386
+ const result = await installSkill(projectDir, templatesDir);
1387
+
1388
+ expect(result.success).toBe(true);
1389
+ expect(fs.existsSync(path.join(projectDir, '.agents', 'skills', 'workspace-maxxing', 'skills', 'validation', 'SKILL.md'))).toBe(true);
1390
+ expect(fs.existsSync(path.join(projectDir, '.agents', 'skills', 'workspace-maxxing', 'skills', 'research', 'SKILL.md'))).toBe(true);
1391
+ });
1392
+
1393
+ it('copies references directory during install', async () => {
1394
+ const projectDir = path.join(tempDir, 'my-project');
1395
+ fs.mkdirSync(projectDir, { recursive: true });
1396
+ fs.writeFileSync(path.join(projectDir, 'package.json'), '{}');
1397
+
1398
+ const templatesDir = path.join(__dirname, '..', 'templates');
1399
+ const result = await installSkill(projectDir, templatesDir);
1400
+
1401
+ expect(result.success).toBe(true);
1402
+ expect(fs.existsSync(path.join(projectDir, '.agents', 'skills', 'workspace-maxxing', 'references', 'anti-patterns.md'))).toBe(true);
1403
+ expect(fs.existsSync(path.join(projectDir, '.agents', 'skills', 'workspace-maxxing', 'references', 'iron-laws.md'))).toBe(true);
1404
+ });
1405
+ });
1406
+ ```
1407
+
1408
+ - [ ] **Step 2: Run tests to verify they fail**
1409
+
1410
+ Run: `npm test -- tests/install.test.ts -t "sub-skill"`
1411
+ Expected: FAIL (skills/references not copied yet)
1412
+
1413
+ - [ ] **Step 3: Verify installer already handles sub-skills**
1414
+
1415
+ The installer uses `copyDirSync` to copy the entire `.workspace-templates/` directory. Since `skills/` and `references/` are inside `.workspace-templates/`, they will be copied automatically. No code changes needed to `install.ts`.
1416
+
1417
+ Verify by checking that the directory structure exists:
1418
+ ```bash
1419
+ ls templates/.workspace-templates/skills/
1420
+ ls templates/.workspace-templates/references/
1421
+ ```
1422
+
1423
+ - [ ] **Step 4: Run tests to verify they pass**
1424
+
1425
+ Run: `npm test -- tests/install.test.ts`
1426
+ Expected: All install tests pass (including new sub-skill tests)
1427
+
1428
+ - [ ] **Step 5: Commit**
1429
+
1430
+ ```bash
1431
+ git add src/install.ts tests/install.test.ts
1432
+ git commit -m "feat: verify installer copies sub-skills and references"
1433
+ ```
1434
+
1435
+ ---
1436
+
1437
+ ### Task 12: Copy Dispatch Script to Templates
1438
+
1439
+ **Files:**
1440
+ - Create: `templates/.workspace-templates/scripts/dispatch.ts`
1441
+ - Test: `tests/templates-enhanced.test.ts` (add dispatch script test)
1442
+
1443
+ - [ ] **Step 1: Write test for dispatch script in templates**
1444
+
1445
+ ```typescript
1446
+ // Add to tests/templates-enhanced.test.ts
1447
+ describe('Dispatch Script', () => {
1448
+ it('exists in templates scripts directory', () => {
1449
+ const filePath = path.join(templatesDir, 'scripts', 'dispatch.ts');
1450
+ expect(fs.existsSync(filePath)).toBe(true);
1451
+ const content = fs.readFileSync(filePath, 'utf-8');
1452
+ expect(content).toContain('dispatchSkill');
1453
+ expect(content).toContain('DispatchReport');
1454
+ });
1455
+ });
1456
+ ```
1457
+
1458
+ - [ ] **Step 2: Run test to verify it fails**
1459
+
1460
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "Dispatch Script"`
1461
+ Expected: FAIL
1462
+
1463
+ - [ ] **Step 3: Copy dispatch.ts to templates**
1464
+
1465
+ ```bash
1466
+ cp src/scripts/dispatch.ts templates/.workspace-templates/scripts/dispatch.ts
1467
+ ```
1468
+
1469
+ - [ ] **Step 4: Run tests to verify they pass**
1470
+
1471
+ Run: `npm test -- tests/templates-enhanced.test.ts -t "Dispatch Script"`
1472
+ Expected: All dispatch script tests pass
1473
+
1474
+ - [ ] **Step 5: Commit**
1475
+
1476
+ ```bash
1477
+ git add templates/.workspace-templates/scripts/dispatch.ts tests/templates-enhanced.test.ts
1478
+ git commit -m "feat: add dispatch script to templates"
1479
+ ```
1480
+
1481
+ ---
1482
+
1483
+ ### Task 13: Full Test Suite & Final Verification
1484
+
1485
+ - [ ] **Step 1: Run full test suite**
1486
+
1487
+ Run: `npm test`
1488
+ Expected: All tests pass (95 baseline + all new tests from Tasks 1-12)
1489
+
1490
+ - [ ] **Step 2: Run build**
1491
+
1492
+ Run: `npm run build`
1493
+ Expected: Build succeeds
1494
+
1495
+ - [ ] **Step 3: Verify all sub-skills have required sections**
1496
+
1497
+ Run: `npm test -- tests/templates-enhanced.test.ts`
1498
+ Expected: All sub-skill structure tests pass
1499
+
1500
+ - [ ] **Step 4: Final commit**
1501
+
1502
+ ```bash
1503
+ git add .
1504
+ git commit -m "feat(sub-project-5): complete autonomous workflow & sub-skill framework"
1505
+ ```