speccrew 0.1.9 → 0.1.10

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.
@@ -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
 
@@ -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 document generation steps. Violation = task failure.**
18
+
19
+ 1. **FORBIDDEN: `create_file` for documents** — NEVER use `create_file` to write the test case design document. It MUST be created by copying the template then filling sections with `search_replace`.
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 filling sections. Skipping copy and writing content directly is FORBIDDEN.
24
+
15
25
  ## Step 1: Read Feature Spec
16
26
 
17
27
  Read the feature spec document specified by `feature_spec_path`:
@@ -243,21 +253,31 @@ Read the template file:
243
253
  speccrew-test-case-design/templates/TEST-CASE-DESIGN-TEMPLATE.md
244
254
  ```
245
255
 
246
- ### 7.3 Fill Template
256
+ ### 7.3 Copy Template to Document Path
257
+
258
+ 1. **Read the template file**: `templates/TEST-CASE-DESIGN-TEMPLATE.md` (loaded in 7.2)
259
+ 2. **Replace top-level placeholders** (feature name, module, date, etc.)
260
+ 3. **Create the document** using `create_file` at the path from Step 7.1
261
+ 4. **Verify**: Document has complete section structure ready for filling
262
+
263
+ ### 7.4 Fill Each Section Using search_replace
247
264
 
248
- Fill in the template with:
265
+ Fill each section with test case data using `search_replace`.
249
266
 
250
- | Section | Content |
251
- |---------|---------|
252
- | Test Overview | Feature name, module, scope, related documents |
253
- | Test Case Matrix | All test cases organized by category |
254
- | Test Data Definition | Normal, boundary, and exception data sets |
255
- | Coverage Traceability | Requirement-to-test-case mapping |
256
- | Notes | Additional information and assumptions |
267
+ > ⚠️ **CRITICAL CONSTRAINTS:**
268
+ > - **FORBIDDEN: `create_file` to rewrite the entire document**
269
+ > - **MUST use `search_replace` to fill each section individually**
270
+ > - **All section titles MUST be preserved**
257
271
 
258
- ### 7.4 Write Document
272
+ **Section Filling Order:**
259
273
 
260
- Write the completed test case design document to the output path.
274
+ | Section | Content Source |
275
+ |---------|---------------|
276
+ | **Test Overview** | Feature name, module, scope, related documents |
277
+ | **Test Case Matrix** | All test cases organized by category from Step 5 |
278
+ | **Test Data Definition** | Normal, boundary, and exception data sets |
279
+ | **Coverage Traceability** | Requirement-to-test-case mapping from Step 6 |
280
+ | **Notes** | Additional information and assumptions |
261
281
 
262
282
  # Key Rules
263
283
 
@@ -12,6 +12,18 @@ tools: Read, Write, Glob, Grep
12
12
 
13
13
  # Workflow
14
14
 
15
+ ## Absolute Constraints
16
+
17
+ > **These rules apply to document generation steps (Step 7). Violation = task failure.**
18
+
19
+ 1. **FORBIDDEN: `create_file` for plan document** — NEVER use `create_file` to write the test code plan document. It MUST be created by copying the template then filling sections with `search_replace`.
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 filling sections.
24
+
25
+ 4. **CLARIFICATION: Test source code is NOT template-filled** — Actual test code files in Step 6 are written directly. The template-fill workflow applies ONLY to the Code Plan document in Step 7.
26
+
15
27
  ## Step 1: Read Test Cases
16
28
 
17
29
  Read the confirmed test case document specified by `test_cases_path`:
@@ -273,7 +285,32 @@ Generate files in dependency order:
273
285
 
274
286
  Output the code plan document for traceability:
275
287
 
276
- **Path**: `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/code/{platform_id}/[feature]-test-code-plan.md`
288
+ ### 7.1 Copy Template to Document Path
289
+
290
+ 1. **Read the template**: `templates/TEST-CODE-PLAN-TEMPLATE.md`
291
+ 2. **Replace top-level placeholders** (feature name, platform, date, etc.)
292
+ 3. **Create the document** using `create_file`:
293
+ - Target path: `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/code/{platform_id}/[feature]-test-code-plan.md`
294
+ - Content: Template with top-level placeholders replaced
295
+ 4. **Verify**: Document has complete section structure
296
+
297
+ ### 7.2 Fill Each Section Using search_replace
298
+
299
+ Fill each section with code plan data from Step 4.
300
+
301
+ > ⚠️ **CRITICAL CONSTRAINTS:**
302
+ > - **FORBIDDEN: `create_file` to rewrite the entire document**
303
+ > - **MUST use `search_replace` to fill each section individually**
304
+ > - **All section titles MUST be preserved**
305
+
306
+ **Section Filling Guide:**
307
+
308
+ | Section | Content Source |
309
+ |---------|---------------|
310
+ | **File-to-TestCase Mapping** | From Step 4.4 |
311
+ | **Mock Strategy** | From Step 4.3 |
312
+ | **Shared Resources** | From Step 4.2 |
313
+ | **Test File Structure** | From Step 4.1 |
277
314
 
278
315
  ### Document Purpose
279
316
 
@@ -282,10 +319,6 @@ Output the code plan document for traceability:
282
319
  - Provides reference for future test maintenance
283
320
  - Enables traceability from test code to test cases
284
321
 
285
- ### Template Reference
286
-
287
- Use: `speccrew-test-code-gen/templates/TEST-CODE-PLAN-TEMPLATE.md`
288
-
289
322
  # Key Rules
290
323
 
291
324
  | Rule | Description |