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
@@ -0,0 +1,120 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="requirement-simple-main" status="pending" version="1.0" desc="Simple requirement analysis for lightweight changes">
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="feature_name" required="true" type="string" desc="Feature name for PRD file naming"/>
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="mandatory" desc="Execution constraints">
18
+ <field name="text">Verify .clarification-summary.md exists before proceeding</field>
19
+ <field name="text">Keep PRD concise - 1-3 page PRDs</field>
20
+ <field name="text">Use business language throughout</field>
21
+ <field name="text">Extract key decisions from clarification summary into PRD</field>
22
+ </block>
23
+
24
+ <block type="rule" id="R2" level="forbidden" desc="Content boundary constraints">
25
+ <field name="text">DO NOT include: API endpoint definitions, HTTP methods, request/response JSON</field>
26
+ <field name="text">DO NOT include: Design class diagrams, component diagrams, deployment diagrams</field>
27
+ <field name="text">DO NOT include: Database table structures, ER diagrams, SQL queries</field>
28
+ <field name="text">DO NOT include: Code snippets, pseudocode, implementation logic</field>
29
+ <field name="text">DO NOT include: Technical terminology (UUID, JWT, REST, Microservice, JSON)</field>
30
+ <field name="text">Required: Use business language only</field>
31
+ </block>
32
+
33
+ <block type="rule" id="R3" level="forbidden" desc="Workflow constraints">
34
+ <field name="text">Proceed without .clarification-summary.md</field>
35
+ <field name="text">Generate Master-Sub PRD structure</field>
36
+ <field name="text">Dispatch worker agents</field>
37
+ <field name="text">Wait for user confirmation (handled by PM Agent)</field>
38
+ <field name="text">Auto-transition to Feature Design stage</field>
39
+ </block>
40
+
41
+ <!-- ============================================================
42
+ Main Processing Sequence
43
+ ============================================================ -->
44
+ <sequence id="S1" name="Simple PRD Generation" status="pending" desc="Generate concise PRD for simple requirements">
45
+
46
+ <!-- Step 1: Read Clarification Summary -->
47
+ <block type="task" id="B1" action="read-file" desc="Read clarification summary">
48
+ <field name="path" value="${clarification_file}"/>
49
+ <field name="output" var="clarification_content"/>
50
+ </block>
51
+
52
+ <!-- Gateway: Validate prerequisite -->
53
+ <block type="gateway" id="G1" mode="guard" desc="Verify clarification file exists"
54
+ test="${clarification_content} != null"
55
+ fail-action="stop">
56
+ <field name="message">ERROR: .clarification-summary.md not found. Run speccrew-pm-requirement-clarify first.</field>
57
+ </block>
58
+
59
+ <!-- Verify complexity -->
60
+ <block type="gateway" id="G2" mode="guard" desc="Verify simple complexity"
61
+ test="${clarification_content.complexity} == 'simple'"
62
+ fail-action="stop">
63
+ <field name="message">Complexity is not 'simple'. Redirect to speccrew-pm-requirement-analysis for complex requirements.</field>
64
+ </block>
65
+
66
+ <!-- Step 2: Read PRD Template -->
67
+ <block type="task" id="B2" action="run-script" desc="Search for PRD template">
68
+ <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>
69
+ <field name="output" var="template_path"/>
70
+ </block>
71
+
72
+ <block type="task" id="B3" action="read-file" desc="Read PRD template">
73
+ <field name="path" value="${template_path}"/>
74
+ <field name="output" var="template_content"/>
75
+ </block>
76
+
77
+ <!-- Step 3: Generate Single PRD -->
78
+ <block type="task" id="B4" action="generate" desc="Generate single PRD">
79
+ <field name="template" value="${template_content}"/>
80
+ <field name="output_path" value="${iteration_path}/01.product-requirement/${feature_name}-prd.md"/>
81
+ <field name="fill_sections">
82
+ - Section 1: Background & Goals (2-3 sentences)
83
+ - Section 1.2: Domain Boundary (in-scope/out-of-scope)
84
+ - Section 1.3/1.4: Glossary (only if new terms)
85
+ - Section 2: User Stories (1-3 stories)
86
+ - Section 3: Functional Requirements (brief description)
87
+ - Section 3.3: Feature List (simple table, 1-5 rows)
88
+ - Section 3.4: Feature Breakdown (1-5 features, all P0)
89
+ - Section 4: Non-Functional Requirements (if relevant)
90
+ - Section 5: Acceptance Criteria (3-5 criteria)
91
+ - Section 6: Boundary (clear in/out scope)
92
+ - Section 7: Assumptions (if any)
93
+ </field>
94
+ <field name="use_business_language_only">true</field>
95
+ <field name="data">
96
+ clarification: ${clarification_content}
97
+ </field>
98
+ <field name="output" var="prd_path"/>
99
+ </block>
100
+
101
+ <!-- Checkpoint: PRD generated -->
102
+ <block type="checkpoint" id="CP1" name="prd-generated" desc="Verify PRD created">
103
+ <field name="file" value="${prd_path}"/>
104
+ <field name="verify" value="file_exists(${prd_path})"/>
105
+ </block>
106
+
107
+ </sequence>
108
+
109
+ <!-- ============================================================
110
+ Output Results
111
+ ============================================================ -->
112
+ <block type="output" id="O1" desc="Workflow output results">
113
+ <field name="prd_path" from="${prd_path}" type="string" desc="Path to generated PRD"/>
114
+ <field name="feature_name" from="${feature_name}" type="string" desc="Feature name"/>
115
+ <field name="scope" from="${clarification_content.scope}" type="string" desc="Brief scope from clarification"/>
116
+ <field name="complexity" value="simple" type="string" desc="Complexity level"/>
117
+ <field name="message" value="Simple PRD generation completed" type="string" desc="Status message"/>
118
+ </block>
119
+
120
+ </workflow>
@@ -51,7 +51,13 @@ tools: Read, Write, Glob, Grep
51
51
  1. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
52
52
  2. **MANDATORY: Template-first workflow** — Copy template MUST execute before filling sections.
53
53
 
54
- # Workflow
54
+ # AgentFlow Definition
55
+
56
+ <!-- @agentflow: workflow.agentflow.xml -->
57
+
58
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
59
+
60
+ ---
55
61
 
56
62
  ## Step 1: Load Context
57
63
 
@@ -0,0 +1,218 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="sub-prd-generate-main" status="pending" version="1.0" desc="Generate a single Sub-PRD document for one module">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="module_id" required="true" type="string" desc="Module ID for feature registry (e.g., M1, M2)"/>
9
+ <field name="module_name" required="true" type="string" desc="Human-readable module name (e.g., Customer Management)"/>
10
+ <field name="module_key" required="true" type="string" desc="Module identifier for file naming (e.g., customer)"/>
11
+ <field name="module_scope" required="true" type="string" desc="What this module covers"/>
12
+ <field name="module_entities" required="true" type="array" desc="Core business entities in this module"/>
13
+ <field name="module_user_stories" required="true" type="array" desc="User stories specific to this module"/>
14
+ <field name="module_requirements" required="true" type="array" desc="Functional requirements for this module (P0/P1/P2)"/>
15
+ <field name="module_features" required="true" type="array" desc="Feature Breakdown entries for this module"/>
16
+ <field name="module_dependencies" required="false" type="array" desc="Dependencies on other modules"/>
17
+ <field name="master_prd_path" required="true" type="string" desc="Path to the Master PRD (for cross-referencing)"/>
18
+ <field name="feature_name" required="true" type="string" desc="System-level feature name (for file naming prefix)"/>
19
+ <field name="template_path" required="true" type="string" desc="Path to PRD-TEMPLATE.md"/>
20
+ <field name="output_path" required="true" type="string" desc="Full path for the Sub-PRD output file"/>
21
+ <field name="language" required="true" type="string" desc="Language code for generated content"/>
22
+ </block>
23
+
24
+ <!-- ============================================================
25
+ Global Constraints
26
+ ============================================================ -->
27
+ <block type="rule" id="R1" level="forbidden" desc="Content boundary constraints">
28
+ <field name="text">NO API endpoint definitions, HTTP methods, request/response JSON</field>
29
+ <field name="text">NO Database table structures, ER diagrams, SQL queries</field>
30
+ <field name="text">NO Design class diagrams, component diagrams, deployment diagrams</field>
31
+ <field name="text">NO Code snippets, pseudocode, implementation logic</field>
32
+ <field name="text">NO Technical terminology (UUID, JWT, REST, Microservice, JSON)</field>
33
+ <field name="text">Required: Use BUSINESS LANGUAGE ONLY</field>
34
+ </block>
35
+
36
+ <block type="rule" id="R2" level="forbidden" desc="Document generation constraints">
37
+ <field name="text">FORBIDDEN: Full-file rewrite - NEVER replace entire document content</field>
38
+ <field name="text">MANDATORY: Template-first workflow - Copy template before filling sections</field>
39
+ </block>
40
+
41
+ <!-- ============================================================
42
+ Main Processing Sequence
43
+ ============================================================ -->
44
+ <sequence id="S1" name="Sub-PRD Generation" status="pending" desc="Generate Sub-PRD for a single module">
45
+
46
+ <!-- Step 1: Load Context -->
47
+ <block type="task" id="B1" action="read-file" desc="Read Master PRD">
48
+ <field name="path" value="${master_prd_path}"/>
49
+ <field name="output" var="master_prd_content"/>
50
+ </block>
51
+
52
+ <block type="task" id="B2" action="read-file" desc="Read PRD template">
53
+ <field name="path" value="${template_path}"/>
54
+ <field name="output" var="template_content"/>
55
+ </block>
56
+
57
+ <!-- Step 2: Create Sub-PRD File -->
58
+ <block type="task" id="B3" action="write-file" desc="Copy template to output path">
59
+ <field name="path" value="${output_path}"/>
60
+ <field name="content" value="${template_content}"/>
61
+ <field name="replace_title" from="# PRD - [Feature Name]" to="# Sub-PRD - ${module_name}"/>
62
+ <field name="output" var="sub_prd_created"/>
63
+ </block>
64
+
65
+ <!-- Step 3: Phase A - Skeleton Construction -->
66
+ <block type="task" id="B4" action="analyze" desc="Phase A: Build skeleton for all features">
67
+ <field name="input" value="${module_features}"/>
68
+ <field name="for_each_feature">
69
+ - Create #### Feature N: {feature_name}
70
+ - Add 6 sub-section headers:
71
+ * Requirement Description: [TO BE FILLED]
72
+ * Interaction Flow: [TO BE FILLED]
73
+ * Boundary Conditions: [TO BE FILLED]
74
+ * Exception Scenarios: [TO BE FILLED]
75
+ * Operation Flow Diagram: [TO BE FILLED]
76
+ * Operation Steps Detail: [TO BE FILLED]
77
+ </field>
78
+ <field name="output" var="skeleton_built"/>
79
+ </block>
80
+
81
+ <!-- Gateway: Verify skeleton complete -->
82
+ <block type="gateway" id="G1" mode="guard" desc="Verify all features have skeleton"
83
+ test="${skeleton_built.complete} == true"
84
+ fail-action="stop">
85
+ <field name="message">Skeleton construction incomplete. All features must have all 6 sub-sections.</field>
86
+ </block>
87
+
88
+ <!-- Step 4: Phase B - Content Filling -->
89
+ <block type="loop" id="L1" over="${module_features}" as="feature" desc="Fill content for each feature">
90
+ <block type="task" id="B5" action="search_replace" desc="Fill Requirement Description">
91
+ <field name="path" value="${output_path}"/>
92
+ <field name="replace">[TO BE FILLED] in Requirement Description section for ${feature.name}</field>
93
+ <field name="with">Business requirements in business language</field>
94
+ </block>
95
+
96
+ <block type="task" id="B6" action="search_replace" desc="Fill Interaction Flow">
97
+ <field name="path" value="${output_path}"/>
98
+ <field name="replace">[TO BE FILLED] in Interaction Flow section for ${feature.name}</field>
99
+ <field name="with">User interaction steps (numbered list)</field>
100
+ </block>
101
+
102
+ <block type="task" id="B7" action="search_replace" desc="Fill Boundary Conditions">
103
+ <field name="path" value="${output_path}"/>
104
+ <field name="replace">[TO BE FILLED] in Boundary Conditions section for ${feature.name}</field>
105
+ <field name="with">Table: Condition Type | Scenario | Handling Rule</field>
106
+ </block>
107
+
108
+ <block type="task" id="B8" action="search_replace" desc="Fill Exception Scenarios">
109
+ <field name="path" value="${output_path}"/>
110
+ <field name="replace">[TO BE FILLED] in Exception Scenarios section for ${feature.name}</field>
111
+ <field name="with">Bullet list of exception handling</field>
112
+ </block>
113
+
114
+ <block type="task" id="B9" action="search_replace" desc="Fill Operation Flow Diagram">
115
+ <field name="path" value="${output_path}"/>
116
+ <field name="replace">[TO BE FILLED] in Operation Flow Diagram section for ${feature.name}</field>
117
+ <field name="with">Mermaid graph LR diagram showing operation flow</field>
118
+ </block>
119
+
120
+ <block type="task" id="B10" action="search_replace" desc="Fill Operation Steps Detail">
121
+ <field name="path" value="${output_path}"/>
122
+ <field name="replace">[TO BE FILLED] in Operation Steps Detail section for ${feature.name}</field>
123
+ <field name="with">Table: Step | Action | Expected Outcome | Exception Handling</field>
124
+ </block>
125
+ </block>
126
+
127
+ <!-- Step 5: Fill remaining sections -->
128
+ <block type="task" id="B11" action="search_replace" desc="Fill Section 1: Background & Goals">
129
+ <field name="path" value="${output_path}"/>
130
+ <field name="sections">
131
+ - 1.1 Background: Why this module exists
132
+ - 1.2 Goals: Module-specific business objectives
133
+ </field>
134
+ </block>
135
+
136
+ <block type="task" id="B12" action="search_replace" desc="Fill Section 2: User Stories">
137
+ <field name="path" value="${output_path}"/>
138
+ <field name="sections">
139
+ - 2.1 Target Users
140
+ - 2.2 User Scenarios in As a/I want/So that format
141
+ </field>
142
+ </block>
143
+
144
+ <block type="task" id="B13" action="search_replace" desc="Fill Section 3: Functional Requirements">
145
+ <field name="path" value="${output_path}"/>
146
+ <field name="sections">
147
+ - 3.1 Use Case Diagram (Mermaid flowchart TB)
148
+ - 3.2 Business Process Flow
149
+ - 3.3 Feature List with P0/P1/P2
150
+ - 3.4 Feature Breakdown (REQUIRED)
151
+ - 3.5 Feature Details (all 6 sub-sections per feature)
152
+ </field>
153
+ </block>
154
+
155
+ <block type="task" id="B14" action="search_replace" desc="Fill remaining sections">
156
+ <field name="path" value="${output_path}"/>
157
+ <field name="sections">
158
+ - Section 4: Non-functional Requirements
159
+ - Section 5: Acceptance Criteria
160
+ - Section 6: Boundary Description
161
+ - Section 7: Assumptions & Dependencies
162
+ </field>
163
+ </block>
164
+
165
+ <!-- Step 6: Verify Output -->
166
+ <block type="task" id="B15" action="read-file" desc="Verify generated Sub-PRD">
167
+ <field name="path" value="${output_path}"/>
168
+ <field name="output" var="sub_prd_content"/>
169
+ </block>
170
+
171
+ <block type="gateway" id="G2" mode="guard" desc="Verify Sub-PRD is valid"
172
+ test="${sub_prd_content.length} > 3000 AND ${sub_prd_content} contains 'Feature Breakdown'"
173
+ fail-action="stop">
174
+ <field name="message">Sub-PRD verification failed: File too small or missing Feature Breakdown</field>
175
+ </block>
176
+
177
+ <!-- Step 7: Write Module Features to Feature List -->
178
+ <block type="task" id="B16" action="analyze" desc="Build feature list entry">
179
+ <field name="feature_list_path" value="dirname(${output_path})/.prd-feature-list.json"/>
180
+ <field name="build_entry">
181
+ module_id: ${module_id}
182
+ module_name: ${module_name}
183
+ module_key: ${module_key}
184
+ source_prd: ${feature_name}-sub-${module_key}.md
185
+ feature_count: ${module_features.length}
186
+ features: ${module_features}
187
+ </field>
188
+ <field name="output" var="feature_list_entry"/>
189
+ </block>
190
+
191
+ <block type="task" id="B17" action="write-file" desc="Update feature list file">
192
+ <field name="path" value="${feature_list_path}"/>
193
+ <field name="merge">true</field>
194
+ <field name="entry" value="${feature_list_entry}"/>
195
+ <field name="output" var="feature_list_updated"/>
196
+ </block>
197
+
198
+ <!-- Checkpoint: Sub-PRD complete -->
199
+ <block type="checkpoint" id="CP1" name="sub-prd-complete" desc="Verify Sub-PRD generation completed">
200
+ <field name="file" value="${output_path}"/>
201
+ <field name="verify" value="file_exists(${output_path})"/>
202
+ </block>
203
+
204
+ </sequence>
205
+
206
+ <!-- ============================================================
207
+ Output Results
208
+ ============================================================ -->
209
+ <block type="output" id="O1" desc="Workflow output results">
210
+ <field name="sub_prd_path" from="${output_path}" type="string" desc="Path to generated Sub-PRD"/>
211
+ <field name="module_id" from="${module_id}" type="string" desc="Module ID"/>
212
+ <field name="module_name" from="${module_name}" type="string" desc="Module name"/>
213
+ <field name="feature_count" from="${module_features.length}" type="number" desc="Number of features"/>
214
+ <field name="feature_list_updated" from="${feature_list_updated}" type="boolean" desc="Whether feature list was updated"/>
215
+ <field name="message" value="Sub-PRD generation completed" type="string" desc="Status message"/>
216
+ </block>
217
+
218
+ </workflow>
@@ -10,7 +10,13 @@ tools: Read, Write, Glob, Grep
10
10
  - System Designer Agent receives task to create backend detailed design for a specific platform
11
11
  - User asks "Design backend implementation" or "Create backend design for {platform}"
12
12
 
13
- # Workflow
13
+ ## AgentFlow Definition
14
+
15
+ <!-- @agentflow: workflow.agentflow.xml -->
16
+
17
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
18
+
19
+ ## Workflow
14
20
 
15
21
  ## Absolute Constraints
16
22
 
@@ -0,0 +1,264 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="sd-backend-main" status="pending" version="1.0" desc="Backend System Design workflow">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="feature_id" required="false" type="string" desc="Feature identifier, e.g., F-CRM-01"/>
9
+ <field name="feature_name" required="true" type="string" desc="Feature name, e.g., customer-list"/>
10
+ <field name="platform_id" required="true" type="string" desc="Target platform, e.g., backend-spring, backend-nestjs"/>
11
+ <field name="iteration_path" required="true" type="string" desc="Absolute path to iteration directory"/>
12
+ <field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew-workspace"/>
13
+ <field name="task_id" required="false" type="string" desc="Task ID from dispatch context"/>
14
+ </block>
15
+
16
+ <!-- ============================================================
17
+ Global Constraints
18
+ ============================================================ -->
19
+ <block type="rule" id="R1" level="forbidden" desc="Document creation constraints">
20
+ <field name="text">NEVER use create_file to write design documents or INDEX directly</field>
21
+ <field name="text">MUST create by copying template then filling with search_replace</field>
22
+ </block>
23
+
24
+ <block type="rule" id="R2" level="forbidden" desc="Full-file rewrite prohibition">
25
+ <field name="text">NEVER replace entire document content in single operation</field>
26
+ <field name="text">ALWAYS use targeted search_replace on specific sections</field>
27
+ </block>
28
+
29
+ <block type="rule" id="R3" level="mandatory" desc="Template-first workflow">
30
+ <field name="text">Copy template MUST execute before fill sections</field>
31
+ <field name="text">Skipping copy and writing content directly is FORBIDDEN</field>
32
+ </block>
33
+
34
+ <block type="rule" id="R4" level="mandatory" desc="Actual framework syntax">
35
+ <field name="text">All pseudo-code MUST use actual framework/library syntax from techs knowledge</field>
36
+ <field name="text">NOT generic pseudo-code</field>
37
+ </block>
38
+
39
+ <!-- ============================================================
40
+ Main Processing Sequence
41
+ ============================================================ -->
42
+ <sequence id="S1" name="Backend System Design" status="pending" desc="Generate backend detailed design documents">
43
+
44
+ <!-- Step 1: Read Inputs -->
45
+ <block type="task" id="B1" action="read-file" desc="Read Feature Spec document">
46
+ <field name="path">${iteration_path}/02.feature-design/${feature_id}-${feature_name}-feature-spec.md</field>
47
+ <field name="fallback_path">${iteration_path}/02.feature-design/${feature_name}-feature-spec.md</field>
48
+ <field name="output" var="feature_spec"/>
49
+ </block>
50
+
51
+ <block type="task" id="B2" action="read-file" desc="Read API Contract">
52
+ <field name="path">${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md</field>
53
+ <field name="fallback_path">${iteration_path}/02.feature-design/${feature_name}-api-contract.md</field>
54
+ <field name="output" var="api_contract"/>
55
+ </block>
56
+
57
+ <!-- Read Techs Knowledge -->
58
+ <block type="task" id="B3" action="read-file" desc="Read tech-stack.md">
59
+ <field name="path">${workspace_path}/knowledges/techs/${platform_id}/tech-stack.md</field>
60
+ <field name="output" var="tech_stack"/>
61
+ </block>
62
+
63
+ <block type="task" id="B4" action="read-file" desc="Read architecture.md">
64
+ <field name="path">${workspace_path}/knowledges/techs/${platform_id}/architecture.md</field>
65
+ <field name="output" var="architecture"/>
66
+ </block>
67
+
68
+ <block type="task" id="B5" action="read-file" desc="Read conventions-design.md">
69
+ <field name="path">${workspace_path}/knowledges/techs/${platform_id}/conventions-design.md</field>
70
+ <field name="output" var="conventions_design"/>
71
+ </block>
72
+
73
+ <block type="task" id="B6" action="read-file" desc="Read conventions-dev.md">
74
+ <field name="path">${workspace_path}/knowledges/techs/${platform_id}/conventions-dev.md</field>
75
+ <field name="output" var="conventions_dev"/>
76
+ </block>
77
+
78
+ <block type="task" id="B7" action="read-file" desc="Read conventions-data.md">
79
+ <field name="path">${workspace_path}/knowledges/techs/${platform_id}/conventions-data.md</field>
80
+ <field name="output" var="conventions_data"/>
81
+ </block>
82
+
83
+ <!-- Step 2: Analyze Existing Code Structure -->
84
+ <block type="task" id="B8" action="analyze" desc="Analyze codebase structure">
85
+ <field name="analysis_targets">
86
+ - Controller/Router layer structure
87
+ - Service layer organization
88
+ - Repository/DAO layer patterns
89
+ - Entity/Model definitions
90
+ - Middleware stack
91
+ - Exception handling patterns
92
+ - Database migration structure
93
+ - Naming conventions
94
+ </field>
95
+ <field name="output" var="codebase_analysis"/>
96
+ </block>
97
+
98
+ <!-- Step 3: Extract Functions from Feature Spec -->
99
+ <block type="task" id="B9" action="analyze" desc="Extract backend functions">
100
+ <field name="input" value="${feature_spec}">${api_contract}</field>
101
+ <field name="extraction_rules">
102
+ - Parse Feature Spec Section 2.N pattern
103
+ - Extract API interfaces from backend part
104
+ - Extract data access requirements
105
+ - Extract business logic flow
106
+ - Extract cross-module dependencies
107
+ - Mark each function as [EXISTING], [MODIFIED], or [NEW]
108
+ </field>
109
+ <field name="output" var="extracted_functions"/>
110
+ </block>
111
+
112
+ <!-- Checkpoint A: Present function list for confirmation -->
113
+ <block type="event" id="E1" action="confirm" title="Function List Confirmation" type="yesno" desc="Present function extraction summary">
114
+ <field name="preview">Backend Functions Extracted for: ${feature_name}
115
+ Platform: ${platform_id}
116
+
117
+ Function List:
118
+ ${extracted_functions.summary}
119
+
120
+ Markers:
121
+ - [NEW]: ${extracted_functions.new_count} modules
122
+ - [MODIFIED]: ${extracted_functions.modified_count} modules
123
+ - [EXISTING]: ${extracted_functions.existing_count} modules (no design needed)
124
+
125
+ Confirm function list before proceeding?</field>
126
+ </block>
127
+
128
+ <!-- Step 4: Generate Module Design Documents -->
129
+ <block type="task" id="B10" action="read-file" desc="Read design template">
130
+ <field name="path">speccrew-sd-backend/templates/SD-BACKEND-TEMPLATE.md</field>
131
+ <field name="output" var="design_template"/>
132
+ </block>
133
+
134
+ <!-- Loop: Generate design for each function -->
135
+ <block type="loop" id="L1" over="${extracted_functions.functions}" as="function" desc="Generate module design documents">
136
+ <block type="task" id="B11" action="generate" desc="Copy template and create document">
137
+ <field name="template" value="${design_template}"/>
138
+ <field name="placeholders">
139
+ - {Module Name} → ${function.module_name}
140
+ - {Feature Name} → ${feature_name}
141
+ - {Platform ID} → ${platform_id}
142
+ </field>
143
+ <field name="output_path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
144
+ <field name="output" var="module_doc_created"/>
145
+ </block>
146
+
147
+ <block type="task" id="B12" action="edit-file" desc="Fill Module Structure section">
148
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
149
+ <field name="operation">search_replace</field>
150
+ <field name="content_source">${tech_stack}${conventions_design}</field>
151
+ <field name="section">Module Structure</field>
152
+ </block>
153
+
154
+ <block type="task" id="B13" action="edit-file" desc="Fill Interface Pseudo-code section">
155
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
156
+ <field name="operation">search_replace</field>
157
+ <field name="content_source">${api_contract}${conventions_dev}</field>
158
+ <field name="section">Interface Pseudo-code</field>
159
+ </block>
160
+
161
+ <block type="task" id="B14" action="edit-file" desc="Fill Database Design section">
162
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
163
+ <field name="operation">search_replace</field>
164
+ <field name="content_source">${feature_spec}${conventions_data}</field>
165
+ <field name="section">Database Design</field>
166
+ </block>
167
+
168
+ <block type="task" id="B15" action="edit-file" desc="Fill Transaction Boundaries section">
169
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
170
+ <field name="operation">search_replace</field>
171
+ <field name="content_source">${conventions_data}</field>
172
+ <field name="section">Transaction Boundaries</field>
173
+ </block>
174
+
175
+ <block type="task" id="B16" action="edit-file" desc="Fill Exception Handling section">
176
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
177
+ <field name="operation">search_replace</field>
178
+ <field name="content_source">${api_contract}${conventions_dev}</field>
179
+ <field name="section">Exception Handling</field>
180
+ </block>
181
+ </block>
182
+
183
+ <!-- Step 5: Generate Platform INDEX.md -->
184
+ <block type="task" id="B17" action="read-file" desc="Read index template">
185
+ <field name="path">speccrew-sd-backend/templates/INDEX-TEMPLATE.md</field>
186
+ <field name="output" var="index_template"/>
187
+ </block>
188
+
189
+ <block type="task" id="B18" action="generate" desc="Create INDEX.md from template">
190
+ <field name="template" value="${index_template}"/>
191
+ <field name="placeholders">
192
+ - {Platform Name} → ${platform_id}
193
+ - {Feature Name} → ${feature_name}
194
+ </field>
195
+ <field name="output_path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
196
+ </block>
197
+
198
+ <block type="task" id="B19" action="edit-file" desc="Fill Tech Stack Summary">
199
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
200
+ <field name="operation">search_replace</field>
201
+ <field name="content_source">${tech_stack}</field>
202
+ <field name="section">Tech Stack Summary</field>
203
+ </block>
204
+
205
+ <block type="task" id="B20" action="edit-file" desc="Fill Shared Design Decisions">
206
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
207
+ <field name="operation">search_replace</field>
208
+ <field name="content_source">${architecture}${conventions_design}</field>
209
+ <field name="section">Shared Design Decisions</field>
210
+ </block>
211
+
212
+ <block type="task" id="B21" action="edit-file" desc="Fill Module List Table">
213
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
214
+ <field name="operation">search_replace</field>
215
+ <field name="content_source">${extracted_functions}</field>
216
+ <field name="section">Module List Table</field>
217
+ </block>
218
+
219
+ <block type="task" id="B22" action="edit-file" desc="Fill Database Schema Overview">
220
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
221
+ <field name="operation">search_replace</field>
222
+ <field name="content_source">${extracted_functions}</field>
223
+ <field name="section">Database Schema Overview</field>
224
+ </block>
225
+
226
+ <!-- Step 6: Present Summary -->
227
+ <block type="event" id="E2" action="log" level="info" desc="Present design summary">
228
+ <field name="message">Backend System Design Summary for: ${feature_name}
229
+ Platform: ${platform_id}
230
+
231
+ Module Designs: ${extracted_functions.design_count}
232
+ ├── [NEW] ${extracted_functions.new_count} modules
233
+ ├── [MODIFIED] ${extracted_functions.modified_count} modules
234
+ └── [EXISTING] ${extracted_functions.existing_count} modules (no design needed)
235
+
236
+ Database Changes:
237
+ ├── New Tables: ${extracted_functions.new_tables_count}
238
+ ├── Modified Tables: ${extracted_functions.modified_tables_count}
239
+ └── Migration Files: ${extracted_functions.migration_count}
240
+
241
+ Files Generated:
242
+ - ${iteration_path}/03.system-design/${platform_id}/INDEX.md
243
+ ${extracted_functions.file_list}</field>
244
+ </block>
245
+
246
+ </sequence>
247
+
248
+ <!-- ============================================================
249
+ Output Results
250
+ ============================================================ -->
251
+ <block type="output" id="O1" desc="Workflow output results">
252
+ <field name="status" value="SUCCESS" type="string" desc="Task completion status"/>
253
+ <field name="task_id" from="${task_id}" type="string" desc="Task ID"/>
254
+ <field name="platform" value="${platform_id}" type="string" desc="Target platform"/>
255
+ <field name="feature_id" from="${feature_id}" type="string" desc="Feature ID"/>
256
+ <field name="feature" value="${feature_name}" type="string" desc="Feature name"/>
257
+ <field name="output_files" type="array" desc="List of generated files">
258
+ <field name="file">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
259
+ <field name="files" from="${extracted_functions.output_files}"/>
260
+ </field>
261
+ <field name="summary" value="Backend system design completed for ${feature_name} on ${platform_id}" type="string" desc="Completion summary"/>
262
+ </block>
263
+
264
+ </workflow>