speccrew 0.2.7 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/.speccrew/agents/speccrew-feature-designer.md +220 -27
  2. package/.speccrew/agents/speccrew-product-manager.md +90 -0
  3. package/.speccrew/agents/speccrew-system-designer.md +237 -31
  4. package/.speccrew/agents/speccrew-system-developer.md +44 -10
  5. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +15 -1
  6. package/.speccrew/skills/speccrew-dev-desktop/SKILL.md +36 -7
  7. package/.speccrew/skills/speccrew-dev-review/SKILL.md +16 -7
  8. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +150 -35
  9. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +140 -18
  10. package/.speccrew/skills/speccrew-fd-feature-design/templates/FEATURE-SPEC-TEMPLATE.md +4 -1
  11. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +29 -15
  12. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +51 -6
  13. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +18 -20
  14. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +7 -10
  15. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +19 -23
  16. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +151 -153
  17. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +23 -63
  18. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +32 -68
  19. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +6 -2
  20. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +203 -17
  21. package/.speccrew/skills/speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md +16 -1
  22. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +33 -6
  23. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +25 -5
  24. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +17 -0
  25. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +20 -3
  26. package/.speccrew/skills/speccrew-test-execute/SKILL.md +8 -0
  27. package/package.json +1 -1
@@ -4,12 +4,9 @@ description: Stage 2 of technology knowledge initialization - Generate technolog
4
4
  tools: Read, Write, Glob, Grep, Skill
5
5
  ---
6
6
 
7
- > **⚠️ DEPRECATED**: This skill has been split into two specialized skills for parallel execution:
8
- > - **`speccrew-knowledge-techs-generate-conventions`** — Generates convention documents (INDEX, tech-stack, architecture, conventions-*)
9
- > - **`speccrew-knowledge-techs-generate-ui-style`** — Generates UI style documents (ui-style/ directory, frontend platforms only)
7
+ > **⚠️ DEPRECATED**: This skill has been superseded by `speccrew-knowledge-techs-generate-conventions` and `speccrew-knowledge-techs-generate-ui-style`. Use those skills for new requests. This file is kept for backward compatibility only.
10
8
  >
11
9
  > **Do NOT invoke this skill directly.** Use the specialized skills via `speccrew-knowledge-techs-dispatch` Stage 2 dual-worker orchestration.
12
- > This file is retained as reference documentation only.
13
10
 
14
11
  # Stage 2: Generate Platform Technology Documents
15
12
 
@@ -50,66 +47,19 @@ Worker Agent (speccrew-task-worker)
50
47
 
51
48
  Generate the following documents in `{output_path}/`:
52
49
 
53
- ```
54
- {output_path}/
55
- ├── INDEX.md # Platform technology index (Required)
56
- ├── tech-stack.md # Technology stack details (Required)
57
- ├── architecture.md # Architecture conventions (Required)
58
- ├── conventions-design.md # Design conventions (Required)
59
- ├── conventions-dev.md # Development conventions (Required)
60
- ├── conventions-unit-test.md # Unit testing conventions (Required)
61
- ├── conventions-system-test.md # System testing conventions (Required)
62
- ├── conventions-build.md # Build & Deployment conventions (Required)
63
- ├── conventions-data.md # Data conventions (Optional)
64
- └── ui-style/ # UI style analysis (Optional, frontend platforms only)
65
- ├── ui-style-guide.md # Main UI style guide
66
- ├── page-types/ # Page type analysis
67
- ├── components/ # Component analysis
68
- ├── layouts/ # Layout patterns
69
- └── styles/ # Styling conventions
70
- ```
71
-
72
- ### Platform Type to Document Mapping
73
-
74
- | Platform Type | Required Documents | Optional Documents | Generate conventions-data.md? |
75
- |---------------|-------------------|-------------------|------------------------------|
76
- | `backend` | All 8 docs | - | ✅ **必须生成** - 包含 ORM、数据建模、缓存策略 |
77
- | `web` | All 8 docs | conventions-data.md | ⚠️ **条件生成** - 仅当使用 ORM/数据层时(Prisma、TypeORM、Sequelize 等) |
78
- | `mobile` | All 8 docs | conventions-data.md | ❌ **默认不生成** - 根据实际技术栈判断 |
79
- | `desktop` | All 8 docs | conventions-data.md | ❌ **默认不生成** - 根据实际技术栈判断 |
80
- | `api` | All 8 docs | conventions-data.md | ⚠️ **条件生成** - 根据是否有数据层 |
81
-
82
- ### Decision Logic for conventions-data.md
83
-
84
- **Step 1: Check Platform Type**
85
- - If `backend` → **Generate** (always)
86
- - If `web`/`mobile`/`desktop`/`api` → Proceed to Step 2
87
-
88
- **Step 2: Detect Data Layer (for non-backend platforms)**
50
+ **Required Documents (All Platforms)**:
51
+ - `INDEX.md` - Platform technology index
52
+ - `tech-stack.md` - Technology stack details
53
+ - `architecture.md` - Architecture conventions
54
+ - `conventions-design.md` - Design conventions
55
+ - `conventions-dev.md` - Development conventions
56
+ - `conventions-unit-test.md` - Unit testing conventions
57
+ - `conventions-system-test.md` - System testing conventions
58
+ - `conventions-build.md` - Build & Deployment conventions
89
59
 
90
- Check configuration files for data layer indicators:
91
-
92
- | Indicator | Technology | Action |
93
- |-----------|------------|--------|
94
- | `prisma` in package.json dependencies | Prisma ORM | Generate conventions-data.md |
95
- | `typeorm` in package.json dependencies | TypeORM | Generate conventions-data.md |
96
- | `sequelize` in package.json dependencies | Sequelize | Generate conventions-data.md |
97
- | `mongoose` in package.json dependencies | Mongoose | Generate conventions-data.md |
98
- | `drizzle-orm` in package.json dependencies | Drizzle ORM | Generate conventions-data.md |
99
- | `firebase` / `@react-native-firebase` | Firebase | Generate conventions-data.md (lightweight) |
100
- | `sqlite` / `realm` / `@realm/react` | SQLite/Realm | Generate conventions-data.md (lightweight) |
101
- | `core-data` in iOS project | Core Data | Generate conventions-data.md |
102
- | `room` in Android project | Room Persistence | Generate conventions-data.md |
103
- | None detected | - | **Skip** conventions-data.md |
104
-
105
- **Step 3: Report Decision**
106
- ```
107
- Platform: {platform_id}
108
- Type: {platform_type}
109
- Framework: {framework}
110
- Data Layer Detected: {yes/no/technology}
111
- Generate conventions-data.md: {yes/no}
112
- ```
60
+ **Optional Documents**:
61
+ - `conventions-data.md` - Data conventions (backend required; other platforms: only if ORM/data layer detected)
62
+ - `ui-style/` - UI style analysis (frontend platforms only)
113
63
 
114
64
  ## Workflow
115
65
 
@@ -445,6 +395,16 @@ Analysis completeness: {ui_style_analysis_level}
445
395
 
446
396
  **CRITICAL**: This step MUST follow the template fill workflow - copy template first, then fill sections.
447
397
 
398
+ **Decision Logic for conventions-data.md**:
399
+
400
+ IF `platform_type` == `backend`:
401
+ - Generate conventions-data.md (REQUIRED)
402
+ ELSE IF `platform_type` IN [`web`, `mobile`, `desktop`, `api`]:
403
+ - Check package.json dependencies for data layer indicators:
404
+ - IF `prisma` / `typeorm` / `sequelize` / `mongoose` / `drizzle-orm` found → Generate conventions-data.md
405
+ - IF `firebase` / `sqlite` / `realm` found → Generate conventions-data.md (lightweight)
406
+ - ELSE → Skip conventions-data.md
407
+
448
408
  1. **For Each Document, Follow This Workflow**:
449
409
 
450
410
  **Step 5.1: Copy Template File**
@@ -38,6 +38,14 @@ Worker Agent (speccrew-task-worker)
38
38
 
39
39
  - `{{output_path}}/INDEX.md` - Root technology knowledge index
40
40
 
41
+ **INDEX.md Content Structure**:
42
+ - Introduction (generation info, platform count)
43
+ - Platform Overview (table with links to all platform docs)
44
+ - Quick Reference (links organized by document type)
45
+ - Agent-to-Platform Mapping (maps agents to their platform docs)
46
+ - Document Guide (explains each document type)
47
+ - Usage Guide (how to use the knowledge)
48
+
41
49
  ## Workflow
42
50
 
43
51
  ```mermaid
@@ -95,79 +103,35 @@ Read `techs-manifest.json` to get the list of all platforms:
95
103
  }
96
104
  ```
97
105
 
98
- ### Step 2: Verify Platform Documents (Dynamic Detection)
106
+ ### Step 2: Verify Platform Documents
99
107
 
100
108
  **CRITICAL**: Do NOT assume all platforms have the same document set. Must dynamically detect which documents actually exist.
101
109
 
102
- For each platform in manifest, scan the platform directory to detect actual document existence:
110
+ **Step 2a: Scan Platform Directories**
103
111
 
104
- ```
105
- speccrew-workspace/knowledges/techs/{{platform_id}}/
106
- ├── INDEX.md # Required - must exist
107
- ├── tech-stack.md # Required - must exist
108
- ├── architecture.md # Required - must exist
109
- ├── conventions-design.md # Required - must exist
110
- ├── conventions-dev.md # Required - must exist
111
- ├── conventions-test.md # Required - must exist
112
- ├── conventions-build.md # Required - must exist
113
- └── conventions-data.md # Optional - check existence dynamically
114
- ```
112
+ For each platform in manifest:
113
+ 1. List all `.md` files in `{{techs_base_path}}/{{platform_id}}/`
114
+ 2. Build a document availability map for each platform
115
115
 
116
- **Dynamic Detection Logic:**
117
-
118
- 1. **Scan Platform Directory**: List all `.md` files in `{{techs_base_path}}/{{platform_id}}/`
119
- 2. **Build Document Availability Map**:
120
- ```json
121
- {
122
- "platform_id": "mobile-uniapp",
123
- "documents": {
124
- "INDEX.md": true,
125
- "tech-stack.md": true,
126
- "architecture.md": true,
127
- "conventions-design.md": true,
128
- "conventions-dev.md": true,
129
- "conventions-test.md": true,
130
- "conventions-build.md": true,
131
- "conventions-data.md": false // Dynamically detected (optional)
132
- }
133
- }
134
- ```
135
- 3. **Validation**:
136
- - If `INDEX.md` is missing → Note as error in report, skip this platform
137
- - If any required document (except conventions-data.md) is missing → Note as warning
138
- - Record actual document availability for dynamic link generation
139
-
140
- #### Document Verification Matrix
141
-
142
- For each platform directory, verify document existence with these strict rules:
143
-
144
- | Document | Required? | If Missing | Action |
145
- |----------|-----------|------------|--------|
146
- | INDEX.md | YES | ERROR | Skip entire platform from root INDEX. Log: "ERROR: Platform {platform_id} skipped - INDEX.md missing" |
147
- | tech-stack.md | YES | WARN | Include platform but mark document as "[Missing]" in links. Log warning |
148
- | architecture.md | YES | WARN | Include platform but mark as "[Missing]". Log warning |
149
- | conventions-design.md | YES | WARN | Include platform but mark as "[Missing]". Log warning |
150
- | conventions-dev.md | YES | WARN | Include platform but mark as "[Missing]". Log warning |
151
- | conventions-test.md | YES | WARN | Include platform but mark as "[Missing]". Log warning |
152
- | conventions-build.md | YES | WARN | Include platform but mark as "[Missing]". Log warning |
153
- | conventions-data.md | NO | OK | Do not warn. Do not include link. Silently skip |
154
-
155
- **Platform Eligibility Rules**:
156
- - INDEX.md missing → Platform SKIPPED entirely (not listed in root INDEX)
157
- - Any required doc missing (except INDEX.md) → Platform INCLUDED but marked INCOMPLETE
158
- - Only conventions-data.md missing → Platform is COMPLETE (it's optional)
159
-
160
- **Verification Summary** (generate at end of verification step):
161
- ```
162
- Verification Report:
163
- - Total platforms in manifest: {N}
164
- - Complete platforms: {X} (all 7 required docs present)
165
- - Incomplete platforms: {Y} (missing some required docs) [WARN]
166
- - {platform_id}: missing {doc1}, {doc2}
167
- - Skipped platforms: {Z} (no INDEX.md) [ERROR]
168
- - {platform_id}: INDEX.md not found
169
- - Optional conventions-data.md present in: {W} platforms
170
- ```
116
+ **Step 2b: Verify Required Documents**
117
+
118
+ Check each platform for required documents:
119
+ | Document | Required? | If Missing |
120
+ |----------|-----------|------------|
121
+ | INDEX.md | YES | Skip entire platform from root INDEX |
122
+ | tech-stack.md | YES | Mark as "[Missing]" in links |
123
+ | architecture.md | YES | Mark as "[Missing]" in links |
124
+ | conventions-design.md | YES | Mark as "[Missing]" in links |
125
+ | conventions-dev.md | YES | Mark as "[Missing]" in links |
126
+ | conventions-test.md | YES | Mark as "[Missing]" in links |
127
+ | conventions-build.md | YES | Mark as "[Missing]" in links |
128
+ | conventions-data.md | NO | Silently skip link |
129
+
130
+ **Step 2c: Determine Platform Eligibility**
131
+
132
+ - IF `INDEX.md` missing → Platform SKIPPED entirely
133
+ - IF any required doc missing (except INDEX.md) → Platform INCLUDED but marked INCOMPLETE
134
+ - IF only conventions-data.md missing → Platform is COMPLETE (it's optional)
171
135
 
172
136
  ### Step 3: Extract Platform Summaries
173
137
 
@@ -84,9 +84,11 @@ Generate the following documents in `{output_path}/`:
84
84
 
85
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
86
 
87
- ### Step 0: Read All Templates
87
+ ### Step 0: Pre-load Required Templates (Mandatory)
88
88
 
89
- Before analysis, read all template files to understand document structures and required content:
89
+ **This step must complete before any workflow step begins.**
90
+
91
+ Read all template files to understand document structures and required content:
90
92
 
91
93
  | Template File | Output Document | Purpose |
92
94
  |---------------|-----------------|---------|
@@ -106,6 +108,8 @@ Before analysis, read all template files to understand document structures and r
106
108
 
107
109
  **Key principle**: Extract information from source code according to each template's section requirements.
108
110
 
111
+ **Error Handling**: IF any template file is missing THEN report error with template path and STOP workflow.
112
+
109
113
  ### Step 1: Discover Source Structure
110
114
 
111
115
  **Purpose**: Gather project metadata for `ui-style-guide.md` Section 1-2 (Project Overview, Platform Summary)
@@ -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
@@ -305,6 +371,7 @@ Before writing, determine the PRD structure based on requirement complexity:
305
371
  **Each Sub-PRD covers ONE module:**
306
372
  - Module-specific user stories and functional requirements
307
373
  - Module-internal process flows and use cases
374
+ - **Feature Breakdown** (required): List all business operation units with Feature ID, Type, and dependencies
308
375
  - Module-specific acceptance criteria
309
376
  - Interface contracts with other modules (referencing Master PRD dependency matrix)
310
377
 
@@ -314,11 +381,40 @@ Fill in according to the template structure, requirements:
314
381
  - **Background & Goals**: Explain why we're doing this and what success looks like
315
382
  - **User Stories**: `As a [user role], I want [to do something], so that [I can achieve some goal]`
316
383
  - **Functional Requirements**: Group by priority (P0 Core / P1 Important / P2 Optional)
384
+ - **Feature Breakdown**: Extract business operation units for downstream Feature Design (see Step 9.1)
317
385
  - **Non-functional Requirements**: Performance, security, compatibility, etc.
318
386
  - **Acceptance Criteria**: Quantifiable, verifiable definition of done
319
387
  - **Boundary Description**: Clearly define Not In Scope content
320
388
  - **Assumptions & Dependencies**: Prerequisites, external dependencies
321
389
 
390
+ ### Step 9.1: Extract Feature Breakdown
391
+
392
+ For both simple and complex requirements, extract Feature Breakdown to guide downstream Feature Design:
393
+
394
+ **Analysis Steps:**
395
+ 1. **Analyze user stories and functional requirements** for this module/feature
396
+ 2. **Identify business operation units** - each unit should represent:
397
+ - A complete business operation (e.g., "Customer List Management" includes search, filter, pagination, tag management)
398
+ - Can span 1-2 pages but remains business-cohesive
399
+ - Estimated implementation: no more than 15 code files (frontend + backend combined)
400
+ 3. **Classify Feature Type:**
401
+ - `Page+API`: Frontend page with corresponding backend APIs (for full-stack architecture)
402
+ - `API-only`: Group of related APIs (for backend-only features)
403
+ 4. **Assign Feature IDs**: Use format `F-{MODULE}-{NN}` (e.g., F-CRM-01, F-CRM-02)
404
+ 5. **Document dependencies**: Identify data or workflow dependencies between features
405
+
406
+ **Granularity Guidelines:**
407
+ | Good Feature Size | Too Large (Split Further) |
408
+ |-------------------|--------------------------|
409
+ | Single CRUD operation group | Complete module with 5+ CRUDs |
410
+ | One list page with filters | Entire reporting subsystem |
411
+ | One form with validation | Multi-step wizard with 10+ steps |
412
+ | Single API endpoint group | All APIs for a domain |
413
+
414
+ **Output:** Complete the Feature Breakdown table in Section 3.4 of the PRD template.
415
+
416
+ **Note:** Even simple requirements (single-file PRD) should include Feature Breakdown, typically with 1-3 features.
417
+
322
418
  ### Marking Existing vs New Features
323
419
 
324
420
  When the requirement involves modifying existing system functions, clearly mark each item:
@@ -390,47 +486,135 @@ If the iteration directory does not exist, refer to the `000-sample` directory s
390
486
 
391
487
  ## Step 12: Write Files Using Template-Fill Workflow
392
488
 
393
- ### 12a Copy Template to Document Path
489
+ ⚠️ **CRITICAL: For Master-Sub structure, you MUST generate ALL Sub-PRD files.**
490
+ - **DO NOT put all module content into the Master PRD.**
491
+ - **Each Sub-PRD is a SEPARATE file containing ONLY that module's requirements.**
492
+
493
+ ---
494
+
495
+ ### Step 12a: Generate Master PRD
394
496
 
395
- For each document to write (PRD, and optionally Sub-PRDs):
497
+ **For BOTH Single and Master-Sub structures:**
396
498
 
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
499
+ 1. **Copy template to document path:**
500
+ - Read `templates/PRD-TEMPLATE.md` (already loaded in Step 7)
501
+ - Replace top-level placeholders (feature name, iteration, date)
502
+ - Create document using `create_file` at: `{iteration}/01.product-requirement/{feature-name}-prd.md`
401
503
 
402
- ### 12b Fill Each Section Using search_replace
504
+ 2. **Fill Master-only content using `search_replace`:**
505
+ - Section 1: Overall background, goals, success metrics
506
+ - Section 2: System architecture overview (Mermaid graph TB)
507
+ - Section 3: Module list with scope boundaries (from Step 6.1)
508
+ - Section 4: Cross-module dependency matrix (from Step 6.2)
509
+ - Section 5: Implementation phases and ordering (from Step 6.3)
510
+ - Section 6: Shared entities and data contracts
511
+ - Section 7: Global non-functional requirements
403
512
 
404
- Fill each section with content prepared in Step 9, using `search_replace` per section.
513
+ 3. **DO NOT include module-specific content in Master:**
514
+ - No module-specific user stories
515
+ - No module-specific functional requirements
516
+ - No module-specific Feature Breakdown tables
405
517
 
406
518
  > ⚠️ **CRITICAL CONSTRAINTS:**
407
519
  > - **FORBIDDEN: `create_file` to rewrite the entire document**
408
520
  > - **MUST use `search_replace` to fill each section individually**
409
521
  > - **All section titles MUST be preserved**
410
522
 
411
- For Master-Sub structure, repeat 12a + 12b for each Sub-PRD document.
523
+ ---
524
+
525
+ ### Step 12b: Generate Sub-PRDs (LOOP - MANDATORY for Master-Sub)
526
+
527
+ **IF Step 8 determined Master-Sub structure, execute this loop:**
528
+
529
+ ```
530
+ FOR each module in module_list from Step 6.1:
531
+
532
+ 12b.1: Copy template to sub_prd_path
533
+ sub_prd_name = "{feature-name}-sub-{module-key}.md"
534
+ sub_prd_path = "{iteration}/01.product-requirement/{sub_prd_name}"
535
+
536
+ Action:
537
+ 1. Read templates/PRD-TEMPLATE.md
538
+ 2. Replace top-level placeholders
539
+ 3. Create document using create_file at sub_prd_path
540
+
541
+ 12b.2: Fill module-specific content using search_replace:
542
+ - Section 1: Module-specific background and context
543
+ - Section 2: Module-specific user stories
544
+ - Section 3: Module-specific functional requirements
545
+ - Section 3.4: Module-specific Feature Breakdown (REQUIRED)
546
+ - Section 5: Module-specific acceptance criteria
547
+ - Add: Interface Contracts (from Master dependency matrix)
548
+
549
+ 12b.3: Verify file exists and is non-empty
550
+ - Read sub_prd_path to confirm file was created
551
+ - Verify file size > 1KB (not empty placeholder)
552
+
553
+ NEXT module
554
+
555
+ ⚠️ STOP condition: All modules in module_list have been processed.
556
+ ```
557
+
558
+ **Example loop execution:**
559
+ ```
560
+ Iteration 1: Process module "inventory"
561
+ → Create: inventory-management-sub-inventory.md
562
+ → Fill: inventory-specific content
563
+ → Verify: file exists and has content
564
+
565
+ Iteration 2: Process module "order"
566
+ → Create: inventory-management-sub-order.md
567
+ → Fill: order-specific content
568
+ → Verify: file exists and has content
569
+
570
+ ... continue until all modules processed
571
+ ```
572
+
573
+ ---
574
+
575
+ ### Step 12c: Verification Checklist (MANDATORY)
576
+
577
+ **After all PRD files are generated, verify:**
578
+
579
+ ```
580
+ □ Master PRD exists at {iteration}/01.product-requirement/{feature-name}-prd.md
581
+ □ Master PRD file size > 2KB (not empty placeholder)
582
+
583
+ [For Master-Sub structure ONLY:]
584
+ □ All {sub_prd_count} Sub-PRD files exist
585
+ □ Each Sub-PRD file size > 3KB (not empty placeholder)
586
+ □ Master PRD Section index links match actual Sub-PRD files
587
+ □ No broken file references
588
+ □ Each Sub-PRD contains module-specific Feature Breakdown
589
+
590
+ IF any check fails → STOP and report error, fix before proceeding
591
+ IF all checks pass → Proceed to Step 12d
592
+ ```
593
+
594
+ ---
412
595
 
413
- ### 12c Request Confirmation
596
+ ### Step 12d: Request Confirmation
414
597
 
415
- After writing files, show summary and request user confirmation:
598
+ After verification passes, show summary and request user confirmation:
416
599
 
417
- ### Simple PRD Output
600
+ **Simple PRD Output:**
418
601
  ```
419
602
  PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
420
603
  ```
421
604
 
422
- ### Complex PRD Output (with modeling)
605
+ **Complex PRD Output (with modeling):**
423
606
  ```
424
607
  Business Modeling generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-bizs-modeling.md
425
608
  PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
426
609
  ```
427
610
 
428
- ### Master-Sub PRD Output
611
+ **Master-Sub PRD Output:**
429
612
  ```
430
613
  Master PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
431
- Sub-PRDs generated:
614
+ Sub-PRDs generated ({sub_prd_count} files):
432
615
  - [feature-name]-sub-[module1].md
433
616
  - [feature-name]-sub-[module2].md
617
+ - ...
434
618
  ```
435
619
 
436
620
  Please confirm the following key points:
@@ -529,6 +713,8 @@ If WORKFLOW-PROGRESS.json does not exist (backward compatibility):
529
713
  - [ ] PRD structure (single vs master-sub) determined appropriately
530
714
  - [ ] **[Master-Sub]** Master PRD includes architecture overview, module list, dependency matrix, implementation phases
531
715
  - [ ] **[Master-Sub]** Each Sub-PRD covers exactly one module with interface contracts
716
+ - [ ] **Feature Breakdown** extracted with appropriate granularity (each feature ≤ 15 code files)
717
+ - [ ] **Feature Breakdown** includes Feature IDs, Types (Page+API / API-only), and dependencies
532
718
  - [ ] PRD completely filled according to template structure
533
719
  - [ ] User story granularity aligns with "single iteration completable" principle
534
720
  - [ ] Acceptance criteria are quantifiable and verifiable
@@ -103,7 +103,22 @@ graph TB
103
103
  | [Feature 1] | P0 | [Description] | [Acceptance Criteria] |
104
104
  | [Feature 2] | P1 | [Description] | [Acceptance Criteria] |
105
105
 
106
- ### 3.2 Feature Details
106
+ ### 3.4 Feature Breakdown
107
+
108
+ > List all business operation units in this module. Each feature represents a cohesive business operation (e.g., one frontend page with its backend APIs, or one API group for backend-only). This breakdown guides downstream Feature Design to generate per-feature specs.
109
+
110
+ | Feature ID | Feature Name | Type | Pages/Endpoints | Description |
111
+ |------------|-------------|------|-----------------|-------------|
112
+ | F-{MODULE}-01 | {Feature name} | Page+API / API-only | {page count or endpoint count} | {Brief description} |
113
+ | F-{MODULE}-02 | {Feature name} | Page+API / API-only | {page count or endpoint count} | {Brief description} |
114
+
115
+ #### Feature Dependencies
116
+
117
+ | Feature | Depends On | Dependency Type |
118
+ |---------|-----------|----------------|
119
+ | F-{MODULE}-02 | F-{MODULE}-01 | Data dependency |
120
+
121
+ ### 3.5 Feature Details
107
122
 
108
123
  #### Feature 1: [Feature Name]
109
124
 
@@ -24,10 +24,15 @@ tools: Read, Write, Glob, Grep
24
24
 
25
25
  ## Step 1: Read Inputs
26
26
 
27
+ **Input Parameters** (from agent context):
28
+ - `feature_id` (optional): Feature identifier, e.g., `F-CRM-01`. If provided, use new naming format.
29
+ - `feature_name`: Feature name, e.g., `customer-list`.
30
+ - `platform_id`: Target platform, e.g., `backend-spring`, `backend-nestjs`.
31
+
27
32
  Read in order:
28
33
 
29
- 1. **Feature Spec document(s)**: `speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-name]-feature-spec.md`
30
- 2. **API Contract**: `speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-name]-api-contract.md`
34
+ 1. **Feature Spec document(s)**: `speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md`
35
+ 2. **API Contract**: `speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/{feature-id}-{feature-name}-api-contract.md`
31
36
  3. **Backend techs knowledge** (paths from agent context):
32
37
  - `speccrew-workspace/knowledges/techs/{platform_id}/tech-stack.md`
33
38
  - `speccrew-workspace/knowledges/techs/{platform_id}/architecture.md`
@@ -56,6 +61,8 @@ Use Glob/Grep to understand current backend codebase:
56
61
 
57
62
  Parse Feature Spec to identify all backend-relevant functions.
58
63
 
64
+ > **Note**: With the new fine-grained Feature Spec format, each Feature Spec typically contains **3-8 functions** (previously 10-20). The extraction logic remains the same, but the scope is more focused.
65
+
59
66
  For each function, extract:
60
67
 
61
68
  | Aspect | Content |
@@ -91,7 +98,10 @@ Read the SD-BACKEND-TEMPLATE.md to understand document structure.
91
98
  2. **Replace top-level placeholders** with known variables:
92
99
  - Module name, feature name, platform ID, etc.
93
100
  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`
101
+ - **Target path pattern**:
102
+ - With `feature_id`: `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{feature-id}-{feature-name}-design.md`
103
+ - Example: `03.system-design/backend-spring/F-CRM-01-customer-list-design.md`
104
+ - Without `feature_id` (backward compatibility): `speccrew-workspace/iterations/{number}-{type}-{name}/03.system-design/{platform_id}/{module}-design.md`
95
105
  - Content: Template with top-level placeholders replaced
96
106
  4. **Verify**: Document should have complete section structure ready for filling
97
107
 
@@ -113,6 +123,22 @@ Fill each section with technology-specific implementation details.
113
123
  | **Transaction Boundaries** | Use actual framework transaction mechanism |
114
124
  | **Exception Handling** | Use actual exception classes and error codes |
115
125
 
126
+ **How to Reference Techs Knowledge for Pseudo-code:**
127
+
128
+ 1. **Read relevant techs knowledge file for the platform**:
129
+ - Core syntax: `tech-stack.md` for framework version and key libraries
130
+ - ORM patterns: `conventions-data.md` for entity definitions and transaction management
131
+ - Design patterns: `conventions-design.md` for layer structure and naming conventions
132
+ 2. **Extract framework-specific syntax patterns**:
133
+ - Controller annotations/decorators
134
+ - Service injection patterns
135
+ - Repository/DAO method signatures
136
+ - Transaction management annotations
137
+ 3. **Apply patterns in pseudo-code**:
138
+ - Use exact annotation/decorator syntax from techs knowledge
139
+ - Follow naming conventions from conventions-design.md
140
+ - Apply ORM patterns from conventions-data.md
141
+
116
142
  **Pseudo-code Requirements:**
117
143
  - MUST use actual framework syntax from techs knowledge
118
144
  - Spring Boot: `@RestController`, `@PostMapping`, `@Valid`, `@Transactional`, etc.
@@ -153,7 +179,7 @@ Read INDEX-TEMPLATE.md to understand platform-level document structure.
153
179
  |---------|---------|
154
180
  | **Tech Stack Summary** | Extract from techs knowledge |
155
181
  | **Shared Design Decisions** | Middleware stack, data source config, base service classes, common utilities |
156
- | **Module List Table** | Links to each module design document |
182
+ | **Module List Table** | Links to each module design document. Use `feature_id` as identifier if available (e.g., `F-CRM-01`), otherwise use module name. Example: `\| F-CRM-01 \| Customer List \| F-CRM-01-customer-list-design.md \| NEW \|` |
157
183
  | **Cross-Module Interaction Notes** | Shared services, event-driven patterns, dependencies |
158
184
  | **Database Schema Overview** | New tables, modified tables, entity relationships |
159
185
 
@@ -202,11 +228,11 @@ After completing all steps, output a structured completion report for the System
202
228
  - **Status**: SUCCESS
203
229
  - **Task ID**: {task_id from context}
204
230
  - **Platform**: {platform_id}
231
+ - **Feature ID**: {feature_id}
205
232
  - **Feature**: {feature_name}
206
233
  - **Output Files**:
207
234
  - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/INDEX.md
208
- - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/{module1}-design.md
209
- - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/{module2}-design.md
235
+ - speccrew-workspace/iterations/{iter}/03.system-design/{platform_id}/{feature-id}-{feature-name}-design.md (or {module}-design.md if no feature_id)
210
236
  - **Summary**: Backend system design completed for {feature_name} on {platform_id} with {count} module designs
211
237
  ```
212
238
 
@@ -217,6 +243,7 @@ After completing all steps, output a structured completion report for the System
217
243
  - **Status**: FAILED
218
244
  - **Task ID**: {task_id from context}
219
245
  - **Platform**: {platform_id}
246
+ - **Feature ID**: {feature_id}
220
247
  - **Feature**: {feature_name}
221
248
  - **Output Files**: []
222
249
  - **Error**: {description of what went wrong}