speccrew 0.3.0 → 0.3.2

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.
@@ -92,24 +92,218 @@ If WORKFLOW-PROGRESS.json does not exist (legacy iterations or new workspace):
92
92
 
93
93
  # Workflow
94
94
 
95
+ ## Phase 0.5: IDE Detection
96
+
97
+ Detect current IDE environment and determine skill loading strategy:
98
+
99
+ 1. **Detect IDE**: Check environment variables or context to identify current IDE (Claude Code, Cursor, Qoder, etc.)
100
+ 2. **Set skill_path**: Based on IDE detection result, set the appropriate skill search path
101
+ 3. **Proceed to Requirement Assessment**
102
+
103
+ ---
104
+
105
+ ## Phase 1: Pre-Skill Requirement Assessment
106
+
107
+ Before invoking the requirement analysis skill, assess the user input for completeness.
108
+
109
+ ### Sufficiency Check
110
+
111
+ Evaluate user input against these criteria:
112
+
113
+ | Criterion | Description | Assessment |
114
+ |-----------|-------------|------------|
115
+ | Business Problem Clarity | Is the core business problem clearly understood? | ✅/❌ |
116
+ | Target Users & Scenarios | Are target users and core use cases identified? | ✅/❌ |
117
+ | Scope Boundaries | Are inclusion/exclusion boundaries defined? | ✅/❌ |
118
+ | System Relationship | Is the relationship with existing system understood? | ✅/❌ |
119
+
120
+ ### Clarification Protocol
121
+
122
+ **IF ANY criterion NOT met**:
123
+ - Execute progressive clarification (2-3 questions per round, minimum 2 rounds)
124
+ - Questions should be specific and actionable
125
+ - Document all clarification Q&A in progress tracking
126
+ - Re-evaluate after each round
127
+
128
+ **IF ALL criteria met** (user provided complete requirement document):
129
+ - **STILL execute at least 1 confirmation round**:
130
+ 1. Confirm understanding is correct
131
+ 2. Confirm scope boundaries (what's in/out)
132
+ 3. Confirm priorities and constraints
133
+ - This ensures alignment even with comprehensive input
134
+
135
+ ### Complexity Pre-Assessment
136
+
137
+ Before invoking skill, perform rough complexity assessment:
138
+
139
+ - **Simple**: Single module, clear scope, minimal system integration
140
+ - **Moderate**: 1-2 modules, some integration required
141
+ - **Complex**: 2+ modules, significant integration, multi-stakeholder
142
+
143
+ If requirement clearly involves **2+ modules**:
144
+ - Flag this as `expected_complexity: complex`
145
+ - Inform Skill that this is a complex requirement requiring thorough analysis
146
+
147
+ ### Pre-Skill Output
148
+
149
+ After completing assessment, prepare the following to pass to Skill:
150
+
151
+ ```
152
+ clarification_status: true|false
153
+ clarification_rounds: <number>
154
+ clarification_summary: <brief summary of key clarifications>
155
+ expected_complexity: simple|moderate|complex
156
+ complexity_notes: <if complex, note affected modules>
157
+ ```
158
+
159
+ ---
160
+
161
+ ⚠️ **MANDATORY CLARIFICATION RULE**:
162
+ - **NEVER skip requirement clarification entirely**
163
+ - **Even with complete requirement documents, perform at least 1 confirmation round**
164
+ - **Document all clarification in progress tracking**
165
+ - **If user rushes to skip, explain risks and still confirm critical points**
166
+
167
+ ---
168
+
169
+ ## Phase 2: Invoke Skill
170
+
95
171
  Invoke Skill: Find `speccrew-pm-requirement-analysis/SKILL.md` in the skills directory
96
172
 
173
+ Pass the following context to the Skill:
174
+ - User's original requirement input
175
+ - Pre-skill assessment results (clarification_status, expected_complexity, etc.)
176
+ - Clarification Q&A records (if any)
177
+
178
+ ---
179
+
180
+ ## Phase 3: Sub-PRD Worker Dispatch (Master-Sub Structure Only)
181
+
182
+ **IF the Skill output includes a Sub-PRD Dispatch Plan (from Step 12c), execute this phase.**
183
+ **IF Single PRD structure, skip to Phase 4.**
184
+
185
+ After the Skill generates the Master PRD and outputs the dispatch plan, the PM Agent takes over to generate Sub-PRDs in parallel using worker agents.
186
+
187
+ ### 3.1 Read Dispatch Plan
188
+
189
+ From the Skill's Step 12c output, collect:
190
+ - `feature_name`: System-level feature name
191
+ - `template_path`: Path to PRD-TEMPLATE.md
192
+ - `master_prd_path`: Path to the generated Master PRD
193
+ - `output_dir`: Directory for Sub-PRD files (same as Master PRD directory)
194
+ - Module list with context for each module:
195
+ - `module_name`, `module_key`, `module_scope`, `module_entities`
196
+ - `module_user_stories`, `module_requirements`, `module_features`
197
+ - `module_dependencies`
198
+
199
+ ### 3.2 Dispatch Workers
200
+
201
+ Invoke `speccrew-task-worker` agents in parallel, one per module:
202
+
203
+ Each worker receives:
204
+ - `skill_path`: `speccrew-pm-sub-prd-generate/SKILL.md`
205
+ - `context`:
206
+ - `module_name`: Module name (e.g., "Customer Management")
207
+ - `module_key`: Module identifier for file naming (e.g., "customer")
208
+ - `module_scope`: What this module covers
209
+ - `module_entities`: Core business entities
210
+ - `module_user_stories`: Module-specific user stories
211
+ - `module_requirements`: Module-specific functional requirements (P0/P1/P2)
212
+ - `module_features`: Feature Breakdown entries for this module
213
+ - `module_dependencies`: Dependencies on other modules
214
+ - `master_prd_path`: Path to the Master PRD
215
+ - `feature_name`: System-level feature name
216
+ - `template_path`: Path to PRD-TEMPLATE.md
217
+ - `output_path`: `{output_dir}/{feature_name}-sub-{module_key}.md`
218
+
219
+ **Parallel execution pattern:**
220
+ ```
221
+ Worker 1: Module "customer" → crm-system-sub-customer.md
222
+ Worker 2: Module "contact" → crm-system-sub-contact.md
223
+ Worker 3: Module "opportunity" → crm-system-sub-opportunity.md
224
+ ...
225
+ Worker N: Module "{module-N}" → crm-system-sub-{module-N}.md
226
+ ```
227
+
228
+ **All workers execute simultaneously.** Wait for all workers to complete before proceeding.
229
+
230
+ ### 3.3 Collect Results
231
+
232
+ After all workers complete:
233
+
234
+ 1. **Check worker results**: Verify each worker reported success
235
+ 2. **List generated files**:
236
+ ```
237
+ 📊 Sub-PRD Generation Results:
238
+ ├── Worker 1: {module-1} → ✅ Generated ({file_size})
239
+ ├── Worker 2: {module-2} → ✅ Generated ({file_size})
240
+ ├── Worker N: {module-N} → ✅ Generated ({file_size})
241
+
242
+ Total: N workers | Completed: X | Failed: Y
243
+ ```
244
+
245
+ 3. **Handle failures**: If any worker failed:
246
+ - Report which modules failed and why
247
+ - Re-dispatch failed modules (retry once)
248
+ - If retry fails, report to user for manual intervention
249
+
250
+ ---
251
+
252
+ ## Phase 4: Verification & Confirmation
253
+
254
+ ### 4.1 Execute Verification Checklist
255
+
256
+ Return to the Skill's Step 12d for verification:
257
+ - Verify Master PRD exists and size > 2KB
258
+ - Verify all Sub-PRD files exist and each size > 3KB
259
+ - Verify Master PRD Sub-PRD Index matches actual files
260
+ - Verify each Sub-PRD contains Feature Breakdown (Section 3.4)
261
+
262
+ ### 4.2 Request User Confirmation
263
+
264
+ Execute Skill's Step 12e to present summary and request user review.
265
+
266
+ ### 4.3 Finalize PRD Stage (After User Confirmation)
267
+
268
+ After user confirms the PRD documents are correct:
269
+
270
+ 1. Execute Skill's Step 13 to write progress files (update WORKFLOW-PROGRESS.json, set `01_prd.status` = `confirmed`)
271
+ 2. Update all PRD document status lines from `📝 Draft` to `✅ Confirmed` with confirmation date using `search_replace`
272
+ 3. Output completion message:
273
+ ```
274
+ ✅ PRD documents have been confirmed. PRD stage is complete.
275
+ When you are ready to proceed with Feature Design, please start a new conversation and invoke the Feature Designer Agent.
276
+ ```
277
+ 4. **END** — Do not proceed further. Do not invoke or suggest transitioning to the next stage agent.
278
+
97
279
  # Deliverables
98
280
 
99
281
  | Deliverable | Path | Notes |
100
282
  |-------------|------|-------|
101
283
  | PRD Document | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-prd.md` | Based on template from `speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md` |
102
284
  | Business Modeling (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-bizs-modeling.md` | ISA-95 six-stage modeling, only for complex requirements |
285
+ | Sub-PRD Documents (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-sub-[module].md` | One per module, generated by worker dispatch |
103
286
 
104
287
  # Constraints
105
288
 
289
+ ⚠️ **MANDATORY CLARIFICATION RULE**:
290
+ - **NEVER skip requirement clarification entirely**
291
+ - **Even with complete requirement documents, perform at least 1 confirmation round**
292
+ - **Document all clarification in progress tracking**
293
+ - **If user rushes to skip, explain risks and still confirm critical points**
294
+
106
295
  **Must do:**
107
296
  - Read business module list to confirm boundaries between requirements and existing features
108
297
  - Use templates from `speccrew-pm-requirement-analysis/templates/`
109
- - Explicitly prompt user for confirmation after PRD completion, only transition to speccrew-planner after confirmation
298
+ - Explicitly prompt user for review and confirmation after PRD completion
299
+ - Execute Pre-Skill Requirement Assessment before invoking the Skill
300
+ - Pass clarification context and complexity assessment to the Skill
301
+ - For complex requirements (2+ modules), dispatch Sub-PRD generation to parallel workers using `speccrew-pm-sub-prd-generate/SKILL.md`
110
302
 
111
303
  **Must not do:**
112
304
  - Do not make technical solution decisions (that's speccrew-planner's responsibility)
113
305
  - Do not skip manual confirmation to directly start the next stage
114
306
  - Do not assume business rules on your own; clarify unclear requirements with the user
307
+ - Do not skip the clarification process, even when user provides detailed documents
308
+ - Do not automatically transition to or invoke the next stage agent (Feature Designer). The user will start the next stage in a new conversation window.
115
309
 
@@ -23,7 +23,17 @@ tools: Read, Write, Glob, Grep
23
23
 
24
24
  3. **MANDATORY: Template-first workflow** — Copy template MUST execute before filling sections. Skipping copy and writing content directly is FORBIDDEN.
25
25
 
26
- ## Step 1: Requirements Clarification (Progressive Multi-Round)
26
+ ## Step 1: Requirements Clarification (MANDATORY)
27
+
28
+ ⚠️ **MANDATORY: This step CANNOT be skipped.**
29
+
30
+ ```
31
+ IF user provided a complete requirement document:
32
+ → Perform at least 1 confirmation round (verify understanding, scope, priorities)
33
+ → Generate clarification summary
34
+ IF user provided incomplete input:
35
+ → Perform full progressive clarification (Round 1 → Round 2 → optional Round 3)
36
+ ```
27
37
 
28
38
  Use progressive questioning to clarify requirements. Do NOT ask all questions at once.
29
39
 
@@ -66,7 +76,53 @@ Sufficient to proceed when ALL of:
66
76
  - [ ] Relationship to existing system is understood
67
77
 
68
78
  If ANY is unclear → ask follow-up questions targeting the gap
69
- If ALL are clear → proceed to Step 2
79
+ If ALL are clear → proceed to Step 1 Output
80
+ ```
81
+
82
+ ### Step 1 Output: Generate Clarification Summary
83
+
84
+ After Sufficiency Check passes, generate a clarification summary file:
85
+
86
+ ```
87
+ Path: speccrew-workspace/iterations/{iteration}/01.product-requirement/.clarification-summary.md
88
+ ```
89
+
90
+ **Content template:**
91
+ ```markdown
92
+ # Clarification Summary
93
+
94
+ ## Input Type
95
+ - [ ] Complete requirement document provided
96
+ - [ ] Incomplete input (progressive clarification performed)
97
+
98
+ ## Clarification Rounds
99
+ - Round 1 (Core Understanding): [Summary of Q&A]
100
+ - Round 2 (Scope & Boundaries): [Summary of Q&A]
101
+ - Round 3 (Detail & Acceptance): [If applicable, Summary of Q&A]
102
+
103
+ ## Sufficiency Check Status
104
+ - [x] Business problem is clearly understood
105
+ - [x] Target users and core scenarios identified
106
+ - [x] Scope boundaries (in/out) are defined
107
+ - [x] Relationship to existing system is understood
108
+
109
+ ## Key Decisions
110
+ - [Record any key decisions made during clarification]
111
+
112
+ ## Proceed Gate
113
+ ✅ All checks passed. Ready for Step 2.
114
+ ```
115
+
116
+ ### Proceed Gate to Step 2
117
+
118
+ **Before proceeding to Step 2, verify BOTH conditions:**
119
+
120
+ ```
121
+ □ All Sufficiency Check items marked as ✅
122
+ □ .clarification-summary.md file exists and is complete
123
+
124
+ IF both conditions met → Proceed to Step 2
125
+ IF any condition fails → STOP and complete the missing items
70
126
  ```
71
127
 
72
128
  **Principles:**
@@ -274,6 +330,16 @@ If there are gaps or unclear points, ask the user to confirm before proceeding.
274
330
 
275
331
  Before writing, determine the PRD structure based on requirement complexity:
276
332
 
333
+ ### Structure Decision (MANDATORY IF/THEN)
334
+
335
+ ```
336
+ IF modules_count >= 2 OR cross_module_dependencies exist:
337
+ → MANDATORY: Use Master-Sub Structure
338
+ → Record: sub_prd_count = len(module_list)
339
+ ELSE:
340
+ → Use Single PRD Structure
341
+ ```
342
+
277
343
  ### Simple Requirements (Single Document)
278
344
  - Single feature with clear boundaries
279
345
  - Minimal dependencies on existing modules
@@ -418,59 +484,158 @@ speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/
418
484
 
419
485
  If the iteration directory does not exist, refer to the `000-sample` directory structure to create it.
420
486
 
421
- ## Step 12: Write Files Using Template-Fill Workflow
487
+ ## Step 12: Write PRD Files
488
+
489
+ ### Step 12a: Plan File List (MANDATORY FIRST STEP)
490
+
491
+ Before writing any file, create a complete list of ALL files to generate:
492
+
493
+ **For Single PRD Structure:**
422
494
 
423
- ### 12a Copy Template to Document Path
495
+ | # | File | Path |
496
+ |---|------|------|
497
+ | 1 | PRD | {iteration}/01.prd/{feature-name}-prd.md |
424
498
 
425
- For each document to write (PRD, and optionally Sub-PRDs):
499
+ **For Master-Sub Structure (present this table to user):**
426
500
 
427
- 1. **Read the template**: `templates/PRD-TEMPLATE.md` (already loaded in Step 7)
428
- 2. **Replace top-level placeholders** (feature name, iteration, date)
429
- 3. **Create the document** using `create_file` at the path determined in Step 11
430
- 4. **Verify**: Document has complete section structure
501
+ | # | File Type | Module | Path |
502
+ |---|-----------|--------|------|
503
+ | 1 | Master PRD | (system overview) | {iteration}/01.prd/{feature-name}-prd.md |
504
+ | 2 | Sub-PRD | {module-1-name} | {iteration}/01.prd/{feature-name}-sub-{module-1-key}.md |
505
+ | 3 | Sub-PRD | {module-2-name} | {iteration}/01.prd/{feature-name}-sub-{module-2-key}.md |
506
+ | ... | ... | ... | ... |
507
+ | N+1 | Sub-PRD | {module-N-name} | {iteration}/01.prd/{feature-name}-sub-{module-N-key}.md |
431
508
 
432
- ### 12b Fill Each Section Using search_replace
509
+ Total files: 1 (Master) + N (Sub-PRDs) = N+1 files.
510
+
511
+ ⚠️ **Present this file list to user for confirmation before proceeding.**
512
+
513
+ ---
433
514
 
434
- Fill each section with content prepared in Step 9, using `search_replace` per section.
515
+ ### Step 12b: Generate Master PRD
516
+
517
+ 1. Read `templates/PRD-TEMPLATE.md` (already loaded in Step 7)
518
+ 2. Create document using `create_file` at: `{iteration}/01.prd/{feature-name}-prd.md`
519
+
520
+ 3. Fill content using `search_replace` per section:
521
+
522
+ **For Single PRD Structure** — fill ALL sections with full detail:
523
+ - Section 1 (Background & Goals): Full background, goals
524
+ - Section 2 (User Stories): All user stories with scenarios
525
+ - Section 3 (Functional Requirements): All requirements including Feature Breakdown (3.4)
526
+ - Section 4 (Non-functional Requirements): Performance, security, etc.
527
+ - Section 5 (Acceptance Criteria): All criteria
528
+ - Section 6 (Boundary Description): In/out scope
529
+ - Section 7 (Assumptions & Dependencies)
530
+
531
+ **For Master-Sub Structure** — fill ONLY system-level overview content:
532
+ - Section 1 (Background & Goals): System-wide background and goals
533
+ - Section 2 (User Stories): **HIGH-LEVEL system user stories ONLY** (e.g., "As a store manager, I want a CRM system to manage customer relationships"). DO NOT include module-specific user stories.
534
+ - Section 3 (Functional Requirements):
535
+ - 3.1 Use Case Diagram: System-level use case diagram showing all modules
536
+ - 3.2 Business Process Flow: Cross-module process flow overview
537
+ - 3.3 Feature List: Module-level feature summary table (NOT detailed features)
538
+ - 3.4 Feature Breakdown: Write "See individual Sub-PRDs for module-specific Feature Breakdown"
539
+ - 3.5 Feature Details: Write "See individual Sub-PRDs for module-specific Feature Details"
540
+ - Section 4 (Non-functional Requirements): System-wide NFRs only
541
+ - Section 5 (Acceptance Criteria): System-wide acceptance criteria only
542
+ - Section 6 (Boundary Description): System-wide scope boundaries
543
+ - Section 7 (Assumptions & Dependencies): System-wide dependencies
544
+ - **APPEND after Section 7** using `search_replace` on the PRD Status line:
545
+ - **Section 8: Module Overview** — Module list table (from Step 6.1), Cross-module dependency matrix (from Step 6.2), Implementation phases (from Step 6.3)
546
+ - **Section 9: Sub-PRD Index** — List all Sub-PRD file paths with module names
435
547
 
436
548
  > ⚠️ **CRITICAL CONSTRAINTS:**
437
549
  > - **FORBIDDEN: `create_file` to rewrite the entire document**
438
550
  > - **MUST use `search_replace` to fill each section individually**
439
- > - **All section titles MUST be preserved**
551
+ > - **For Master-Sub: DO NOT include module-specific user stories, requirements, or Feature Breakdowns in the Master PRD**
552
+
553
+ ---
554
+
555
+ ### Step 12c: Sub-PRD Dispatch Plan (MANDATORY for Master-Sub)
556
+
557
+ **IF Step 8 determined Master-Sub structure:**
558
+
559
+ ⚠️ **IMPORTANT: Sub-PRD generation is handled by the PM Agent through parallel worker dispatch.**
560
+ **DO NOT generate Sub-PRD files sequentially in this skill.**
561
+
562
+ Prepare and output the dispatch plan for the PM Agent:
440
563
 
441
- For Master-Sub structure, repeat 12a + 12b for each Sub-PRD document.
564
+ **Sub-PRD Dispatch Plan:**
442
565
 
443
- ### 12c Request Confirmation
566
+ For each module from Step 6.1, prepare worker context:
444
567
 
445
- After writing files, show summary and request user confirmation:
568
+ | # | Module | module_key | Sub-PRD Path | Feature Count |
569
+ |---|--------|-----------|--------------|---------------|
570
+ | 1 | {module-1-name} | {module-1-key} | {feature-name}-sub-{module-1-key}.md | {count} |
571
+ | 2 | {module-2-name} | {module-2-key} | {feature-name}-sub-{module-2-key}.md | {count} |
572
+ | ... | ... | ... | ... | ... |
573
+
574
+ For each module, collect and output the following context data:
575
+ - `module_name`: Module name
576
+ - `module_key`: Module identifier (for file naming)
577
+ - `module_scope`: What this module covers (from Step 6.1)
578
+ - `module_entities`: Core entities (from Step 6.1)
579
+ - `module_user_stories`: User stories specific to this module (from Steps 1-5 analysis)
580
+ - `module_requirements`: Functional requirements for this module (P0/P1/P2)
581
+ - `module_features`: Feature Breakdown entries for this module (from Step 9.1 analysis)
582
+ - `module_dependencies`: Dependencies on other modules (from Step 6.2)
583
+
584
+ After outputting the dispatch plan:
446
585
 
447
- ### Simple PRD Output
448
586
  ```
449
- PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
587
+ RETURN to PM Agent for parallel worker dispatch.
588
+ → PM Agent will invoke speccrew-task-worker for each module.
589
+ → Each worker uses speccrew-pm-sub-prd-generate/SKILL.md to generate one Sub-PRD.
450
590
  ```
451
591
 
452
- ### Complex PRD Output (with modeling)
592
+ **IF Single PRD Structure:** Skip this step (no Sub-PRDs needed).
593
+
594
+ ---
595
+
596
+ ### Step 12d: Verification Checklist (Execute after all Sub-PRDs are generated)
597
+
598
+ **After PM Agent confirms all workers have completed, verify:**
599
+
600
+ - [ ] Master PRD exists and file size > 2KB
601
+ - [ ] [Master-Sub] All {sub_prd_count} Sub-PRD files exist
602
+ - [ ] [Master-Sub] Each Sub-PRD file size > 3KB
603
+ - [ ] [Master-Sub] Master PRD Section 9 (Sub-PRD Index) matches actual files
604
+ - [ ] [Master-Sub] Each Sub-PRD contains Section 3.4 Feature Breakdown
605
+
606
+ IF any check fails → Report error and fix before proceeding.
607
+
608
+ ---
609
+
610
+ ### Step 12e: Request Confirmation
611
+
612
+ Present summary to user:
613
+
614
+ **Single PRD:**
453
615
  ```
454
- Business Modeling generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-bizs-modeling.md
455
- PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
616
+ PRD generated: {path}
456
617
  ```
457
618
 
458
- ### Master-Sub PRD Output
619
+ **Master-Sub PRD:**
459
620
  ```
460
- Master PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
461
- Sub-PRDs generated:
462
- - [feature-name]-sub-[module1].md
463
- - [feature-name]-sub-[module2].md
621
+ Master PRD: {master_path}
622
+ Sub-PRDs ({sub_prd_count} files):
623
+ 1. {module-1}: {sub_prd_1_path}
624
+ 2. {module-2}: {sub_prd_2_path}
625
+ ...
626
+ N. {module-N}: {sub_prd_N_path}
627
+
628
+ Total files generated: {sub_prd_count + 1}
464
629
  ```
465
630
 
466
- Please confirm the following key points:
467
- 1. Is the feature boundary accurate?
468
- 2. Are the acceptance criteria quantifiable?
469
- 3. Is the Not In Scope complete?
470
- 4. **[For complex requirements]** Is the Master-Sub structure appropriate?
471
- 5. **[For existing features]** Are the [EXISTING]/[MODIFIED]/[NEW] markers accurate?
631
+ Confirm:
632
+ 1. Feature boundary accurate?
633
+ 2. Acceptance criteria quantifiable?
634
+ 3. Not In Scope complete?
635
+ 4. [Master-Sub] Module decomposition appropriate?
636
+ 5. [Existing features] EXISTING/MODIFIED/NEW markers accurate?
472
637
 
473
- After confirmation, you can start the Solution Agent for solution planning.
638
+ After user confirms, proceed to Step 13 to write progress files and finalize PRD stage.
474
639
 
475
640
  ## Step 13: Write Progress Files
476
641
 
@@ -503,7 +668,7 @@ Read and update the WORKFLOW-PROGRESS.json file:
503
668
 
504
669
  1. **Read**: `speccrew-workspace/iterations/{iteration}/WORKFLOW-PROGRESS.json`
505
670
  2. **Update the following fields**:
506
- - `current_stage` = "02_feature_design"
671
+ - `current_stage` = "01_prd" (keep current stage — the next agent will update this when it starts)
507
672
  - `01_prd.status` = "confirmed"
508
673
  - `01_prd.completed_at` = `<current-ISO-timestamp>`
509
674
  - `01_prd.confirmed_at` = `<current-ISO-timestamp>`
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: speccrew-pm-sub-prd-generate
3
+ description: Generate a single Sub-PRD document for one module. Used by PM Agent's worker dispatch to parallelize Sub-PRD generation across multiple modules. Each worker invocation generates one complete Sub-PRD file based on the PRD template.
4
+ tools: Read, Write, Glob, Grep
5
+ ---
6
+
7
+ # Trigger Scenarios
8
+
9
+ - PM Agent dispatches worker to generate Sub-PRD for a specific module
10
+ - Worker receives module context from PM Agent's dispatch plan
11
+
12
+ # Input Parameters
13
+
14
+ | Parameter | Required | Description |
15
+ |-----------|----------|-------------|
16
+ | module_name | Yes | Human-readable module name (e.g., "Customer Management") |
17
+ | module_key | Yes | Module identifier for file naming (e.g., "customer") |
18
+ | module_scope | Yes | What this module covers |
19
+ | module_entities | Yes | Core business entities in this module |
20
+ | module_user_stories | Yes | User stories specific to this module |
21
+ | module_requirements | Yes | Functional requirements for this module (P0/P1/P2) |
22
+ | module_features | Yes | Feature Breakdown entries for this module (Feature IDs, Types, Dependencies) |
23
+ | module_dependencies | No | Dependencies on other modules |
24
+ | master_prd_path | Yes | Path to the Master PRD (for cross-referencing) |
25
+ | feature_name | Yes | System-level feature name (for file naming prefix) |
26
+ | template_path | Yes | Path to PRD-TEMPLATE.md |
27
+ | output_path | Yes | Full path for the Sub-PRD output file |
28
+
29
+ # Absolute Constraints
30
+
31
+ > **These rules apply to ALL document generation steps. Violation = task failure.**
32
+
33
+ 1. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
34
+ 2. **MANDATORY: Template-first workflow** — Copy template MUST execute before filling sections.
35
+
36
+ # Workflow
37
+
38
+ ## Step 1: Load Context
39
+
40
+ 1. Read Master PRD at `{master_prd_path}` to understand:
41
+ - System-wide background and goals
42
+ - Cross-module dependency matrix
43
+ - This module's position in the overall system
44
+
45
+ 2. Read PRD template at `{template_path}`
46
+
47
+ ## Step 2: Create Sub-PRD File
48
+
49
+ 1. Copy template content to `{output_path}` using `create_file`
50
+ 2. Replace the title: `# PRD - [Feature Name]` → `# Sub-PRD - {module_name}`
51
+
52
+ ## Step 3: Fill Module-Specific Content
53
+
54
+ Fill each section using `search_replace`:
55
+
56
+ ### 3.1 Section 1: Background & Goals
57
+ - 1.1 Background: Why this module exists within the system, what problem it solves
58
+ - 1.2 Goals: Module-specific business objectives
59
+
60
+ ### 3.2 Section 2: User Stories
61
+ - 2.1 Target Users: Users who interact with this specific module
62
+ - 2.2 User Scenarios: Module-specific user stories in "As a / I want / So that" format
63
+
64
+ ### 3.3 Section 3: Functional Requirements
65
+ - 3.1 Use Case Diagram: Module-specific use case diagram (Mermaid flowchart TB)
66
+ - 3.2 Business Process Flow: Module-internal process flow
67
+ - 3.3 Feature List: Module features with P0/P1/P2 priority
68
+ - 3.4 Feature Breakdown: **REQUIRED** — Fill with `{module_features}` data:
69
+ - Feature ID, Feature Name, Type (Page+API / API-only), Pages/Endpoints count, Description
70
+ - Feature Dependencies table
71
+ - 3.5 Feature Details: Detailed descriptions for each feature including:
72
+ - Requirement Description
73
+ - Interaction Flow
74
+ - Boundary Conditions table
75
+ - Exception Scenarios
76
+
77
+ ### 3.4 Section 4: Non-functional Requirements
78
+ - Module-specific performance, security, compatibility requirements
79
+ - Reference Master PRD for system-wide NFRs
80
+
81
+ ### 3.5 Section 5: Acceptance Criteria
82
+ - 5.1 Must Have: Module-specific acceptance items
83
+ - 5.2 Should Have: Module-specific nice-to-have items
84
+
85
+ ### 3.6 Section 6: Boundary Description
86
+ - 6.1 In Scope: What this module covers
87
+ - 6.2 Out of Scope: What this module explicitly does NOT cover
88
+
89
+ ### 3.7 Section 7: Assumptions & Dependencies
90
+ - Dependencies on other modules (reference Master PRD dependency matrix)
91
+ - External system dependencies
92
+ - Prerequisites
93
+
94
+ > ⚠️ **FORBIDDEN: `create_file` to rewrite the entire document. MUST use `search_replace` per section.**
95
+
96
+ ## Step 4: Verify Output
97
+
98
+ 1. Read the generated file to verify:
99
+ - File exists and is non-empty
100
+ - File size > 3KB (not a placeholder)
101
+ - Section 3.4 Feature Breakdown is populated
102
+ - Title contains module name
103
+
104
+ 2. Report result:
105
+
106
+ ```
107
+ IF verification passes:
108
+ → Output: "✅ Sub-PRD generated: {output_path}"
109
+ IF verification fails:
110
+ → Output: "❌ Sub-PRD verification failed: {reason}"
111
+ → Attempt to fix the specific issue
112
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {