speccrew 0.1.9 → 0.1.11

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.
@@ -74,6 +74,16 @@ Generate the following documents in `{output_path}/`:
74
74
 
75
75
  ## Workflow
76
76
 
77
+ ### Absolute Constraints
78
+
79
+ > **These rules apply to ALL document generation steps. Violation = task failure.**
80
+
81
+ 1. **FORBIDDEN: `create_file` for analysis documents** — NEVER use `create_file` to write any UI analysis document. Each document MUST be created by copying the appropriate template then filling sections with `search_replace`. `create_file` produces truncated output on large files.
82
+
83
+ 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
84
+
85
+ 3. **MANDATORY: Template-first workflow** — For every output document, the corresponding template MUST be copied to the target path first, then sections filled with `search_replace`. Skipping copy and writing content directly is FORBIDDEN.
86
+
77
87
  ### Step 0: Read All Templates
78
88
 
79
89
  Before analysis, read all template files to understand document structures and required content:
@@ -187,6 +197,16 @@ For each identified page type, extract according to `PAGE-TYPE-INDIVIDUAL-TEMPLA
187
197
 
188
198
  **Generate**: `page-types/[type]-pages.md` for each discovered type
189
199
 
200
+ #### Document Generation (per document)
201
+
202
+ **For `page-types/page-type-summary.md`:**
203
+ 1. Copy template `templates/PAGE-TYPE-SUMMARY-TEMPLATE.md` → `{output_path}/page-types/page-type-summary.md`
204
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
205
+
206
+ **For each `page-types/[type]-pages.md`:**
207
+ 1. Copy template `templates/PAGE-TYPE-INDIVIDUAL-TEMPLATE.md` → `{output_path}/page-types/[type]-pages.md`
208
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
209
+
190
210
  ### Step 3: Extract Component Usage
191
211
 
192
212
  **Purpose**: Generate component documentation in `components/` directory
@@ -243,6 +263,20 @@ Analyze component imports and usage:
243
263
  - Props and event definitions
244
264
  - Business logic integration patterns
245
265
 
266
+ #### Document Generation (per document)
267
+
268
+ **For `components/component-library.md`:**
269
+ 1. Copy template `templates/COMPONENT-LIBRARY-TEMPLATE.md` → `{output_path}/components/component-library.md`
270
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
271
+
272
+ **For `components/common-components.md`:**
273
+ 1. Copy template `templates/COMMON-COMPONENTS-TEMPLATE.md` → `{output_path}/components/common-components.md`
274
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
275
+
276
+ **For `components/business-components.md`:**
277
+ 1. Copy template `templates/BUSINESS-COMPONENTS-TEMPLATE.md` → `{output_path}/components/business-components.md`
278
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
279
+
246
280
  #### Generate Individual Component Documents
247
281
 
248
282
  For each component discovered during analysis:
@@ -328,6 +362,16 @@ Identify common layout patterns:
328
362
  - Route configuration conventions
329
363
  - Navigation state management
330
364
 
365
+ #### Document Generation (per document)
366
+
367
+ **For `layouts/page-layouts.md`:**
368
+ 1. Copy template `templates/LAYOUT-PATTERNS-TEMPLATE.md` → `{output_path}/layouts/page-layouts.md`
369
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
370
+
371
+ **For `layouts/navigation-patterns.md`:**
372
+ 1. Copy template `templates/NAVIGATION-PATTERNS-TEMPLATE.md` → `{output_path}/layouts/navigation-patterns.md`
373
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
374
+
331
375
  #### Generate Individual Layout Documents
332
376
 
333
377
  For each distinct layout pattern discovered:
@@ -403,6 +447,20 @@ Analyze style files to extract:
403
447
  - Container and breakpoint definitions
404
448
  - Spacing application guidelines
405
449
 
450
+ #### Document Generation (per document)
451
+
452
+ **For `styles/color-system.md`:**
453
+ 1. Copy template `templates/STYLE-SYSTEM-TEMPLATE.md` → `{output_path}/styles/color-system.md`
454
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
455
+
456
+ **For `styles/typography.md`:**
457
+ 1. Copy template `templates/TYPOGRAPHY-TEMPLATE.md` → `{output_path}/styles/typography.md`
458
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
459
+
460
+ **For `styles/spacing-system.md`:**
461
+ 1. Copy template `templates/SPACING-TEMPLATE.md` → `{output_path}/styles/spacing-system.md`
462
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
463
+
406
464
  ### Step 6: Generate Documentation
407
465
 
408
466
  **Purpose**: Create all documentation files using extracted data and templates
@@ -411,11 +469,18 @@ Analyze style files to extract:
411
469
 
412
470
  For each document, follow this process:
413
471
 
414
- 1. **Read the corresponding template** from `templates/` directory
472
+ 1. **Copy the corresponding template** from `templates/` directory to target path
415
473
  2. **Review extracted data** from Steps 1-5
416
- 3. **Map data to template sections** - ensure all template placeholders are filled
417
- 4. **Generate document** with actual values
418
- 5. **Write output** to `{output_path}/`
474
+ 3. **Fill template sections** using `search_replace` - map data to template placeholders
475
+ 4. **Verify** all template placeholders are filled
476
+
477
+ **Note**: NEVER use `create_file` to generate documents. Always copy template first, then use `search_replace` to fill sections.
478
+
479
+ #### Document Generation (per document)
480
+
481
+ **For `ui-style-guide.md`:**
482
+ 1. Copy template `templates/UI-STYLE-GUIDE-TEMPLATE.md` → `{output_path}/ui-style-guide.md`
483
+ 2. Fill each section using `search_replace` (FORBIDDEN: `create_file` rewrite)
419
484
 
420
485
  #### Document Generation Order and Dependencies
421
486
 
@@ -13,6 +13,16 @@ tools: Read, Write, Glob, Grep
13
13
 
14
14
  # Workflow
15
15
 
16
+ ## Absolute Constraints
17
+
18
+ > **These rules apply to ALL document generation steps. Violation = task failure.**
19
+
20
+ 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write PRD or modeling documents. Documents MUST be created by copying the template then filling sections with `search_replace`.
21
+
22
+ 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
23
+
24
+ 3. **MANDATORY: Template-first workflow** — Copy template MUST execute before filling sections. Skipping copy and writing content directly is FORBIDDEN.
25
+
16
26
  ## Step 1: Requirements Clarification (Progressive Multi-Round)
17
27
 
18
28
  Use progressive questioning to clarify requirements. Do NOT ask all questions at once.
@@ -195,7 +205,16 @@ Ask: "Here are the core functions (Must have) and deferred functions. Is the MVP
195
205
  - No `direction` keyword
196
206
  - No `style` definitions
197
207
  - No special characters in node text
198
- - Save modeling document to: `iterations/{number}/01.product-requirement/{feature-name}-bizs-modeling.md`
208
+ - **Write modeling document using template-fill workflow:**
209
+
210
+ **5.7a Copy Template to Document Path:**
211
+ 1. Read `templates/BIZS-MODELING-TEMPLATE.md`
212
+ 2. Replace top-level placeholders (feature name, domain name, etc.)
213
+ 3. Create document using `create_file` at: `iterations/{number}-{type}-{name}/01.product-requirement/{feature-name}-bizs-modeling.md`
214
+
215
+ **5.7b Fill Each Section Using search_replace:**
216
+ Fill each modeling stage section with results from Stages 1-6 above, using `search_replace` per section.
217
+ > ⚠️ FORBIDDEN: `create_file` to rewrite entire document. MUST use `search_replace` per section.
199
218
 
200
219
  **ISA-95 Quick Reference:**
201
220
 
@@ -369,7 +388,29 @@ speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/
369
388
 
370
389
  If the iteration directory does not exist, refer to the `000-sample` directory structure to create it.
371
390
 
372
- ## Step 12: Write File and Request Confirmation
391
+ ## Step 12: Write Files Using Template-Fill Workflow
392
+
393
+ ### 12a Copy Template to Document Path
394
+
395
+ For each document to write (PRD, and optionally Sub-PRDs):
396
+
397
+ 1. **Read the template**: `templates/PRD-TEMPLATE.md` (already loaded in Step 7)
398
+ 2. **Replace top-level placeholders** (feature name, iteration, date)
399
+ 3. **Create the document** using `create_file` at the path determined in Step 11
400
+ 4. **Verify**: Document has complete section structure
401
+
402
+ ### 12b Fill Each Section Using search_replace
403
+
404
+ Fill each section with content prepared in Step 9, using `search_replace` per section.
405
+
406
+ > ⚠️ **CRITICAL CONSTRAINTS:**
407
+ > - **FORBIDDEN: `create_file` to rewrite the entire document**
408
+ > - **MUST use `search_replace` to fill each section individually**
409
+ > - **All section titles MUST be preserved**
410
+
411
+ For Master-Sub structure, repeat 12a + 12b for each Sub-PRD document.
412
+
413
+ ### 12c Request Confirmation
373
414
 
374
415
  After writing files, show summary and request user confirmation:
375
416
 
@@ -31,6 +31,16 @@ tools: Read, Glob, Grep, List, ReadFile, Search
31
31
  - **Template**: [templates/DIAGNOSIS-REPORT-TEMPLATE.md](templates/DIAGNOSIS-REPORT-TEMPLATE.md)
32
32
  - **Naming Convention**: Date-time suffix using 24-hour format `HHmm` (e.g., `diagnosis-report-2026-03-15-1326.md` for 13:26), supports multiple diagnoses on the same day
33
33
 
34
+ ## Absolute Constraints
35
+
36
+ > **These rules apply to ALL document generation steps. Violation = task failure.**
37
+
38
+ 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write the diagnosis report. It MUST be created by copying the template then filling sections with `search_replace`.
39
+
40
+ 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
41
+
42
+ 3. **MANDATORY: Template-first workflow** — Copy template MUST execute before filling sections. Skipping copy and writing content directly is FORBIDDEN.
43
+
34
44
  ## Get Current Timestamp
35
45
 
36
46
  To ensure consistent timestamp format, use the `speccrew-get-timestamp` skill:
@@ -141,9 +151,24 @@ diagnosis-report-{timestamp}.md
141
151
 
142
152
  Example: If script returns `2026-03-17-1326`, filename is `diagnosis-report-2026-03-17-1326.md`
143
153
 
144
- ### 4.3 Fill Report Content
154
+ ### 4.3 Copy Template to Report Path
155
+
156
+ 1. **Read the template**: `templates/DIAGNOSIS-REPORT-TEMPLATE.md`
157
+ 2. **Replace top-level placeholders** (project name, timestamp from 4.2, etc.)
158
+ 3. **Create the document** using `create_file`:
159
+ - Target path: `speccrew-workspace/docs/diagnosis-reports/diagnosis-report-{timestamp}.md`
160
+ - Content: Template with top-level placeholders replaced
161
+ 4. **Verify**: Document has complete section structure ready for filling
162
+
163
+ ### 4.4 Fill Each Section Using search_replace
164
+
165
+ Fill each section with diagnosis data using `search_replace`.
145
166
 
146
- Based on template `templates/DIAGNOSIS-REPORT-TEMPLATE.md`, generate the diagnosis report.
167
+ > ⚠️ **CRITICAL CONSTRAINTS:**
168
+ > - **FORBIDDEN: `create_file` to rewrite the entire document**
169
+ > - **MUST use `search_replace` to fill each section individually**
170
+ > - **All section titles MUST be preserved**
171
+ > - If a section has no applicable data, keep title and fill with "To be confirmed"
147
172
 
148
173
  **Dynamic Content Filling Rules**:
149
174
 
@@ -12,6 +12,16 @@ tools: Read, Write, Glob, Grep
12
12
 
13
13
  # Workflow
14
14
 
15
+ ## Absolute Constraints
16
+
17
+ > **These rules apply to ALL steps. Violation = task failure.**
18
+
19
+ 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write design documents or INDEX. Documents MUST be created by copying the template (Step 4.2a / Step 5.2a) then filling sections with `search_replace` (Step 4.2b / Step 5.2b). `create_file` produces truncated output on large files.
20
+
21
+ 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
22
+
23
+ 3. **MANDATORY: Template-first workflow** — Copy template MUST execute before fill sections. Skipping copy and writing content directly is FORBIDDEN.
24
+
15
25
  ## Step 1: Read Inputs
16
26
 
17
27
  Read in order:
@@ -75,9 +85,25 @@ For each function (or logical group = one controller/module):
75
85
 
76
86
  Read the SD-BACKEND-TEMPLATE.md to understand document structure.
77
87
 
78
- ### 4.2 Fill Template Sections
88
+ ### 4.2a Copy Template to Document Path
89
+
90
+ 1. **Read the design template**: `templates/SD-BACKEND-TEMPLATE.md`
91
+ 2. **Replace top-level placeholders** with known variables:
92
+ - Module name, feature name, platform ID, etc.
93
+ 3. **Create the document file** using `create_file`:
94
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
95
+ - Content: Template with top-level placeholders replaced
96
+ 4. **Verify**: Document should have complete section structure ready for filling
79
97
 
80
- Fill each section with technology-specific implementation details:
98
+ ### 4.2b Fill Each Section Using search_replace
99
+
100
+ Fill each section with technology-specific implementation details.
101
+
102
+ > ⚠️ **CRITICAL CONSTRAINTS:**
103
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
104
+ > - **MUST use `search_replace` to fill each section individually**
105
+ > - **All section titles and numbering MUST be preserved**
106
+ > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
81
107
 
82
108
  | Section | Content Source |
83
109
  |---------|----------------|
@@ -93,9 +119,12 @@ Fill each section with technology-specific implementation details:
93
119
  - NestJS: `@Controller`, `@Post`, `@Body`, `@UseGuards`, etc.
94
120
  - Go: `gin.Context`, `echo.Context`, GORM annotations, etc.
95
121
 
96
- ### 4.3 Write Output
122
+ ### 4.3 Verify Output
97
123
 
98
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
124
+ Verify the completed design document:
125
+ - All sections filled with actual content (no remaining placeholders)
126
+ - Mermaid diagrams render correctly
127
+ - Pseudo-code uses actual framework syntax from techs knowledge
99
128
 
100
129
  ## Step 5: Generate Platform INDEX.md
101
130
 
@@ -105,7 +134,20 @@ After all module designs are complete:
105
134
 
106
135
  Read INDEX-TEMPLATE.md to understand platform-level document structure.
107
136
 
108
- ### 5.2 Fill Index Sections
137
+ ### 5.2a Copy Index Template to Document Path
138
+
139
+ 1. **Read the index template**: `templates/INDEX-TEMPLATE.md`
140
+ 2. **Replace top-level placeholders** (platform name, feature name, etc.)
141
+ 3. **Create the document file** using `create_file`:
142
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
143
+ - Content: Template with top-level placeholders replaced
144
+
145
+ ### 5.2b Fill Index Sections Using search_replace
146
+
147
+ > ⚠️ **CRITICAL CONSTRAINTS:**
148
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
149
+ > - **MUST use `search_replace` to fill each section individually**
150
+ > - **All section titles and numbering MUST be preserved**
109
151
 
110
152
  | Section | Content |
111
153
  |---------|---------|
@@ -115,9 +157,12 @@ Read INDEX-TEMPLATE.md to understand platform-level document structure.
115
157
  | **Cross-Module Interaction Notes** | Shared services, event-driven patterns, dependencies |
116
158
  | **Database Schema Overview** | New tables, modified tables, entity relationships |
117
159
 
118
- ### 5.3 Write Output
160
+ ### 5.3 Verify Output
119
161
 
120
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
162
+ Verify the completed INDEX.md:
163
+ - All sections filled with actual content (no remaining placeholders)
164
+ - All module design documents are correctly linked
165
+ - Database schema overview is complete
121
166
 
122
167
  ## Step 6: Present Summary
123
168
 
@@ -12,6 +12,16 @@ tools: Read, Write, Glob, Grep
12
12
 
13
13
  # Workflow
14
14
 
15
+ ## Absolute Constraints
16
+
17
+ > **These rules apply to ALL steps. Violation = task failure.**
18
+
19
+ 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write design documents or INDEX. Documents MUST be created by copying the template (Step 4.2a / Step 5.2a) then filling sections with `search_replace` (Step 4.2b / Step 5.2b). `create_file` produces truncated output on large files.
20
+
21
+ 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
22
+
23
+ 3. **MANDATORY: Template-first workflow** — Copy template MUST execute before fill sections. Skipping copy and writing content directly is FORBIDDEN.
24
+
15
25
  ## Step 1: Read Inputs
16
26
 
17
27
  Read in order:
@@ -75,9 +85,25 @@ For each function (or logical group of closely related functions = one module):
75
85
 
76
86
  Read `SD-DESKTOP-TEMPLATE.md` for document structure.
77
87
 
78
- ### 4.2 Fill Technology-Specific Details
88
+ ### 4.2a Copy Template to Document Path
89
+
90
+ 1. **Read the design template**: `templates/SD-DESKTOP-TEMPLATE.md`
91
+ 2. **Replace top-level placeholders** with known variables:
92
+ - Module name, feature name, platform ID, etc.
93
+ 3. **Create the document file** using `create_file`:
94
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
95
+ - Content: Template with top-level placeholders replaced
96
+ 4. **Verify**: Document should have complete section structure ready for filling
97
+
98
+ ### 4.2b Fill Each Section Using search_replace
99
+
100
+ Fill each section with technology-specific implementation details.
79
101
 
80
- Fill each section with technology-specific implementation details:
102
+ > ⚠️ **CRITICAL CONSTRAINTS:**
103
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
104
+ > - **MUST use `search_replace` to fill each section individually**
105
+ > - **All section titles and numbering MUST be preserved**
106
+ > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
81
107
 
82
108
  | Section | Technology-Specific Content |
83
109
  |---------|----------------------------|
@@ -90,10 +116,6 @@ Fill each section with technology-specific implementation details:
90
116
  | Auto-update | electron-updater or tauri-updater patterns |
91
117
  | Pseudo-code | MUST use actual framework syntax from techs knowledge |
92
118
 
93
- ### 4.3 Write Module Design
94
-
95
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
96
-
97
119
  **Key Rules for Pseudo-code**:
98
120
  - MUST use actual framework API syntax from techs knowledge
99
121
  - NOT generic pseudo-code
@@ -102,6 +124,13 @@ Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design
102
124
  - For Electron: use `ipcMain.handle`, `ipcRenderer.invoke`, `BrowserWindow`
103
125
  - For Tauri: use `#[tauri::command]`, `invoke()`, `Window`
104
126
 
127
+ ### 4.3 Verify Output
128
+
129
+ Verify the completed design document:
130
+ - All sections filled with actual content (no remaining placeholders)
131
+ - Mermaid diagrams render correctly
132
+ - Pseudo-code uses actual framework syntax from techs knowledge
133
+
105
134
  ## Step 5: Generate Platform INDEX.md
106
135
 
107
136
  After all module designs are complete:
@@ -110,7 +139,20 @@ After all module designs are complete:
110
139
 
111
140
  Read `INDEX-TEMPLATE.md` for document structure.
112
141
 
113
- ### 5.2 Fill Platform-Level Summary
142
+ ### 5.2a Copy Index Template to Document Path
143
+
144
+ 1. **Read the index template**: `templates/INDEX-TEMPLATE.md`
145
+ 2. **Replace top-level placeholders** (platform name, feature name, etc.)
146
+ 3. **Create the document file** using `create_file`:
147
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
148
+ - Content: Template with top-level placeholders replaced
149
+
150
+ ### 5.2b Fill Index Sections Using search_replace
151
+
152
+ > ⚠️ **CRITICAL CONSTRAINTS:**
153
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
154
+ > - **MUST use `search_replace` to fill each section individually**
155
+ > - **All section titles and numbering MUST be preserved**
114
156
 
115
157
  | Section | Content Source |
116
158
  |---------|---------------|
@@ -127,9 +169,12 @@ Read `INDEX-TEMPLATE.md` for document structure.
127
169
 
128
170
  Create table with links to each module design document.
129
171
 
130
- ### 5.4 Write INDEX
172
+ ### 5.4 Verify Output
131
173
 
132
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
174
+ Verify the completed INDEX.md:
175
+ - All sections filled with actual content (no remaining placeholders)
176
+ - All module design documents are correctly linked
177
+ - Platform-level summary is complete
133
178
 
134
179
  ## Step 6: Present Summary
135
180
 
@@ -12,6 +12,16 @@ tools: Read, Write, Glob, Grep
12
12
 
13
13
  # Workflow
14
14
 
15
+ ## Absolute Constraints
16
+
17
+ > **These rules apply to ALL steps. Violation = task failure.**
18
+
19
+ 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write design documents or INDEX. Documents MUST be created by copying the template (Step 4.2a / Step 5.2a) then filling sections with `search_replace` (Step 4.2b / Step 5.2b). `create_file` produces truncated output on large files.
20
+
21
+ 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
22
+
23
+ 3. **MANDATORY: Template-first workflow** — Copy template MUST execute before fill sections. Skipping copy and writing content directly is FORBIDDEN.
24
+
15
25
  ## Step 1: Read Inputs
16
26
 
17
27
  Read in order:
@@ -73,9 +83,25 @@ For each function (or logical group of closely related functions = one module):
73
83
 
74
84
  Read `SD-FRONTEND-TEMPLATE.md` for document structure.
75
85
 
76
- ### 4.2 Fill Technology-Specific Details
86
+ ### 4.2a Copy Template to Document Path
87
+
88
+ 1. **Read the design template**: `templates/SD-FRONTEND-TEMPLATE.md`
89
+ 2. **Replace top-level placeholders** with known variables:
90
+ - Module name, feature name, platform ID, etc.
91
+ 3. **Create the document file** using `create_file`:
92
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
93
+ - Content: Template with top-level placeholders replaced
94
+ 4. **Verify**: Document should have complete section structure ready for filling
95
+
96
+ ### 4.2b Fill Each Section Using search_replace
97
+
98
+ Fill each section with technology-specific implementation details.
77
99
 
78
- Fill each section with technology-specific implementation details:
100
+ > ⚠️ **CRITICAL CONSTRAINTS:**
101
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
102
+ > - **MUST use `search_replace` to fill each section individually**
103
+ > - **All section titles and numbering MUST be preserved**
104
+ > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
79
105
 
80
106
  | Section | Technology-Specific Content |
81
107
  |---------|----------------------------|
@@ -86,16 +112,19 @@ Fill each section with technology-specific implementation details:
86
112
  | Routing | Actual router config format |
87
113
  | Pseudo-code | MUST use actual framework syntax from techs knowledge |
88
114
 
89
- ### 4.3 Write Module Design
90
-
91
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
92
-
93
115
  **Key Rules for Pseudo-code**:
94
116
  - MUST use actual framework API syntax from techs knowledge
95
117
  - NOT generic pseudo-code
96
118
  - Include actual import statements
97
119
  - Use actual store/API patterns from conventions
98
120
 
121
+ ### 4.3 Verify Output
122
+
123
+ Verify the completed design document:
124
+ - All sections filled with actual content (no remaining placeholders)
125
+ - Mermaid diagrams render correctly
126
+ - Pseudo-code uses actual framework syntax from techs knowledge
127
+
99
128
  ## Step 5: Generate Platform INDEX.md
100
129
 
101
130
  After all module designs are complete:
@@ -104,7 +133,20 @@ After all module designs are complete:
104
133
 
105
134
  Read `INDEX-TEMPLATE.md` for document structure.
106
135
 
107
- ### 5.2 Fill Platform-Level Summary
136
+ ### 5.2a Copy Index Template to Document Path
137
+
138
+ 1. **Read the index template**: `templates/INDEX-TEMPLATE.md`
139
+ 2. **Replace top-level placeholders** (platform name, feature name, etc.)
140
+ 3. **Create the document file** using `create_file`:
141
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
142
+ - Content: Template with top-level placeholders replaced
143
+
144
+ ### 5.2b Fill Index Sections Using search_replace
145
+
146
+ > ⚠️ **CRITICAL CONSTRAINTS:**
147
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
148
+ > - **MUST use `search_replace` to fill each section individually**
149
+ > - **All section titles and numbering MUST be preserved**
108
150
 
109
151
  | Section | Content Source |
110
152
  |---------|---------------|
@@ -119,9 +161,12 @@ Read `INDEX-TEMPLATE.md` for document structure.
119
161
 
120
162
  Create table with links to each module design document.
121
163
 
122
- ### 5.4 Write INDEX
164
+ ### 5.4 Verify Output
123
165
 
124
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
166
+ Verify the completed INDEX.md:
167
+ - All sections filled with actual content (no remaining placeholders)
168
+ - All module design documents are correctly linked
169
+ - Platform-level summary is complete
125
170
 
126
171
  ## Step 6: Present Summary
127
172
 
@@ -12,6 +12,16 @@ tools: Read, Write, Glob, Grep
12
12
 
13
13
  # Workflow
14
14
 
15
+ ## Absolute Constraints
16
+
17
+ > **These rules apply to ALL steps. Violation = task failure.**
18
+
19
+ 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write design documents or INDEX. Documents MUST be created by copying the template (Step 4.2a / Step 5.2a) then filling sections with `search_replace` (Step 4.2b / Step 5.2b). `create_file` produces truncated output on large files.
20
+
21
+ 2. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
22
+
23
+ 3. **MANDATORY: Template-first workflow** — Copy template MUST execute before fill sections. Skipping copy and writing content directly is FORBIDDEN.
24
+
15
25
  ## Step 1: Read Inputs
16
26
 
17
27
  Read in order:
@@ -74,9 +84,25 @@ For each function (or logical group of closely related functions = one module):
74
84
 
75
85
  Read `SD-MOBILE-TEMPLATE.md` for document structure.
76
86
 
77
- ### 4.2 Fill Technology-Specific Details
87
+ ### 4.2a Copy Template to Document Path
88
+
89
+ 1. **Read the design template**: `templates/SD-MOBILE-TEMPLATE.md`
90
+ 2. **Replace top-level placeholders** with known variables:
91
+ - Module name, feature name, platform ID, etc.
92
+ 3. **Create the document file** using `create_file`:
93
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
94
+ - Content: Template with top-level placeholders replaced
95
+ 4. **Verify**: Document should have complete section structure ready for filling
96
+
97
+ ### 4.2b Fill Each Section Using search_replace
98
+
99
+ Fill each section with technology-specific implementation details.
78
100
 
79
- Fill each section with technology-specific implementation details:
101
+ > ⚠️ **CRITICAL CONSTRAINTS:**
102
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
103
+ > - **MUST use `search_replace` to fill each section individually**
104
+ > - **All section titles and numbering MUST be preserved**
105
+ > - If a section has no applicable content, keep the section title and replace placeholder with "N/A"
80
106
 
81
107
  | Section | Technology-Specific Content |
82
108
  |---------|----------------------------|
@@ -89,16 +115,19 @@ Fill each section with technology-specific implementation details:
89
115
  | Platform features | Actual plugin APIs (camera, geolocator, local_notifications, etc.) |
90
116
  | Pseudo-code | MUST use actual framework syntax from techs knowledge |
91
117
 
92
- ### 4.3 Write Module Design
93
-
94
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
95
-
96
118
  **Key Rules for Pseudo-code**:
97
119
  - MUST use actual framework API syntax from techs knowledge
98
120
  - NOT generic pseudo-code
99
121
  - Include actual import statements
100
122
  - Use actual state management/API patterns from conventions
101
123
 
124
+ ### 4.3 Verify Output
125
+
126
+ Verify the completed design document:
127
+ - All sections filled with actual content (no remaining placeholders)
128
+ - Mermaid diagrams render correctly
129
+ - Pseudo-code uses actual framework syntax from techs knowledge
130
+
102
131
  ## Step 5: Generate Platform INDEX.md
103
132
 
104
133
  After all module designs are complete:
@@ -107,7 +136,20 @@ After all module designs are complete:
107
136
 
108
137
  Read `INDEX-TEMPLATE.md` for document structure.
109
138
 
110
- ### 5.2 Fill Platform-Level Summary
139
+ ### 5.2a Copy Index Template to Document Path
140
+
141
+ 1. **Read the index template**: `templates/INDEX-TEMPLATE.md`
142
+ 2. **Replace top-level placeholders** (platform name, feature name, etc.)
143
+ 3. **Create the document file** using `create_file`:
144
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
145
+ - Content: Template with top-level placeholders replaced
146
+
147
+ ### 5.2b Fill Index Sections Using search_replace
148
+
149
+ > ⚠️ **CRITICAL CONSTRAINTS:**
150
+ > - **FORBIDDEN: `create_file` to rewrite the entire document** — it destroys template structure
151
+ > - **MUST use `search_replace` to fill each section individually**
152
+ > - **All section titles and numbering MUST be preserved**
111
153
 
112
154
  | Section | Content Source |
113
155
  |---------|---------------|
@@ -124,9 +166,12 @@ Read `INDEX-TEMPLATE.md` for document structure.
124
166
 
125
167
  Create table with links to each module design document.
126
168
 
127
- ### 5.4 Write INDEX
169
+ ### 5.4 Verify Output
128
170
 
129
- Write to: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/INDEX.md`
171
+ Verify the completed INDEX.md:
172
+ - All sections filled with actual content (no remaining placeholders)
173
+ - All module design documents are correctly linked
174
+ - Platform-level summary is complete
130
175
 
131
176
  ## Step 6: Present Summary
132
177