speccrew 0.6.69 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.speccrew/agents/speccrew-task-worker.md +1 -1
  2. package/.speccrew/agents/speccrew-team-leader.md +336 -189
  3. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
  4. package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
  5. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
  6. package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
  7. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
  8. package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
  9. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
  10. package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
  11. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
  12. package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
  13. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
  14. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
  15. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
  16. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
  17. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
  18. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
  19. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
  20. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
  21. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
  22. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
  23. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
  24. package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
  25. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
  26. package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
  27. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
  28. package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
  29. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
  30. package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
  31. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
  32. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
  33. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
  34. package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
  35. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
  36. package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
  37. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
  38. package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
  39. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
  40. package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
  41. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
  42. package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
  43. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
  44. package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
  45. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
  46. package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
  47. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
  48. package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
  49. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
  50. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
  51. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
  52. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
  53. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
  54. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
  55. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
  56. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
  57. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
  58. package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
  59. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
  60. package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
  61. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
  62. package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
  63. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
  64. package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
  65. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
  66. package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
  67. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
  68. package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
  69. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
  70. package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
  71. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
  72. package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
  73. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
  74. package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
  75. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
  76. package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
  77. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
  78. package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
  79. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
  80. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
  81. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
  82. package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
  83. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
  84. package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
  85. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
  86. package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
  87. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
  88. package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
  89. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
  90. package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
  91. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
  92. package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
  93. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
  94. package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
  95. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
  96. package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
  97. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
  98. package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
  99. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
  100. package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
  101. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
  102. package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
  103. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
  104. package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
  105. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
  106. package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
  107. package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
  108. package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
  109. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
  110. package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
  111. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
  112. package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
  113. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
  114. package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
  115. package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
  116. package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
  117. package/bin/cli.js +8 -1
  118. package/lib/commands/validate.js +565 -0
  119. package/package.json +1 -1
  120. package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
  121. package/workspace-template/scripts/validate-agentflow.js +637 -0
  122. package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
  123. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
  124. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
  125. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
  126. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
  127. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
  128. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
  129. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
  130. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
  131. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
  132. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1087
  133. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
  134. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
@@ -36,351 +36,11 @@ Applies ISA-95 Stages 2-3 outputs for PRD generation:
36
36
 
37
37
  ---
38
38
 
39
- # Workflow
39
+ # AgentFlow Definition
40
40
 
41
- ## Absolute Constraints
41
+ <!-- @agentflow: workflow.agentflow.xml -->
42
42
 
43
- > **Violation = task failure**
44
-
45
- 1. **FORBIDDEN:** `create_file` for documents — use `search_replace` on templates
46
- 2. **FORBIDDEN:** Full-file rewrite — use targeted `search_replace`
47
- 3. **MANDATORY:** Template-first workflow
48
-
49
- ## Step 1: Verify Prerequisites
50
-
51
- > 🚨 **MANDATORY: Both `.clarification-summary.md` AND `.module-design.md` MUST exist.**
52
- > These files are generated by prior skills (clarify → model).
53
-
54
- **IF either file is missing → ABORT immediately:**
55
- ```
56
- ❌ ERROR: Prerequisite files not found.
57
- Missing: [filename]
58
- Path: {iteration_path}/01.product-requirement/
59
-
60
- This skill requires completed clarification and modeling.
61
- Please run speccrew-pm-requirement-clarify and speccrew-pm-requirement-model first.
62
- ```
63
-
64
- **Actions:**
65
- 1. Read `.clarification-summary.md` — extract: key decisions, clarified scope, business rules
66
- 2. Read `.module-design.md` — extract:
67
- - **Module count**: from `## Module List (Total: N modules)` heading (parse the number N)
68
- - **Module list**: rows from Module List table
69
- - **Dependency matrix**: rows from Dependency Matrix table
70
- - **Implementation phases**: items from Implementation Phases section
71
-
72
- **Validation:**
73
- - IF module_count >= 2 → MANDATORY: Use Master-Sub Structure
74
- - IF module_count < 2 → Use Single PRD Structure
75
-
76
- ## Step 2: Read PRD Template
77
-
78
- **Actions:**
79
- 1. Search for template using glob pattern:
80
- ```
81
- **/speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md
82
- ```
83
- 2. Read the template file
84
-
85
- > ⚠️ The template is ALWAYS located in the skill's own `templates/` subfolder.
86
-
87
- ## Step 3: Determine PRD Structure
88
-
89
- **Structure Decision (MANDATORY IF/THEN):**
90
-
91
- ```
92
- IF modules_count >= 2 OR cross_module_dependencies exist:
93
- → MANDATORY: Use Master-Sub Structure
94
- → Record: sub_prd_count = len(module_list)
95
- ELSE:
96
- → Use Single PRD Structure
97
- ```
98
-
99
- ### Structure Types
100
-
101
- **Single PRD Structure:**
102
- ```
103
- 01.product-requirement/
104
- └── [feature-name]-prd.md
105
- ```
106
-
107
- **Master-Sub Structure:**
108
- ```
109
- 01.product-requirement/
110
- ├── [feature-name]-prd.md # Master PRD
111
- ├── [feature-name]-sub-[module1].md # Sub-PRD: Module 1
112
- ├── [feature-name]-sub-[module2].md # Sub-PRD: Module 2
113
- └── ...
114
- ```
115
-
116
- ### Master PRD Requirements
117
-
118
- - Overall background, goals, and success metrics
119
- - System architecture overview (Mermaid graph TB)
120
- - Module list with scope boundaries
121
- - Cross-module dependency matrix
122
- - Implementation phases
123
- - Shared entities and data contracts
124
- - Global non-functional requirements
125
-
126
- ### Sub-PRD Requirements (per module)
127
-
128
- - Module-specific user stories and functional requirements
129
- - Module-internal process flows and use cases
130
- - **Feature Breakdown** (required): Feature ID, Type, dependencies
131
- - Module-specific acceptance criteria
132
- - Interface contracts with other modules
133
-
134
- ## Step 4: Write PRD Content
135
-
136
- > 🚨 **CRITICAL: PM Stage Content Boundary Enforcement**
137
- >
138
- > **ABORT if ANY section includes:**
139
- > - API definitions, HTTP methods, JSON schemas
140
- > - Database table structures, ER diagrams, SQL queries
141
- > - Code snippets, pseudocode, implementation logic
142
- > - Technical terminology (UUID, JWT, REST, Microservice, etc.)
143
- >
144
- > **All descriptions MUST use business language only.**
145
- > ✅ "Customer can upload photos" ❌ "Implement S3 upload API"
146
- > ✅ "Show error when name is empty" ❌ "throw ValidationException"
147
-
148
- **Actions:**
149
- 1. Fill PRD sections using `search_replace` on template
150
-
151
- **Section Content:**
152
-
153
- | Section | Content |
154
- |---------|---------|
155
- | 1. Background & Goals | Why we're doing this, success metrics |
156
- | 2. User Stories | `As a [role], I want [action], so that [value]` |
157
- | 3. Functional Requirements | Group by priority (P0/P1/P2), include Feature Breakdown |
158
- | 4. Non-functional Requirements | Performance, security, compatibility |
159
- | 5. Acceptance Criteria | Quantifiable, verifiable |
160
- | 6. Boundary Description | In/out scope |
161
- | 7. Assumptions & Dependencies | Prerequisites, external dependencies |
162
-
163
- ### 4.1 Feature Breakdown
164
-
165
- **For each module, extract business operation units:**
166
-
167
- | Feature ID | Feature Name | Type | Priority | Scope | Description |
168
- |------------|-------------|------|----------|-------|-------------|
169
- | F-{MODULE}-01 | {name} | User Interaction / Backend Process | P0/P1/P2 | {scope} | {desc} |
170
-
171
- **Feature Types:**
172
- - `User Interaction`: Features involving user interface and business logic
173
- - `Backend Process`: Background processing without direct user interaction
174
-
175
- **Granularity Guidelines:**
176
- | Good Size | Too Large (Split) |
177
- |-----------|-------------------|
178
- | Single CRUD operation group | Complete module with 5+ CRUDs |
179
- | One list page with filters | Entire reporting subsystem |
180
- | One form with validation | Multi-step wizard with 10+ steps |
181
-
182
- ### 4.2 Section 3.5 Feature Details — Two-Phase Strategy
183
-
184
- > **⚠️ CRITICAL: Two-Phase Strategy (Skeleton-First, Content-After)**
185
- >
186
- > This step MUST be executed in two phases to ensure consistent document structure.
187
-
188
- #### Phase A: Skeleton Construction (BEFORE any content filling)
189
-
190
- 1. Read PRD-TEMPLATE.md to identify the complete Feature Details structure
191
- 2. Count the number of features from `{module_features}` input
192
- 3. For Section 3.5 Feature Details, replicate the template's Feature block structure for EACH feature:
193
- - Copy the EXACT template structure (all 6 sub-sections) from PRD-TEMPLATE.md
194
- - Create `#### Feature 1: {feature_name}` through `#### Feature N: {feature_name}`
195
- - Each feature block MUST contain these 6 sub-section headers (copied from template):
196
- ```
197
- **Requirement Description:**
198
- [TO BE FILLED]
199
-
200
- **Interaction Flow:**
201
- [TO BE FILLED]
202
-
203
- **Boundary Conditions:**
204
- [TO BE FILLED]
205
-
206
- **Exception Scenarios:**
207
- [TO BE FILLED]
208
-
209
- **Operation Flow Diagram:**
210
- [TO BE FILLED]
211
-
212
- **Operation Steps Detail:**
213
- [TO BE FILLED]
214
- ```
215
- 4. Verify skeleton: confirm ALL features have ALL 6 sub-section headers before proceeding
216
-
217
- > ⚠️ DO NOT start filling content until the complete skeleton is verified.
218
-
219
- #### Phase B: Content Filling (AFTER skeleton is complete)
220
-
221
- Fill each `[TO BE FILLED]` placeholder with actual content:
222
- - **Requirement Description** → Business requirements in business language
223
- - **Interaction Flow** → User interaction steps (numbered list)
224
- - **Boundary Conditions** → Table with Condition Type | Scenario | Handling Rule
225
- - **Exception Scenarios** → Bullet list of exception handling
226
- - **Operation Flow Diagram** → Mermaid `graph LR` diagram showing operation flow
227
- - **Operation Steps Detail** → Table: Step | Action | Expected Outcome | Exception Handling
228
-
229
- ---
230
-
231
- ### 4.3 Marking Existing vs New Features
232
-
233
- | Marker | Meaning |
234
- |--------|---------|
235
- | `[EXISTING]` | Current system capability being reused |
236
- | `[MODIFIED]` | Existing feature being enhanced/changed |
237
- | `[NEW]` | Brand new functionality |
238
-
239
- ## Step 5: Task Granularity Check
240
-
241
- > **⚠️ CRITICAL: Section 3.5 Feature Details Skeleton Verification**
242
- >
243
- > Before proceeding, verify the two-phase strategy was correctly applied:
244
- > 1. Confirm ALL features in Section 3.5 have complete 6 sub-section skeletons
245
- > 2. Confirm no `[TO BE FILLED]` placeholders remain unfilled
246
- > 3. Confirm each feature has: Requirement Description, Interaction Flow, Boundary Conditions, Exception Scenarios, Operation Flow Diagram, Operation Steps Detail
247
-
248
- **After PRD completion, verify user story granularity:**
249
-
250
- **Appropriate Granularity (completable in one iteration):**
251
- - Add a field and write migration
252
- - Add a UI component in existing page
253
- - Modify existing server-side logic
254
- - Add a filter condition to list page
255
-
256
- **Granularity Requiring Splitting:**
257
- - Implement a complete dashboard
258
- - Add a whole authentication/login system
259
- - Overall refactoring of existing APIs
260
- - Cross-domain changes involving multiple modules
261
-
262
- **IF stories need splitting → Update PRD before proceeding.**
263
-
264
- ## Step 6: Determine Storage Path & Write Master PRD
265
-
266
- ### 6.1 Determine Path
267
-
268
- **Single PRD Structure:**
269
- ```
270
- {iteration_path}/01.product-requirement/{feature-name}-prd.md
271
- ```
272
-
273
- **Master-Sub PRD Structure:**
274
- ```
275
- {iteration_path}/01.product-requirement/
276
- ├── {feature-name}-prd.md
277
- ├── {feature-name}-sub-{module1-key}.md
278
- ├── {feature-name}-sub-{module2-key}.md
279
- └── ...
280
- ```
281
-
282
- ### 6.2 Plan File List
283
-
284
- **For Single PRD:**
285
-
286
- | # | File | Path |
287
- |---|------|------|
288
- | 1 | PRD | {iteration}/01.product-requirement/{feature-name}-prd.md |
289
-
290
- **For Master-Sub:**
291
-
292
- | # | File Type | Module | Path |
293
- |---|-----------|--------|------|
294
- | 1 | Master PRD | (system overview) | {iteration}/01.product-requirement/{feature-name}-prd.md |
295
- | 2 | Sub-PRD | {module-1} | {iteration}/01.product-requirement/{feature-name}-sub-{module-1-key}.md |
296
- | ... | ... | ... | ... |
297
-
298
- > ⚠️ **Present file list to user for confirmation before writing.**
299
-
300
- ### 6.3 Write Master PRD
301
-
302
- **For Single PRD — fill ALL sections with full detail.**
303
-
304
- **For Master-Sub — fill system-level overview ONLY:**
305
-
306
- > ⚠️ **Master PRD = System Overview ONLY. Module details go into Sub-PRDs.**
307
-
308
- - Section 1: System-wide background (2-3 paragraphs max)
309
- - Section 2.1: All user roles with brief descriptions
310
- - Section 2.2: 3-5 HIGH-LEVEL system stories (module-level capabilities)
311
- - Section 3.1: System-level use case diagram
312
- - Section 3.2: ONE cross-module end-to-end process flow
313
- - Section 3.3: ONE row per MODULE (not per feature)
314
- - Section 3.4: "See individual Sub-PRDs"
315
- - Section 4: System-wide NFRs (1 line each)
316
- - Section 5: System-wide milestones only
317
- - Section 8: Module list, dependency matrix, implementation phases
318
- - Section 9: Sub-PRD Index (all file paths)
319
-
320
- ## Step 7: Generate Dispatch Plan & Return
321
-
322
- **IF Master-Sub Structure:**
323
-
324
- > ⚠️ **CRITICAL — Sub-PRD Generation Rules:**
325
- > 1. **DO NOT generate Sub-PRD files in this Skill** — output dispatch plan ONLY
326
- > 2. **DO NOT skip Sub-PRD generation** — Sub-PRDs are REQUIRED
327
- > 3. **RETURN control to PM Agent for Phase 4 execution**
328
-
329
- **Output Sub-PRD Dispatch Plan:**
330
-
331
- | # | Module | module_key | Sub-PRD Path | Feature Count |
332
- |---|--------|-----------|--------------|---------------|
333
- | 1 | {module-1-name} | {module-1-key} | {feature-name}-sub-{module-1-key}.md | {count} |
334
- | 2 | {module-2-name} | {module-2-key} | {feature-name}-sub-{module-2-key}.md | {count} |
335
- | ... | ... | ... | ... | ... |
336
-
337
- **For each module, provide context:**
338
-
339
- ```json
340
- {
341
- "module_name": "Module Name",
342
- "module_key": "module-key",
343
- "module_scope": "What this module covers",
344
- "module_entities": ["Entity1", "Entity2"],
345
- "module_user_stories": ["Story 1", "Story 2"],
346
- "module_requirements": ["Requirement in business language"],
347
- "module_features": [
348
- {
349
- "feature_id": "F-MOD-01",
350
- "feature_name": "Feature Name",
351
- "type": "User Interaction",
352
- "priority": "P0",
353
- "description": "Business description"
354
- }
355
- ],
356
- "module_dependencies": ["Depends on module X for Y"]
357
- }
358
- ```
359
-
360
- > ⚠️ **MANDATORY: Content Boundary Constraint for Workers**
361
- > "PM Stage Content Boundary applies — NO API definitions, NO database structures, NO code snippets. Use BUSINESS LANGUAGE ONLY."
362
-
363
- **Return message:**
364
- ```
365
- → MANDATORY: RETURN to PM Agent Phase 4 (Sub-PRD Worker Dispatch)
366
- → PM Agent invokes speccrew-task-worker for each module
367
- → Each worker uses speccrew-pm-sub-prd-generate/SKILL.md
368
- → After ALL workers complete → PM Agent executes Phase 5 Verification
369
- ```
370
-
371
- 🛑 **CRITICAL HANDOFF — PM Agent MUST NOT:**
372
- - Generate Sub-PRD files directly
373
- - Invoke speccrew-pm-sub-prd-generate as its own operation
374
- - Create Sub-PRD content using create_file or any file write
375
- - Skip speccrew-task-worker and directly produce Sub-PRD documents
376
-
377
- **PM Agent MUST:**
378
- 1. Use Dispatch Plan above to invoke speccrew-task-worker for EACH module
379
- 2. Each worker uses skill_path: speccrew-pm-sub-prd-generate/SKILL.md
380
- 3. Initialize DISPATCH-PROGRESS.json via update-progress.js script (NOT manually)
381
- 4. After ALL workers complete → Execute Phase 5 Verification
382
-
383
- **IF Single PRD Structure:** Skip dispatch plan (no Sub-PRDs needed).
43
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
384
44
 
385
45
  ---
386
46
 
@@ -0,0 +1,174 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="requirement-analysis-main" status="pending" version="1.0" desc="Generate PRD documents from clarified requirements and module design">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="iteration_path" required="true" type="string" desc="Path to iteration directory"/>
9
+ <field name="clarification_file" required="false" type="string" desc="Path to clarification summary (default: {iteration_path}/01.product-requirement/.clarification-summary.md)"/>
10
+ <field name="module_design_file" required="false" type="string" desc="Path to module design (default: {iteration_path}/01.product-requirement/.module-design.md)"/>
11
+ <field name="language" required="true" type="string" desc="Language code for generated content"/>
12
+ </block>
13
+
14
+ <!-- ============================================================
15
+ Global Constraints
16
+ ============================================================ -->
17
+ <block type="rule" id="R1" level="forbidden" desc="Document generation constraints">
18
+ <field name="text">FORBIDDEN: create_file for documents - use search_replace on templates</field>
19
+ <field name="text">FORBIDDEN: Full-file rewrite - use targeted search_replace</field>
20
+ <field name="text">MANDATORY: Template-first workflow</field>
21
+ </block>
22
+
23
+ <block type="rule" id="R2" level="forbidden" desc="Content boundary constraints">
24
+ <field name="text">DO NOT include: API definitions, DB structures, code snippets, technical terminology</field>
25
+ <field name="text">These belong to: Feature Designer or System Designer</field>
26
+ <field name="text">Required: Use BUSINESS LANGUAGE only</field>
27
+ </block>
28
+
29
+ <block type="rule" id="R3" level="forbidden" desc="Sub-PRD generation constraints">
30
+ <field name="text">DO NOT generate Sub-PRD files in this Skill - output dispatch plan ONLY</field>
31
+ <field name="text">DO NOT skip Sub-PRD generation - Sub-PRDs are REQUIRED</field>
32
+ <field name="text">RETURN control to PM Agent for Phase 4 execution</field>
33
+ </block>
34
+
35
+ <!-- ============================================================
36
+ Main Processing Sequence
37
+ ============================================================ -->
38
+ <sequence id="S1" name="PRD Generation" status="pending" desc="Generate PRD from clarification and modeling artifacts">
39
+
40
+ <!-- Step 1: Verify Prerequisites -->
41
+ <block type="task" id="B1" action="read-file" desc="Read clarification summary">
42
+ <field name="path" value="${clarification_file}"/>
43
+ <field name="output" var="clarification_content"/>
44
+ </block>
45
+
46
+ <block type="task" id="B2" action="read-file" desc="Read module design">
47
+ <field name="path" value="${module_design_file}"/>
48
+ <field name="output" var="module_design_content"/>
49
+ </block>
50
+
51
+ <!-- Gateway: Validate prerequisites -->
52
+ <block type="gateway" id="G1" mode="guard" desc="Verify both prerequisite files exist"
53
+ test="${clarification_content} != null AND ${module_design_content} != null"
54
+ fail-action="stop">
55
+ <field name="message">ERROR: Prerequisite files not found. Both .clarification-summary.md AND .module-design.md MUST exist. Run speccrew-pm-requirement-clarify and speccrew-pm-requirement-model first.</field>
56
+ </block>
57
+
58
+ <!-- Step 2: Extract module information -->
59
+ <block type="task" id="B3" action="analyze" desc="Extract module count and list from module design">
60
+ <field name="input" value="${module_design_content}"/>
61
+ <field name="extract">
62
+ - Module count from "## Module List (Total: N modules)" heading
63
+ - Module list from Module List table
64
+ - Dependency matrix from Dependency Matrix table
65
+ - Implementation phases from Implementation Phases section
66
+ </field>
67
+ <field name="output" var="module_info"/>
68
+ </block>
69
+
70
+ <!-- Step 3: Read PRD Template -->
71
+ <block type="task" id="B4" action="run-script" desc="Search for PRD template">
72
+ <field name="command">Get-ChildItem -Path "." -Recurse -Filter "PRD-TEMPLATE.md" | Where-Object { $_.FullName -like "*speccrew-pm-requirement-analysis*" } | Select-Object -First 1 -ExpandProperty FullName</field>
73
+ <field name="output" var="template_path"/>
74
+ </block>
75
+
76
+ <block type="task" id="B5" action="read-file" desc="Read PRD template">
77
+ <field name="path" value="${template_path}"/>
78
+ <field name="output" var="template_content"/>
79
+ </block>
80
+
81
+ <!-- Step 4: Determine PRD Structure -->
82
+ <block type="gateway" id="G2" mode="exclusive" desc="Determine PRD structure based on module count">
83
+ <branch test="${module_info.count} >= 2" name="Master-Sub Structure">
84
+ <block type="task" id="B6" action="analyze" desc="Set Master-Sub structure">
85
+ <field name="set_var" name="prd_structure" value="master-sub"/>
86
+ <field name="set_var" name="sub_prd_count" value="${module_info.count}"/>
87
+ </block>
88
+ </branch>
89
+ <branch test="${module_info.count} < 2" name="Single PRD Structure" default="true">
90
+ <block type="task" id="B7" action="analyze" desc="Set Single PRD structure">
91
+ <field name="set_var" name="prd_structure" value="single"/>
92
+ </block>
93
+ </branch>
94
+ </block>
95
+
96
+ <!-- Step 5: Write Master PRD -->
97
+ <block type="task" id="B8" action="generate" desc="Generate Master PRD content">
98
+ <field name="template" value="${template_content}"/>
99
+ <field name="fill_sections">
100
+ - Section 1: Background & Goals (system-wide)
101
+ - Section 2: User Stories (high-level)
102
+ - Section 3: Functional Requirements (system-level)
103
+ - Section 4: Non-functional Requirements (system-wide)
104
+ - Section 5: Acceptance Criteria
105
+ - Section 8: Module list, dependency matrix, implementation phases
106
+ - Section 9: Sub-PRD Index (if Master-Sub)
107
+ </field>
108
+ <field name="use_business_language_only">true</field>
109
+ <field name="output_path" value="${iteration_path}/01.product-requirement/{feature-name}-prd.md"/>
110
+ <field name="output" var="master_prd_path"/>
111
+ </block>
112
+
113
+ <!-- Checkpoint: Master PRD written -->
114
+ <block type="checkpoint" id="CP1" name="master-prd-written" desc="Verify Master PRD created">
115
+ <field name="file" value="${master_prd_path}"/>
116
+ <field name="verify" value="file_exists(${master_prd_path})"/>
117
+ </block>
118
+
119
+ <!-- Step 6: Generate Dispatch Plan (if Master-Sub) -->
120
+ <block type="gateway" id="G3" mode="exclusive" desc="Generate dispatch plan if Master-Sub structure">
121
+ <branch test="${prd_structure} == 'master-sub'" name="Generate Dispatch Plan">
122
+ <block type="loop" id="L1" over="${module_info.modules}" as="module" desc="Build dispatch context for each module">
123
+ <block type="task" id="B9" action="analyze" desc="Build module context">
124
+ <field name="build_context">
125
+ module_id: M{index}
126
+ module_name: ${module.name}
127
+ module_key: ${module.key}
128
+ module_scope: ${module.scope}
129
+ module_entities: ${module.entities}
130
+ module_user_stories: ${module.user_stories}
131
+ module_requirements: ${module.requirements}
132
+ module_features: ${module.features}
133
+ module_dependencies: ${module.dependencies}
134
+ </field>
135
+ <field name="output" var="module_context"/>
136
+ </block>
137
+ </block>
138
+
139
+ <block type="task" id="B10" action="analyze" desc="Compile dispatch plan">
140
+ <field name="compile">
141
+ dispatch_plan: Array of module contexts
142
+ master_prd_path: ${master_prd_path}
143
+ template_path: ${template_path}
144
+ output_base_path: ${iteration_path}/01.product-requirement
145
+ feature_name: {extracted from clarification}
146
+ </field>
147
+ <field name="output" var="dispatch_plan"/>
148
+ </block>
149
+
150
+ <block type="event" id="E1" action="log" level="info" desc="Log handoff to PM Agent">
151
+ <field name="message">MANDATORY: RETURN to PM Agent Phase 4 (Sub-PRD Worker Dispatch). PM Agent invokes speccrew-task-worker for each module. Each worker uses speccrew-pm-sub-prd-generate/SKILL.md. After ALL workers complete -> PM Agent executes Phase 5 Verification.</field>
152
+ </block>
153
+ </branch>
154
+ <branch test="${prd_structure} == 'single'" name="Single PRD - Skip Dispatch">
155
+ <block type="event" id="E2" action="log" level="info" desc="Log single PRD completion">
156
+ <field name="message">Single PRD structure - no Sub-PRDs needed. PRD generation complete.</field>
157
+ </block>
158
+ </branch>
159
+ </block>
160
+
161
+ </sequence>
162
+
163
+ <!-- ============================================================
164
+ Output Results
165
+ ============================================================ -->
166
+ <block type="output" id="O1" desc="Workflow output results">
167
+ <field name="master_prd_path" from="${master_prd_path}" type="string" desc="Path to generated Master PRD"/>
168
+ <field name="prd_structure" from="${prd_structure}" type="string" desc="PRD structure type: single or master-sub"/>
169
+ <field name="dispatch_plan" from="${dispatch_plan}" type="object" desc="Sub-PRD dispatch plan (if Master-Sub)"/>
170
+ <field name="module_count" from="${module_info.count}" type="number" desc="Number of modules"/>
171
+ <field name="message" value="PRD generation complete" type="string" desc="Status message"/>
172
+ </block>
173
+
174
+ </workflow>
@@ -36,99 +36,11 @@ PM Agent (speccrew-product-manager)
36
36
  - Risk level with specific factors
37
37
  - Recommended workflow path (simple PRD vs full ISA-95 modeling)
38
38
 
39
- ## Assessment Workflow
39
+ ## AgentFlow Definition
40
40
 
41
- ### Step 1: Understand the Requirement
41
+ <!-- @agentflow: workflow.agentflow.xml -->
42
42
 
43
- Analyze the new requirement:
44
- - What business problem does it solve?
45
- - What entities are involved?
46
- - What processes are affected?
47
-
48
- ### Step 2: Load System Context
49
-
50
- #### 2.1 Read System Overview
51
-
52
- ```
53
- speccrew-workspace/knowledges/bizs/system-overview.md
54
- ```
55
-
56
- Identify:
57
- - Which business domain the requirement belongs to
58
- - Which modules are potentially related
59
- - Which business processes are involved
60
-
61
- #### 2.2 Load Related Module Overviews
62
-
63
- For each potentially affected module:
64
- ```
65
- speccrew-workspace/knowledges/bizs/{module-name}/{module-name}-overview.md
66
- ```
67
-
68
- #### 2.3 Query Knowledge Graph (for cross-module analysis)
69
-
70
- Use `speccrew-knowledge-graph-query` skill to trace dependencies:
71
-
72
- | Action | Use Case |
73
- |--------|----------|
74
- | `search` | Find entities related to requirement keywords |
75
- | `trace-upstream` | What depends on the affected entities? |
76
- | `trace-downstream` | What do the affected entities depend on? |
77
- | `query-nodes` | List all entities in a suspected module |
78
-
79
- ### Step 3: Determine Change Type
80
-
81
- Use decision tree:
82
-
83
- ```
84
- New Requirement
85
- |
86
- +-- Involves new business entity?
87
- | +-- NEW FEATURE
88
- |
89
- +-- Modifies core attributes of existing entity?
90
- | +-- MODIFICATION
91
- |
92
- +-- Adds new process steps but reuses existing entities?
93
- | +-- MIXED (New + Modify)
94
- |
95
- +-- Affects cross-module data flow?
96
- | +-- CROSS-MODULE CHANGE
97
- |
98
- +-- Can be handled by configuration?
99
- +-- CONFIGURATION
100
- ```
101
-
102
- ### Step 4: Identify Impact Scope
103
-
104
- Check for impact on:
105
- - **Direct modules**: Modules explicitly mentioned in requirement
106
- - **Dependency modules**: Upstream/downstream from graph query (Step 2.3)
107
- - **External integrations**: Third-party systems
108
- - **Data entities**: New or modified entities
109
-
110
- ### Step 5: Assess Risk Level
111
-
112
- | Risk Factor | High Risk Indicators |
113
- |-------------|---------------------|
114
- | Scope | Affects 3+ modules |
115
- | Data | Modifies core entity structure |
116
- | Integration | Changes external API contracts |
117
- | Process | Alters critical business flow |
118
- | State | Modifies entity state machine |
119
-
120
- ### Step 6: Recommend Workflow Path
121
-
122
- Based on assessment results, recommend the appropriate next step:
123
-
124
- | Assessment Result | Recommended Path |
125
- |-------------------|-----------------|
126
- | 1 module, low risk, clear domain | Simple PRD (skip ISA-95 modeling) |
127
- | 2+ modules, medium risk | Full requirement-analysis with ISA-95 modeling |
128
- | Cross-module, high risk | Full requirement-analysis with ISA-95 modeling + Master-Sub PRD |
129
- | Configuration only | Direct implementation, PRD optional |
130
-
131
- ### Step 7: Generate Assessment Report
43
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
132
44
 
133
45
  ## Assessment Report Template
134
46