claude-code-workflow 6.3.48 → 6.3.49

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 (211) hide show
  1. package/.claude/CLAUDE.md +6 -8
  2. package/.claude/agents/action-planning-agent.md +28 -45
  3. package/.claude/agents/cli-lite-planning-agent.md +93 -1
  4. package/.claude/agents/code-developer.md +144 -27
  5. package/.claude/commands/ccw-coordinator.md +175 -21
  6. package/.claude/commands/ccw-debug.md +832 -0
  7. package/.claude/commands/ccw.md +90 -9
  8. package/.claude/commands/cli/cli-init.md +1 -0
  9. package/.claude/commands/issue/convert-to-plan.md +718 -0
  10. package/.claude/commands/issue/from-brainstorm.md +382 -0
  11. package/.claude/commands/memory/tips.md +332 -0
  12. package/.claude/commands/workflow/analyze-with-file.md +804 -0
  13. package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
  14. package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
  15. package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
  16. package/.claude/commands/workflow/debug-with-file.md +7 -5
  17. package/.claude/commands/workflow/execute.md +6 -4
  18. package/.claude/commands/workflow/lite-plan.md +2 -2
  19. package/.claude/commands/workflow/plan-verify.md +162 -327
  20. package/.claude/commands/workflow/plan.md +162 -26
  21. package/.claude/commands/workflow/replan.md +78 -2
  22. package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
  23. package/.claude/commands/workflow/review-module-cycle.md +2 -2
  24. package/.claude/commands/workflow/review-session-cycle.md +2 -2
  25. package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
  26. package/.claude/commands/workflow/tools/context-gather.md +81 -118
  27. package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
  28. package/.claude/skills/ccw-help/command.json +4 -4
  29. package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
  30. package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
  31. package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
  32. package/.claude/skills/skill-generator/SKILL.md +277 -85
  33. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
  34. package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
  35. package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
  36. package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
  37. package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
  38. package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
  39. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
  40. package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
  41. package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
  42. package/.claude/skills/skill-generator/templates/script-template.md +368 -0
  43. package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
  44. package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
  45. package/.claude/skills/skill-tuning/SKILL.md +130 -266
  46. package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
  47. package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
  48. package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
  49. package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
  50. package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
  51. package/.claude/workflows/cli-tools-usage.md +1 -1
  52. package/.codex/AGENTS.md +1 -3
  53. package/.codex/prompts/analyze-with-file.md +607 -0
  54. package/.codex/prompts/brainstorm-to-cycle.md +455 -0
  55. package/.codex/prompts/brainstorm-with-file.md +933 -0
  56. package/.codex/prompts/debug-with-file.md +15 -20
  57. package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
  58. package/ccw/dist/commands/cli.d.ts.map +1 -1
  59. package/ccw/dist/commands/cli.js +29 -5
  60. package/ccw/dist/commands/cli.js.map +1 -1
  61. package/ccw/dist/commands/issue.d.ts +2 -0
  62. package/ccw/dist/commands/issue.d.ts.map +1 -1
  63. package/ccw/dist/commands/issue.js +62 -20
  64. package/ccw/dist/commands/issue.js.map +1 -1
  65. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  66. package/ccw/dist/config/litellm-api-config-manager.js +5 -3
  67. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  68. package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
  69. package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
  70. package/ccw/dist/config/litellm-provider-models.js +172 -0
  71. package/ccw/dist/config/litellm-provider-models.js.map +1 -0
  72. package/ccw/dist/config/provider-models.d.ts +25 -51
  73. package/ccw/dist/config/provider-models.d.ts.map +1 -1
  74. package/ccw/dist/config/provider-models.js +84 -149
  75. package/ccw/dist/config/provider-models.js.map +1 -1
  76. package/ccw/dist/config/storage-paths.d.ts.map +1 -1
  77. package/ccw/dist/config/storage-paths.js +23 -5
  78. package/ccw/dist/config/storage-paths.js.map +1 -1
  79. package/ccw/dist/core/auth/csrf-middleware.js +3 -3
  80. package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
  81. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  82. package/ccw/dist/core/dashboard-generator.js +3 -1
  83. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  84. package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
  85. package/ccw/dist/core/routes/claude-routes.js +206 -14
  86. package/ccw/dist/core/routes/claude-routes.js.map +1 -1
  87. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  88. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  89. package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
  90. package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
  91. package/ccw/dist/core/routes/commands-routes.js +480 -0
  92. package/ccw/dist/core/routes/commands-routes.js.map +1 -0
  93. package/ccw/dist/core/routes/model-routes.d.ts +11 -0
  94. package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
  95. package/ccw/dist/core/routes/model-routes.js +112 -0
  96. package/ccw/dist/core/routes/model-routes.js.map +1 -0
  97. package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
  98. package/ccw/dist/core/routes/nav-status-routes.js +84 -1
  99. package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
  100. package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
  101. package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
  102. package/ccw/dist/core/routes/provider-routes.js +67 -0
  103. package/ccw/dist/core/routes/provider-routes.js.map +1 -0
  104. package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
  105. package/ccw/dist/core/routes/skills-routes.js +219 -7
  106. package/ccw/dist/core/routes/skills-routes.js.map +1 -1
  107. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  108. package/ccw/dist/core/routes/system-routes.js +58 -6
  109. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  110. package/ccw/dist/core/server.d.ts.map +1 -1
  111. package/ccw/dist/core/server.js +13 -0
  112. package/ccw/dist/core/server.js.map +1 -1
  113. package/ccw/dist/mcp-server/index.js +2 -2
  114. package/ccw/dist/mcp-server/index.js.map +1 -1
  115. package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
  116. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  117. package/ccw/dist/tools/claude-cli-tools.js +146 -50
  118. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  119. package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
  120. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  121. package/ccw/dist/tools/cli-config-manager.js +3 -27
  122. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  123. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  124. package/ccw/dist/tools/cli-executor-core.js +7 -2
  125. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  126. package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
  127. package/ccw/dist/tools/cli-history-store.d.ts +11 -0
  128. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  129. package/ccw/dist/tools/cli-history-store.js +82 -2
  130. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  131. package/ccw/dist/tools/command-registry.d.ts +7 -0
  132. package/ccw/dist/tools/command-registry.d.ts.map +1 -1
  133. package/ccw/dist/tools/command-registry.js +14 -1
  134. package/ccw/dist/tools/command-registry.js.map +1 -1
  135. package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
  136. package/ccw/dist/tools/generate-module-docs.js +11 -7
  137. package/ccw/dist/tools/generate-module-docs.js.map +1 -1
  138. package/ccw/dist/tools/litellm-executor.d.ts +1 -0
  139. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
  140. package/ccw/dist/tools/litellm-executor.js +11 -9
  141. package/ccw/dist/tools/litellm-executor.js.map +1 -1
  142. package/ccw/dist/types/skill-types.d.ts +97 -0
  143. package/ccw/dist/types/skill-types.d.ts.map +1 -0
  144. package/ccw/dist/types/skill-types.js +6 -0
  145. package/ccw/dist/types/skill-types.js.map +1 -0
  146. package/ccw/src/commands/cli.ts +36 -5
  147. package/ccw/src/commands/issue.ts +81 -26
  148. package/ccw/src/config/litellm-api-config-manager.ts +5 -3
  149. package/ccw/src/config/litellm-provider-models.ts +222 -0
  150. package/ccw/src/config/provider-models.ts +91 -190
  151. package/ccw/src/config/storage-paths.ts +20 -5
  152. package/ccw/src/core/auth/csrf-middleware.ts +3 -3
  153. package/ccw/src/core/dashboard-generator.ts +3 -1
  154. package/ccw/src/core/routes/claude-routes.ts +233 -15
  155. package/ccw/src/core/routes/cli-routes.ts +2 -3
  156. package/ccw/src/core/routes/commands-routes.ts +620 -0
  157. package/ccw/src/core/routes/nav-status-routes.ts +95 -1
  158. package/ccw/src/core/routes/provider-routes.ts +78 -0
  159. package/ccw/src/core/routes/skills-routes.ts +266 -45
  160. package/ccw/src/core/routes/system-routes.ts +102 -50
  161. package/ccw/src/core/server.ts +13 -0
  162. package/ccw/src/mcp-server/index.ts +2 -2
  163. package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
  164. package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
  165. package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
  166. package/ccw/src/templates/dashboard-js/i18n.js +116 -0
  167. package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
  168. package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
  169. package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
  170. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
  171. package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
  172. package/ccw/src/templates/dashboard.html +7 -0
  173. package/ccw/src/tools/claude-cli-tools.ts +170 -56
  174. package/ccw/src/tools/cli-config-manager.ts +2 -33
  175. package/ccw/src/tools/cli-executor-core.ts +8 -2
  176. package/ccw/src/tools/cli-history-store.ts +92 -2
  177. package/ccw/src/tools/command-registry.ts +16 -1
  178. package/ccw/src/tools/generate-module-docs.ts +11 -7
  179. package/ccw/src/tools/litellm-executor.ts +13 -9
  180. package/ccw/src/types/skill-types.ts +99 -0
  181. package/package.json +1 -1
  182. package/.claude/commands/enhance-prompt.md +0 -93
  183. package/.claude/commands/memory/code-map-memory.md +0 -687
  184. package/.claude/commands/memory/docs.md +0 -615
  185. package/.claude/commands/memory/load-skill-memory.md +0 -182
  186. package/.claude/commands/memory/skill-memory.md +0 -525
  187. package/.claude/commands/memory/swagger-docs.md +0 -773
  188. package/.claude/commands/memory/tech-research-rules.md +0 -310
  189. package/.claude/commands/memory/workflow-skill-memory.md +0 -517
  190. package/.claude/commands/task/breakdown.md +0 -208
  191. package/.claude/commands/task/create.md +0 -152
  192. package/.claude/commands/task/execute.md +0 -270
  193. package/.claude/commands/task/replan.md +0 -441
  194. package/.claude/commands/version.md +0 -254
  195. package/.claude/commands/workflow/action-plan-verify.md +0 -485
  196. package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
  197. package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
  198. package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
  199. package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
  200. package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
  201. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
  202. package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
  203. package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
  204. package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
  205. package/.claude/commands/workflow/debug.md +0 -331
  206. package/.claude/commands/workflow/develop-with-file.md +0 -1044
  207. package/.claude/skills/ccw-loop/README.md +0 -303
  208. package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
  209. package/.claude/skills/skill-generator/templates/script-python.md +0 -198
  210. package/.codex/prompts/debug.md +0 -318
  211. package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
@@ -0,0 +1,705 @@
1
+ ---
2
+ name: role-analysis
3
+ description: Unified role-specific analysis generation with interactive context gathering and incremental updates
4
+ argument-hint: "[role-name] [--session session-id] [--update] [--include-questions] [--skip-questions]"
5
+ allowed-tools: Task(conceptual-planning-agent), AskUserQuestion(*), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*)
6
+ ---
7
+
8
+ ## 🎯 **Unified Role Analysis Generator**
9
+
10
+ ### Purpose
11
+ **Unified command for generating and updating role-specific analysis** with interactive context gathering, framework alignment, and incremental update support. Replaces 9 individual role commands with single parameterized workflow.
12
+
13
+ ### Core Function
14
+ - **Multi-Role Support**: Single command supports all 9 brainstorming roles
15
+ - **Interactive Context**: Dynamic question generation based on role and framework
16
+ - **Incremental Updates**: Merge new insights into existing analyses
17
+ - **Framework Alignment**: Address guidance-specification.md discussion points
18
+ - **Agent Delegation**: Use conceptual-planning-agent with role-specific templates
19
+
20
+ ### Supported Roles
21
+
22
+ | Role ID | Title | Focus Area | Context Questions |
23
+ |---------|-------|------------|-------------------|
24
+ | `ux-expert` | UX专家 | User research, information architecture, user journey | 4 |
25
+ | `ui-designer` | UI设计师 | Visual design, high-fidelity mockups, design systems | 4 |
26
+ | `system-architect` | 系统架构师 | Technical architecture, scalability, integration patterns | 5 |
27
+ | `product-manager` | 产品经理 | Product strategy, roadmap, prioritization | 4 |
28
+ | `product-owner` | 产品负责人 | Backlog management, user stories, acceptance criteria | 4 |
29
+ | `scrum-master` | 敏捷教练 | Process facilitation, impediment removal, team dynamics | 3 |
30
+ | `subject-matter-expert` | 领域专家 | Domain knowledge, business rules, compliance | 4 |
31
+ | `data-architect` | 数据架构师 | Data models, storage strategies, data flow | 5 |
32
+ | `api-designer` | API设计师 | API contracts, versioning, integration patterns | 4 |
33
+
34
+ ---
35
+
36
+ ## 📋 **Usage**
37
+
38
+ ```bash
39
+ # Generate new analysis with interactive context
40
+ /workflow:brainstorm:role-analysis ux-expert
41
+
42
+ # Generate with existing framework + context questions
43
+ /workflow:brainstorm:role-analysis system-architect --session WFS-xxx --include-questions
44
+
45
+ # Update existing analysis (incremental merge)
46
+ /workflow:brainstorm:role-analysis ui-designer --session WFS-xxx --update
47
+
48
+ # Quick generation (skip interactive context)
49
+ /workflow:brainstorm:role-analysis product-manager --session WFS-xxx --skip-questions
50
+ ```
51
+
52
+ ---
53
+
54
+ ## ⚙️ **Execution Protocol**
55
+
56
+ ### Phase 1: Detection & Validation
57
+
58
+ **Step 1.1: Role Validation**
59
+ ```bash
60
+ VALIDATE role_name IN [
61
+ ux-expert, ui-designer, system-architect, product-manager,
62
+ product-owner, scrum-master, subject-matter-expert,
63
+ data-architect, api-designer
64
+ ]
65
+ IF invalid:
66
+ ERROR: "Unknown role: {role_name}. Use one of: ux-expert, ui-designer, ..."
67
+ EXIT
68
+ ```
69
+
70
+ **Step 1.2: Session Detection**
71
+ ```bash
72
+ IF --session PROVIDED:
73
+ session_id = --session
74
+ brainstorm_dir = .workflow/active/{session_id}/.brainstorming/
75
+ ELSE:
76
+ FIND .workflow/active/WFS-*/
77
+ IF multiple:
78
+ PROMPT user to select
79
+ ELSE IF single:
80
+ USE existing
81
+ ELSE:
82
+ ERROR: "No active session. Run /workflow:brainstorm:artifacts first"
83
+ EXIT
84
+
85
+ VALIDATE brainstorm_dir EXISTS
86
+ ```
87
+
88
+ **Step 1.3: Framework Detection**
89
+ ```bash
90
+ framework_file = {brainstorm_dir}/guidance-specification.md
91
+ IF framework_file EXISTS:
92
+ framework_mode = true
93
+ LOAD framework_content
94
+ ELSE:
95
+ WARN: "No framework found - will create standalone analysis"
96
+ framework_mode = false
97
+ ```
98
+
99
+ **Step 1.4: Update Mode Detection**
100
+ ```bash
101
+ existing_analysis = {brainstorm_dir}/{role_name}/analysis*.md
102
+ IF --update FLAG OR existing_analysis EXISTS:
103
+ update_mode = true
104
+ IF --update NOT PROVIDED:
105
+ ASK: "Analysis exists. Update or regenerate?"
106
+ OPTIONS: ["Incremental update", "Full regenerate", "Cancel"]
107
+ ELSE:
108
+ update_mode = false
109
+ ```
110
+
111
+ ### Phase 2: Interactive Context Gathering
112
+
113
+ **Trigger Conditions**:
114
+ - Default: Always ask unless `--skip-questions` provided
115
+ - `--include-questions`: Force context gathering even if analysis exists
116
+ - `--skip-questions`: Skip all interactive questions
117
+
118
+ **Step 2.1: Load Role Configuration**
119
+ ```javascript
120
+ const roleConfig = {
121
+ 'ux-expert': {
122
+ title: 'UX专家',
123
+ focus_area: 'User research, information architecture, user journey',
124
+ question_categories: ['User Intent', 'Requirements', 'UX'],
125
+ question_count: 4,
126
+ template: '~/.claude/workflows/cli-templates/planning-roles/ux-expert.md'
127
+ },
128
+ 'ui-designer': {
129
+ title: 'UI设计师',
130
+ focus_area: 'Visual design, high-fidelity mockups, design systems',
131
+ question_categories: ['Requirements', 'UX', 'Feasibility'],
132
+ question_count: 4,
133
+ template: '~/.claude/workflows/cli-templates/planning-roles/ui-designer.md'
134
+ },
135
+ 'system-architect': {
136
+ title: '系统架构师',
137
+ focus_area: 'Technical architecture, scalability, integration patterns',
138
+ question_categories: ['Scale & Performance', 'Technical Constraints', 'Architecture Complexity', 'Non-Functional Requirements'],
139
+ question_count: 5,
140
+ template: '~/.claude/workflows/cli-templates/planning-roles/system-architect.md'
141
+ },
142
+ 'product-manager': {
143
+ title: '产品经理',
144
+ focus_area: 'Product strategy, roadmap, prioritization',
145
+ question_categories: ['User Intent', 'Requirements', 'Process'],
146
+ question_count: 4,
147
+ template: '~/.claude/workflows/cli-templates/planning-roles/product-manager.md'
148
+ },
149
+ 'product-owner': {
150
+ title: '产品负责人',
151
+ focus_area: 'Backlog management, user stories, acceptance criteria',
152
+ question_categories: ['Requirements', 'Decisions', 'Process'],
153
+ question_count: 4,
154
+ template: '~/.claude/workflows/cli-templates/planning-roles/product-owner.md'
155
+ },
156
+ 'scrum-master': {
157
+ title: '敏捷教练',
158
+ focus_area: 'Process facilitation, impediment removal, team dynamics',
159
+ question_categories: ['Process', 'Risk', 'Decisions'],
160
+ question_count: 3,
161
+ template: '~/.claude/workflows/cli-templates/planning-roles/scrum-master.md'
162
+ },
163
+ 'subject-matter-expert': {
164
+ title: '领域专家',
165
+ focus_area: 'Domain knowledge, business rules, compliance',
166
+ question_categories: ['Requirements', 'Feasibility', 'Terminology'],
167
+ question_count: 4,
168
+ template: '~/.claude/workflows/cli-templates/planning-roles/subject-matter-expert.md'
169
+ },
170
+ 'data-architect': {
171
+ title: '数据架构师',
172
+ focus_area: 'Data models, storage strategies, data flow',
173
+ question_categories: ['Architecture', 'Scale & Performance', 'Technical Constraints', 'Feasibility'],
174
+ question_count: 5,
175
+ template: '~/.claude/workflows/cli-templates/planning-roles/data-architect.md'
176
+ },
177
+ 'api-designer': {
178
+ title: 'API设计师',
179
+ focus_area: 'API contracts, versioning, integration patterns',
180
+ question_categories: ['Architecture', 'Requirements', 'Feasibility', 'Decisions'],
181
+ question_count: 4,
182
+ template: '~/.claude/workflows/cli-templates/planning-roles/api-designer.md'
183
+ }
184
+ };
185
+
186
+ config = roleConfig[role_name];
187
+ ```
188
+
189
+ **Step 2.2: Generate Role-Specific Questions**
190
+
191
+ **9-Category Taxonomy** (from synthesis.md):
192
+
193
+ | Category | Focus | Example Question Pattern |
194
+ |----------|-------|--------------------------|
195
+ | User Intent | 用户目标 | "该分析的核心目标是什么?" |
196
+ | Requirements | 需求细化 | "需求的优先级如何排序?" |
197
+ | Architecture | 架构决策 | "技术栈的选择考量?" |
198
+ | UX | 用户体验 | "交互复杂度的取舍?" |
199
+ | Feasibility | 可行性 | "资源约束下的实现范围?" |
200
+ | Risk | 风险管理 | "风险容忍度是多少?" |
201
+ | Process | 流程规范 | "开发迭代的节奏?" |
202
+ | Decisions | 决策确认 | "冲突的解决方案?" |
203
+ | Terminology | 术语统一 | "统一使用哪个术语?" |
204
+ | Scale & Performance | 性能扩展 | "预期的负载和性能要求?" |
205
+ | Technical Constraints | 技术约束 | "现有技术栈的限制?" |
206
+ | Architecture Complexity | 架构复杂度 | "架构的复杂度权衡?" |
207
+ | Non-Functional Requirements | 非功能需求 | "可用性和可维护性要求?" |
208
+
209
+ **Question Generation Algorithm**:
210
+ ```javascript
211
+ async function generateQuestions(role_name, framework_content) {
212
+ const config = roleConfig[role_name];
213
+ const questions = [];
214
+
215
+ // Parse framework for keywords
216
+ const keywords = extractKeywords(framework_content);
217
+
218
+ // Generate category-specific questions
219
+ for (const category of config.question_categories) {
220
+ const question = generateCategoryQuestion(category, keywords, role_name);
221
+ questions.push(question);
222
+ }
223
+
224
+ return questions.slice(0, config.question_count);
225
+ }
226
+ ```
227
+
228
+ **Step 2.3: Multi-Round Question Execution**
229
+
230
+ ```javascript
231
+ const BATCH_SIZE = 4;
232
+ const user_context = {};
233
+
234
+ for (let i = 0; i < questions.length; i += BATCH_SIZE) {
235
+ const batch = questions.slice(i, i + BATCH_SIZE);
236
+ const currentRound = Math.floor(i / BATCH_SIZE) + 1;
237
+ const totalRounds = Math.ceil(questions.length / BATCH_SIZE);
238
+
239
+ console.log(`\n[Round ${currentRound}/${totalRounds}] ${config.title} 上下文询问\n`);
240
+
241
+ AskUserQuestion({
242
+ questions: batch.map(q => ({
243
+ question: q.question,
244
+ header: q.category.substring(0, 12),
245
+ multiSelect: false,
246
+ options: q.options.map(opt => ({
247
+ label: opt.label,
248
+ description: opt.description
249
+ }))
250
+ }))
251
+ });
252
+
253
+ // Store responses before next round
254
+ for (const answer of responses) {
255
+ user_context[answer.question] = {
256
+ answer: answer.selected,
257
+ category: answer.category,
258
+ timestamp: new Date().toISOString()
259
+ };
260
+ }
261
+ }
262
+
263
+ // Save context to file
264
+ Write(
265
+ `${brainstorm_dir}/${role_name}/${role_name}-context.md`,
266
+ formatUserContext(user_context)
267
+ );
268
+ ```
269
+
270
+ **Question Quality Rules** (from artifacts.md):
271
+
272
+ **MUST Include**:
273
+ - ✅ All questions in Chinese (用中文提问)
274
+ - ✅ 业务场景作为问题前提
275
+ - ✅ 技术选项的业务影响说明
276
+ - ✅ 量化指标和约束条件
277
+
278
+ **MUST Avoid**:
279
+ - ❌ 纯技术选型无业务上下文
280
+ - ❌ 过度抽象的通用问题
281
+ - ❌ 脱离框架的重复询问
282
+
283
+ ### Phase 3: Agent Execution
284
+
285
+ **Step 3.1: Load Session Metadata**
286
+ ```bash
287
+ session_metadata = Read(.workflow/active/{session_id}/workflow-session.json)
288
+ original_topic = session_metadata.topic
289
+ selected_roles = session_metadata.selected_roles
290
+ ```
291
+
292
+ **Step 3.2: Prepare Agent Context**
293
+ ```javascript
294
+ const agentContext = {
295
+ role_name: role_name,
296
+ role_config: roleConfig[role_name],
297
+ output_location: `${brainstorm_dir}/${role_name}/`,
298
+ framework_mode: framework_mode,
299
+ framework_path: framework_mode ? `${brainstorm_dir}/guidance-specification.md` : null,
300
+ update_mode: update_mode,
301
+ user_context: user_context,
302
+ original_topic: original_topic,
303
+ session_id: session_id
304
+ };
305
+ ```
306
+
307
+ **Step 3.3: Execute Conceptual Planning Agent**
308
+
309
+ **Framework-Based Analysis** (when guidance-specification.md exists):
310
+ ```javascript
311
+ Task(
312
+ subagent_type="conceptual-planning-agent",
313
+ run_in_background=false,
314
+ description=`Generate ${role_name} analysis`,
315
+ prompt=`
316
+ [FLOW_CONTROL]
317
+
318
+ Execute ${role_name} analysis for existing topic framework
319
+
320
+ ## Context Loading
321
+ ASSIGNED_ROLE: ${role_name}
322
+ OUTPUT_LOCATION: ${agentContext.output_location}
323
+ ANALYSIS_MODE: ${framework_mode ? "framework_based" : "standalone"}
324
+ UPDATE_MODE: ${update_mode}
325
+
326
+ ## Flow Control Steps
327
+ 1. **load_topic_framework**
328
+ - Action: Load structured topic discussion framework
329
+ - Command: Read(${agentContext.framework_path})
330
+ - Output: topic_framework_content
331
+
332
+ 2. **load_role_template**
333
+ - Action: Load ${role_name} planning template
334
+ - Command: Read(${roleConfig[role_name].template})
335
+ - Output: role_template_guidelines
336
+
337
+ 3. **load_session_metadata**
338
+ - Action: Load session metadata and user intent
339
+ - Command: Read(.workflow/active/${session_id}/workflow-session.json)
340
+ - Output: session_context
341
+
342
+ 4. **load_user_context** (if exists)
343
+ - Action: Load interactive context responses
344
+ - Command: Read(${brainstorm_dir}/${role_name}/${role_name}-context.md)
345
+ - Output: user_context_answers
346
+
347
+ 5. **${update_mode ? 'load_existing_analysis' : 'skip'}**
348
+ ${update_mode ? `
349
+ - Action: Load existing analysis for incremental update
350
+ - Command: Read(${brainstorm_dir}/${role_name}/analysis.md)
351
+ - Output: existing_analysis_content
352
+ ` : ''}
353
+
354
+ ## Analysis Requirements
355
+ **Primary Reference**: Original user prompt from workflow-session.json is authoritative
356
+ **Framework Source**: Address all discussion points in guidance-specification.md from ${role_name} perspective
357
+ **User Context Integration**: Incorporate interactive Q&A responses into analysis
358
+ **Role Focus**: ${roleConfig[role_name].focus_area}
359
+ **Template Integration**: Apply role template guidelines within framework structure
360
+
361
+ ## Expected Deliverables
362
+ 1. **analysis.md** (main document, optionally with analysis-{slug}.md sub-documents)
363
+ 2. **Framework Reference**: @../guidance-specification.md (if framework_mode)
364
+ 3. **User Context Reference**: @./${role_name}-context.md (if user context exists)
365
+ 4. **User Intent Alignment**: Validate against session_context
366
+
367
+ ## Update Requirements (if UPDATE_MODE)
368
+ - **Preserve Structure**: Maintain existing analysis structure
369
+ - **Add "Clarifications" Section**: Document new user context with timestamp
370
+ - **Merge Insights**: Integrate new perspectives without removing existing content
371
+ - **Resolve Conflicts**: If new context contradicts existing analysis, document both and recommend resolution
372
+
373
+ ## Completion Criteria
374
+ - Address each discussion point from guidance-specification.md with ${role_name} expertise
375
+ - Provide actionable recommendations from ${role_name} perspective within analysis files
376
+ - All output files MUST start with "analysis" prefix (no recommendations.md or other naming)
377
+ - Reference framework document using @ notation for integration
378
+ - Update workflow-session.json with completion status
379
+ `
380
+ );
381
+ ```
382
+
383
+ ### Phase 4: Validation & Finalization
384
+
385
+ **Step 4.1: Validate Output**
386
+ ```bash
387
+ VERIFY EXISTS: ${brainstorm_dir}/${role_name}/analysis.md
388
+ VERIFY CONTAINS: "@../guidance-specification.md" (if framework_mode)
389
+ IF user_context EXISTS:
390
+ VERIFY CONTAINS: "@./${role_name}-context.md" OR "## Clarifications" section
391
+ ```
392
+
393
+ **Step 4.2: Update Session Metadata**
394
+ ```json
395
+ {
396
+ "phases": {
397
+ "BRAINSTORM": {
398
+ "${role_name}": {
399
+ "status": "${update_mode ? 'updated' : 'completed'}",
400
+ "completed_at": "timestamp",
401
+ "framework_addressed": true,
402
+ "context_gathered": user_context ? true : false,
403
+ "output_location": "${brainstorm_dir}/${role_name}/analysis.md",
404
+ "update_history": [
405
+ {
406
+ "timestamp": "ISO8601",
407
+ "mode": "${update_mode ? 'incremental' : 'initial'}",
408
+ "context_questions": question_count
409
+ }
410
+ ]
411
+ }
412
+ }
413
+ }
414
+ }
415
+ ```
416
+
417
+ **Step 4.3: Completion Report**
418
+ ```markdown
419
+ ✅ ${roleConfig[role_name].title} Analysis Complete
420
+
421
+ **Output**: ${brainstorm_dir}/${role_name}/analysis.md
422
+ **Mode**: ${update_mode ? 'Incremental Update' : 'New Generation'}
423
+ **Framework**: ${framework_mode ? '✓ Aligned' : '✗ Standalone'}
424
+ **Context Questions**: ${question_count} answered
425
+
426
+ ${update_mode ? '
427
+ **Changes**:
428
+ - Added "Clarifications" section with new user context
429
+ - Merged new insights into existing sections
430
+ - Resolved conflicts with framework alignment
431
+ ' : ''}
432
+
433
+ **Next Steps**:
434
+ ${selected_roles.length > 1 ? `
435
+ - Continue with other roles: ${selected_roles.filter(r => r !== role_name).join(', ')}
436
+ - Run synthesis: /workflow:brainstorm:synthesis --session ${session_id}
437
+ ` : `
438
+ - Clarify insights: /workflow:brainstorm:synthesis --session ${session_id}
439
+ - Generate plan: /workflow:plan --session ${session_id}
440
+ `}
441
+ ```
442
+
443
+ ---
444
+
445
+ ## 📋 **TodoWrite Integration**
446
+
447
+ ### Workflow Progress Tracking
448
+
449
+ ```javascript
450
+ TodoWrite({
451
+ todos: [
452
+ {
453
+ content: "Phase 1: Detect session and validate role configuration",
454
+ status: "in_progress",
455
+ activeForm: "Detecting session and role"
456
+ },
457
+ {
458
+ content: "Phase 2: Interactive context gathering with AskUserQuestion",
459
+ status: "pending",
460
+ activeForm: "Gathering user context"
461
+ },
462
+ {
463
+ content: "Phase 3: Execute conceptual-planning-agent for role analysis",
464
+ status: "pending",
465
+ activeForm: "Executing agent analysis"
466
+ },
467
+ {
468
+ content: "Phase 4: Validate output and update session metadata",
469
+ status: "pending",
470
+ activeForm: "Finalizing and validating"
471
+ }
472
+ ]
473
+ });
474
+ ```
475
+
476
+ ---
477
+
478
+ ## 📊 **Output Structure**
479
+
480
+ ### Directory Layout
481
+
482
+ ```
483
+ .workflow/active/WFS-{session}/.brainstorming/
484
+ ├── guidance-specification.md # Framework (if exists)
485
+ └── {role-name}/
486
+ ├── {role-name}-context.md # Interactive Q&A responses
487
+ ├── analysis.md # Main analysis (REQUIRED)
488
+ └── analysis-{slug}.md # Section documents (optional, max 5)
489
+ ```
490
+
491
+ ### Analysis Document Structure (New Generation)
492
+
493
+ ```markdown
494
+ # ${roleConfig[role_name].title} Analysis: [Topic from Framework]
495
+
496
+ ## Framework Reference
497
+ **Topic Framework**: @../guidance-specification.md
498
+ **Role Focus**: ${roleConfig[role_name].focus_area}
499
+ **User Context**: @./${role_name}-context.md
500
+
501
+ ## User Context Summary
502
+ **Context Gathered**: ${question_count} questions answered
503
+ **Categories**: ${question_categories.join(', ')}
504
+
505
+ ${user_context ? formatContextSummary(user_context) : ''}
506
+
507
+ ## Discussion Points Analysis
508
+ [Address each point from guidance-specification.md with ${role_name} expertise]
509
+
510
+ ### Core Requirements (from framework)
511
+ [Role-specific perspective on requirements]
512
+
513
+ ### Technical Considerations (from framework)
514
+ [Role-specific technical analysis]
515
+
516
+ ### User Experience Factors (from framework)
517
+ [Role-specific UX considerations]
518
+
519
+ ### Implementation Challenges (from framework)
520
+ [Role-specific challenges and solutions]
521
+
522
+ ### Success Metrics (from framework)
523
+ [Role-specific metrics and KPIs]
524
+
525
+ ## ${roleConfig[role_name].title} Specific Recommendations
526
+ [Role-specific actionable strategies]
527
+
528
+ ---
529
+ *Generated by ${role_name} analysis addressing structured framework*
530
+ *Context gathered: ${new Date().toISOString()}*
531
+ ```
532
+
533
+ ### Analysis Document Structure (Incremental Update)
534
+
535
+ ```markdown
536
+ # ${roleConfig[role_name].title} Analysis: [Topic]
537
+
538
+ ## Framework Reference
539
+ [Existing content preserved]
540
+
541
+ ## Clarifications
542
+ ### Session ${new Date().toISOString().split('T')[0]}
543
+ ${Object.entries(user_context).map(([q, a]) => `
544
+ - **Q**: ${q} (Category: ${a.category})
545
+ **A**: ${a.answer}
546
+ `).join('\n')}
547
+
548
+ ## User Context Summary
549
+ [Updated with new context]
550
+
551
+ ## Discussion Points Analysis
552
+ [Existing content enhanced with new insights]
553
+
554
+ [Rest of sections updated based on clarifications]
555
+ ```
556
+
557
+ ---
558
+
559
+ ## 🔄 **Integration with Other Commands**
560
+
561
+ ### Called By
562
+ - `/workflow:brainstorm:auto-parallel` (Phase 2 - parallel role execution)
563
+ - Manual invocation for single-role analysis
564
+
565
+ ### Calls To
566
+ - `conceptual-planning-agent` (agent execution)
567
+ - `AskUserQuestion` (interactive context gathering)
568
+
569
+ ### Coordinates With
570
+ - `/workflow:brainstorm:artifacts` (creates framework for role analysis)
571
+ - `/workflow:brainstorm:synthesis` (reads role analyses for integration)
572
+
573
+ ---
574
+
575
+ ## ✅ **Quality Assurance**
576
+
577
+ ### Required Analysis Elements
578
+ - [ ] Framework discussion points addressed (if framework_mode)
579
+ - [ ] User context integrated (if context gathered)
580
+ - [ ] Role template guidelines applied
581
+ - [ ] Output files follow naming convention (analysis*.md only)
582
+ - [ ] Framework reference using @ notation
583
+ - [ ] Session metadata updated
584
+
585
+ ### Context Quality
586
+ - [ ] Questions in Chinese with business context
587
+ - [ ] Options include technical trade-offs
588
+ - [ ] Categories aligned with role focus
589
+ - [ ] No generic questions unrelated to framework
590
+
591
+ ### Update Quality (if update_mode)
592
+ - [ ] "Clarifications" section added with timestamp
593
+ - [ ] New insights merged without content loss
594
+ - [ ] Conflicts documented and resolved
595
+ - [ ] Framework alignment maintained
596
+
597
+ ---
598
+
599
+ ## 🎛️ **Command Parameters**
600
+
601
+ ### Required Parameters
602
+ - `[role-name]`: Role identifier (ux-expert, ui-designer, system-architect, etc.)
603
+
604
+ ### Optional Parameters
605
+ - `--session [session-id]`: Specify brainstorming session (auto-detect if omitted)
606
+ - `--update`: Force incremental update mode (auto-detect if analysis exists)
607
+ - `--include-questions`: Force context gathering even if analysis exists
608
+ - `--skip-questions`: Skip all interactive context gathering
609
+ - `--style-skill [package]`: For ui-designer only, load style SKILL package
610
+
611
+ ### Parameter Combinations
612
+
613
+ | Scenario | Command | Behavior |
614
+ |----------|---------|----------|
615
+ | New analysis | `role-analysis ux-expert` | Generate + ask context questions |
616
+ | Quick generation | `role-analysis ux-expert --skip-questions` | Generate without context |
617
+ | Update existing | `role-analysis ux-expert --update` | Ask clarifications + merge |
618
+ | Force questions | `role-analysis ux-expert --include-questions` | Ask even if exists |
619
+ | Specific session | `role-analysis ux-expert --session WFS-xxx` | Target specific session |
620
+
621
+ ---
622
+
623
+ ## 🚫 **Error Handling**
624
+
625
+ ### Invalid Role Name
626
+ ```
627
+ ERROR: Unknown role: "ui-expert"
628
+ Valid roles: ux-expert, ui-designer, system-architect, product-manager,
629
+ product-owner, scrum-master, subject-matter-expert,
630
+ data-architect, api-designer
631
+ ```
632
+
633
+ ### No Active Session
634
+ ```
635
+ ERROR: No active brainstorming session found
636
+ Run: /workflow:brainstorm:artifacts "[topic]" to create session
637
+ ```
638
+
639
+ ### Missing Framework (with warning)
640
+ ```
641
+ WARN: No guidance-specification.md found
642
+ Generating standalone analysis without framework alignment
643
+ Recommend: Run /workflow:brainstorm:artifacts first for better results
644
+ ```
645
+
646
+ ### Agent Execution Failure
647
+ ```
648
+ ERROR: Conceptual planning agent failed
649
+ Check: ${brainstorm_dir}/${role_name}/error.log
650
+ Action: Retry with --skip-questions or check framework validity
651
+ ```
652
+
653
+ ---
654
+
655
+ ## 🔧 **Advanced Usage**
656
+
657
+ ### Batch Role Generation (via auto-parallel)
658
+ ```bash
659
+ # This command handles multiple roles in parallel
660
+ /workflow:brainstorm:auto-parallel "topic" --count 3
661
+ # → Internally calls role-analysis for each selected role
662
+ ```
663
+
664
+ ### Manual Multi-Role Workflow
665
+ ```bash
666
+ # 1. Create framework
667
+ /workflow:brainstorm:artifacts "Build real-time collaboration platform" --count 3
668
+
669
+ # 2. Generate each role with context
670
+ /workflow:brainstorm:role-analysis system-architect --include-questions
671
+ /workflow:brainstorm:role-analysis ui-designer --include-questions
672
+ /workflow:brainstorm:role-analysis product-manager --include-questions
673
+
674
+ # 3. Synthesize insights
675
+ /workflow:brainstorm:synthesis --session WFS-xxx
676
+ ```
677
+
678
+ ### Iterative Refinement
679
+ ```bash
680
+ # Initial generation
681
+ /workflow:brainstorm:role-analysis ux-expert
682
+
683
+ # User reviews and wants more depth
684
+ /workflow:brainstorm:role-analysis ux-expert --update --include-questions
685
+ # → Asks clarification questions, merges new insights
686
+ ```
687
+
688
+ ---
689
+
690
+ ## 📚 **Reference Information**
691
+
692
+ ### Role Template Locations
693
+ - Templates: `~/.claude/workflows/cli-templates/planning-roles/`
694
+ - Format: `{role-name}.md` (e.g., `ux-expert.md`, `system-architect.md`)
695
+
696
+ ### Related Commands
697
+ - `/workflow:brainstorm:artifacts` - Create framework and select roles
698
+ - `/workflow:brainstorm:auto-parallel` - Parallel multi-role execution
699
+ - `/workflow:brainstorm:synthesis` - Integrate role analyses
700
+ - `/workflow:plan` - Generate implementation plan from synthesis
701
+
702
+ ### Context Package
703
+ - Location: `.workflow/active/WFS-{session}/.process/context-package.json`
704
+ - Used by: `context-search-agent` (Phase 0 of artifacts)
705
+ - Contains: Project context, tech stack, conflict risks