claude-code-workflow 7.2.24 → 7.2.26

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 (69) hide show
  1. package/.ccw/workflows/cli-tools-usage.md +123 -521
  2. package/.claude/CLAUDE.md +20 -0
  3. package/.claude/agents/action-planning-agent.md +6 -0
  4. package/.claude/agents/cli-explore-agent.md +63 -77
  5. package/.claude/agents/cli-lite-planning-agent.md +10 -11
  6. package/.claude/agents/issue-plan-agent.md +7 -2
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/skills/brainstorm/SKILL.md +408 -408
  9. package/.claude/skills/review-cycle/SKILL.md +132 -132
  10. package/.claude/skills/review-cycle/phases/review-module.md +4 -4
  11. package/.claude/skills/review-cycle/phases/review-session.md +4 -4
  12. package/.claude/skills/spec-generator/SKILL.md +1 -1
  13. package/.claude/skills/team-designer/phases/02-scaffold-generation.md +1 -1
  14. package/.claude/skills/team-lifecycle-v4/SKILL.md +1 -1
  15. package/.claude/skills/team-review/SKILL.md +1 -1
  16. package/.claude/skills/team-ultra-analyze/SKILL.md +1 -1
  17. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +3 -3
  18. package/.claude/skills/workflow-plan/SKILL.md +1 -1
  19. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +2 -2
  20. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +2 -2
  21. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +3 -3
  22. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +2 -2
  23. package/.claude/skills/workflow-test-fix/SKILL.md +1 -1
  24. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +2 -2
  25. package/.codex/AGENTS.md +16 -0
  26. package/.codex/skills/analyze-with-file/SKILL.md +966 -966
  27. package/.codex/skills/issue-discover/SKILL.md +361 -361
  28. package/.codex/skills/review-cycle/SKILL.md +1 -1
  29. package/.codex/skills/roadmap-with-file/SKILL.md +901 -901
  30. package/.codex/skills/spec-generator/SKILL.md +425 -425
  31. package/.codex/skills/spec-setup/SKILL.md +669 -669
  32. package/.codex/skills/team-designer/phases/02-scaffold-generation.md +1 -1
  33. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +402 -402
  34. package/ccw/dist/tools/index.d.ts.map +1 -1
  35. package/ccw/dist/tools/index.js +2 -0
  36. package/ccw/dist/tools/index.js.map +1 -1
  37. package/ccw/dist/tools/json-builder.d.ts +17 -0
  38. package/ccw/dist/tools/json-builder.d.ts.map +1 -0
  39. package/ccw/dist/tools/json-builder.js +746 -0
  40. package/ccw/dist/tools/json-builder.js.map +1 -0
  41. package/ccw/dist/tools/schema-registry.d.ts +71 -0
  42. package/ccw/dist/tools/schema-registry.d.ts.map +1 -0
  43. package/ccw/dist/tools/schema-registry.js +136 -0
  44. package/ccw/dist/tools/schema-registry.js.map +1 -0
  45. package/package.json +1 -1
  46. package/.claude/skills/team-iterdev/SKILL.md +0 -127
  47. package/.claude/skills/team-iterdev/roles/architect/role.md +0 -65
  48. package/.claude/skills/team-iterdev/roles/coordinator/commands/analyze.md +0 -62
  49. package/.claude/skills/team-iterdev/roles/coordinator/commands/dispatch.md +0 -234
  50. package/.claude/skills/team-iterdev/roles/coordinator/commands/monitor.md +0 -182
  51. package/.claude/skills/team-iterdev/roles/coordinator/role.md +0 -153
  52. package/.claude/skills/team-iterdev/roles/developer/role.md +0 -74
  53. package/.claude/skills/team-iterdev/roles/reviewer/role.md +0 -66
  54. package/.claude/skills/team-iterdev/roles/tester/role.md +0 -88
  55. package/.claude/skills/team-iterdev/specs/pipelines.md +0 -94
  56. package/.claude/skills/team-iterdev/specs/team-config.json +0 -172
  57. package/.codex/prompts/prep-cycle.md +0 -416
  58. package/.codex/prompts/prep-plan.md +0 -371
  59. package/.codex/skills/team-iterdev/SKILL.md +0 -219
  60. package/.codex/skills/team-iterdev/roles/architect/role.md +0 -65
  61. package/.codex/skills/team-iterdev/roles/coordinator/commands/analyze.md +0 -62
  62. package/.codex/skills/team-iterdev/roles/coordinator/commands/dispatch.md +0 -187
  63. package/.codex/skills/team-iterdev/roles/coordinator/commands/monitor.md +0 -227
  64. package/.codex/skills/team-iterdev/roles/coordinator/role.md +0 -193
  65. package/.codex/skills/team-iterdev/roles/developer/role.md +0 -74
  66. package/.codex/skills/team-iterdev/roles/reviewer/role.md +0 -66
  67. package/.codex/skills/team-iterdev/roles/tester/role.md +0 -88
  68. package/.codex/skills/team-iterdev/specs/pipelines.md +0 -94
  69. package/.codex/skills/team-iterdev/specs/team-config.json +0 -172
@@ -1,408 +1,408 @@
1
- ---
2
- name: brainstorm
3
- description: Unified brainstorming skill with dual-mode operation - auto pipeline and single role analysis. Triggers on "brainstorm", "头脑风暴".
4
- allowed-tools: Skill(*), Agent(conceptual-planning-agent, context-search-agent), AskUserQuestion(*), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*), Bash(*)
5
- ---
6
-
7
- # Brainstorm
8
-
9
- Unified brainstorming skill combining interactive framework generation, multi-role parallel analysis, and cross-role synthesis into a single entry point with two operational modes.
10
-
11
- ## Architecture Overview
12
-
13
- ```
14
- ┌─────────────────────────────────────────────────────────────┐
15
- │ /brainstorm │
16
- │ Unified Entry Point + Interactive Routing │
17
- └───────────────────────┬─────────────────────────────────────┘
18
-
19
- ┌─────────┴─────────┐
20
- ↓ ↓
21
- ┌─────────────────┐ ┌──────────────────┐
22
- │ Auto Mode │ │ Single Role Mode │
23
- │ (自动模式) │ │ (单角色分析模式) │
24
- └────────┬────────┘ └────────┬─────────┘
25
- │ │
26
- ┌────────┼────────┐ │
27
- ↓ ↓ ↓ ↓
28
- Phase 2 Phase 3 Phase 4 Phase 3
29
- Artifacts N×Role Synthesis 1×Role
30
- (7步) Analysis (8步) Analysis
31
- 并行 (4步)
32
- ```
33
-
34
- **Data Flow**:
35
- ```
36
- Auto Mode:
37
- Phase 2 (artifacts) → guidance-specification.md + selected_roles[]
38
- → Phase 3 (N × role-analysis) → {role}/analysis*.md (immutable)
39
- → Phase 4 (synthesis) → feature-specs/ + feature-index.json + synthesis-changelog.md
40
-
41
- Single Role Mode:
42
- Phase 3 (1 × role-analysis) → {role}/analysis*.md
43
- ```
44
-
45
- ## Key Design Principles
46
-
47
- 1. **Dual-Mode Routing**: Interactive mode selection via AskUserQuestion, with parameter-based auto-detection
48
- 2. **Progressive Phase Loading**: Phase files loaded on-demand via `Ref:` markers, not all at once
49
- 3. **Task Attachment/Collapse**: Sub-tasks attached during phase execution, collapsed after completion
50
- 4. **Session Continuity**: All phases share session state via workflow-session.json
51
- 5. **Auto-Continue Execution**: Phases chain automatically without user intervention between them
52
- 6. **SPEC.md Quality Alignment**: Guidance specification and role analysis follow SPEC.md standards (Concepts & Terminology, Non-Goals, Data Model, State Machine, RFC 2119 constraints)
53
- 7. **Template-Driven Analysis**: Role-specific templates (e.g., system-architect) ensure consistent, high-quality outputs
54
- 8. **Quality Gates**: Automated validation of guidance specification and role analysis against quality standards
55
-
56
- ## Auto Mode
57
-
58
- When `--yes` or `-y`: Auto-select auto mode, skip interactive routing question, auto-select recommended roles, skip all clarification questions, use default answers.
59
-
60
- ## Execution Flow
61
-
62
- ### Phase 1: Mode Detection & Interactive Routing
63
- Ref: phases/01-mode-routing.md
64
-
65
- Parse arguments, detect mode from flags/parameters, or ask user via AskUserQuestion.
66
-
67
- **Mode Detection Rules**:
68
- 1. If `--yes` or `-y` flag present → **Auto Mode** (no question asked)
69
- 2. If first arg matches a known role name → **Single Role Mode** (no question asked)
70
- 3. If `--session` flag present without role name → **Ask user**
71
- 4. Otherwise → **Ask user via AskUserQuestion**
72
-
73
- **Output**: `execution_mode` ("auto" | "single-role"), parsed parameters
74
-
75
- ---
76
-
77
- ### Auto Mode Execution (execution_mode = "auto")
78
-
79
- **Phase 1.5: Terminology & Boundary Definition**
80
- - Extract 5-10 core domain terms from user input and Phase 1 context
81
- - Generate terminology table (term, definition, aliases, category)
82
- - Collect Non-Goals via AskUserQuestion (明确排除的范围)
83
- - Store to `session.terminology` and `session.non_goals`
84
-
85
- #### Phase 2: Interactive Framework Generation
86
- Ref: phases/02-artifacts.md
87
-
88
- Seven-phase interactive workflow: Context collection → Topic analysis → Role selection → Role questions → Conflict resolution → Final check → Generate specification.
89
-
90
- **Input**: topic description, --count N, --yes flag
91
- **Output**: guidance-specification.md (with Concepts & Terminology, Non-Goals, RFC 2119 constraints), workflow-session.json (selected_roles[], session_id)
92
-
93
- **TodoWrite**: Attach 7 sub-tasks (Phase 0-5), execute sequentially, collapse on completion.
94
-
95
- #### Phase 3: Parallel Role Analysis
96
- Ref: phases/03-role-analysis.md
97
-
98
- Execute role analysis for EACH selected role in parallel.
99
-
100
- **Input**: selected_roles[] from Phase 2, session_id, guidance-specification.md
101
- **Output**: {role}/analysis*.md for each role
102
-
103
- **Parallel Execution**: Launch N role-analysis calls simultaneously (one message with multiple Skill invokes). Each role with `--skip-questions` flag.
104
-
105
- For ui-designer: append `--style-skill {package}` if provided.
106
-
107
- **Template-Driven Analysis**:
108
- - Load role-specific template if exists (e.g., `templates/role-templates/system-architect-template.md`)
109
- - Inject template into agent prompt as required structure
110
- - For system-architect: MUST include Data Model, State Machine, Error Handling, Observability, Configuration Model, Boundary Scenarios
111
-
112
- **Quality Validation**:
113
- - After analysis generation, invoke `role-analysis-reviewer-agent` to validate against template
114
- - Check MUST have sections (blocking), SHOULD have sections (warning), quality checks (RFC keywords, valid diagrams)
115
- - Output validation report with score and recommendations
116
-
117
- **TodoWrite**: Attach N parallel sub-tasks, execute concurrently, collapse on completion.
118
-
119
- #### Phase 4: Synthesis Integration
120
- Ref: phases/04-synthesis.md
121
-
122
- Six-phase synthesis: Discovery → File discovery → Cross-role analysis → User interaction → Spec generation (single agent, sequential) + Conditional review → Finalization. Role analysis files are read-only (never modified). Spec is the final synthesis artifact.
123
-
124
- **Input**: session_id from Phase 2, all role analysis files from Phase 3 (read-only)
125
- **Output**: feature-specs/, feature-index.json, synthesis-changelog.md
126
-
127
- **TodoWrite**: Attach synthesis sub-tasks, execute sequentially, collapse on completion.
128
-
129
- ---
130
-
131
- ### Single Role Mode Execution (execution_mode = "single-role")
132
-
133
- #### Phase 3: Single Role Analysis
134
- Ref: phases/03-role-analysis.md
135
-
136
- Execute role analysis for ONE specified role with optional interactive context gathering.
137
-
138
- **Input**: role_name, --session, --update, --include-questions, --skip-questions, --style-skill
139
- **Output**: {role}/analysis*.md
140
-
141
- **TodoWrite**: Attach 4 sub-tasks (Detection → Context → Agent → Validation), execute sequentially.
142
-
143
- ---
144
-
145
- **Phase Reference Documents** (read on-demand when phase executes):
146
-
147
- | Phase | Document | Purpose | Used By |
148
- |-------|----------|---------|---------|
149
- | 1 | [phases/01-mode-routing.md](phases/01-mode-routing.md) | Parameter parsing, mode detection, interactive routing | Both modes |
150
- | 2 | [phases/02-artifacts.md](phases/02-artifacts.md) | Interactive framework generation (7 phases) | Auto mode only |
151
- | 3 | [phases/03-role-analysis.md](phases/03-role-analysis.md) | Role-specific analysis generation | Both modes |
152
- | 4 | [phases/04-synthesis.md](phases/04-synthesis.md) | Cross-role synthesis and feature specs | Auto mode only |
153
-
154
- ## Core Rules
155
-
156
- 1. **Start with Mode Detection**: First action is Phase 1 (parse args + detect mode)
157
- 2. **Interactive Routing**: If mode cannot be determined from args, ASK user via AskUserQuestion
158
- 3. **No Preliminary Analysis**: Do not analyze topic before Phase 2 - artifacts handles all analysis
159
- 4. **Parse Every Output**: Extract selected_roles from workflow-session.json after Phase 2
160
- 5. **Auto-Continue via TodoList**: Check TodoList status to execute next pending phase automatically
161
- 6. **Task Attachment Model**: Skill and Task executes attach sub-tasks to current workflow
162
- 7. **⚠️ CRITICAL: DO NOT STOP**: Continuous multi-phase workflow in auto mode. After executing all attached tasks, immediately collapse them and execute next phase
163
- 8. **Parallel Execution**: Auto mode Phase 3 attaches multiple agent tasks simultaneously for concurrent execution
164
- 9. **Single Role Independence**: Single role mode operates independently without requiring artifacts or synthesis
165
-
166
- ## Input Processing
167
-
168
- ### Parameter Parsing
169
-
170
- ```javascript
171
- // Parse from user input (argument string)
172
- const args = parseArguments(user_input);
173
-
174
- // Flags
175
- const auto_yes = args.includes('--yes') || args.includes('-y');
176
- const count = extractFlag(args, '--count', 3); // default 3, max 9
177
- const session_id = extractFlag(args, '--session', null);
178
- const update_mode = args.includes('--update');
179
- const include_questions = args.includes('--include-questions');
180
- const skip_questions = args.includes('--skip-questions');
181
- const style_skill = extractFlag(args, '--style-skill', null);
182
-
183
- // Role detection
184
- const VALID_ROLES = [
185
- 'data-architect', 'product-manager', 'product-owner', 'scrum-master',
186
- 'subject-matter-expert', 'system-architect', 'test-strategist',
187
- 'ui-designer', 'ux-expert'
188
- ];
189
- const first_arg = args[0]; // first non-flag argument
190
- const is_role = VALID_ROLES.includes(first_arg);
191
-
192
- // Mode detection
193
- if (auto_yes) {
194
- execution_mode = 'auto';
195
- topic = extractTopic(args);
196
- } else if (is_role) {
197
- execution_mode = 'single-role';
198
- role_name = first_arg;
199
- } else {
200
- execution_mode = null; // Ask user
201
- topic = extractTopic(args);
202
- }
203
- ```
204
-
205
- ### Usage Examples
206
-
207
- ```bash
208
- # Auto mode - full pipeline
209
- /brainstorm "Build real-time collaboration platform" --count 3
210
- /brainstorm -y "GOAL: Build platform SCOPE: 100 users" --count 5
211
- /brainstorm "Design payment system" --style-skill material-design
212
-
213
- # Single role mode - individual analysis
214
- /brainstorm system-architect --session WFS-xxx
215
- /brainstorm ux-expert --include-questions
216
- /brainstorm ui-designer --session WFS-xxx --update --style-skill material-design
217
- /brainstorm product-manager --skip-questions
218
-
219
- # Ambiguous - will ask interactively
220
- /brainstorm --session WFS-xxx
221
- /brainstorm
222
- ```
223
-
224
- ## Data Flow
225
-
226
- ```
227
- Phase 1 (Mode Routing):
228
- Input: user arguments
229
- Output: execution_mode, parsed_params
230
-
231
- ┌───────┴───────┐
232
- Auto Single Role
233
- ↓ ↓
234
- Phase 2: Phase 3:
235
- Input: topic, count, auto_yes
236
- Output: session_id ─────────────→ Input: role_name, session_id
237
- selected_roles[] skip/include questions
238
- guidance-specification.md style_skill
239
- ↓ Output: {role}/analysis*.md
240
- Phase 3:
241
- Input: selected_roles[], session_id
242
- guidance-specification.md
243
- style_skill (for ui-designer)
244
- Output: {role}/analysis*.md (N files, immutable after this point)
245
-
246
- Phase 4:
247
- Input: session_id, all analysis files (read-only)
248
- Output: feature-specs/F-{id}-{slug}.md
249
- feature-index.json
250
- synthesis-changelog.md
251
- ```
252
-
253
- ## TodoWrite Pattern
254
-
255
- ### Auto Mode Lifecycle
256
-
257
- ```
258
- Initial → Phase 1 Mode Routing (completed)
259
- → Phase 2 Artifacts (in_progress)
260
- → 7 sub-tasks ATTACHED (Phase 0-5)
261
- → Execute sequentially
262
- → Sub-tasks COLLAPSED
263
- → Phase 3 Parallel Role Analysis (in_progress)
264
- → N role sub-tasks ATTACHED simultaneously
265
- → Execute concurrently
266
- → Sub-tasks COLLAPSED
267
- → Phase 4 Synthesis (in_progress)
268
- → 8 sub-tasks ATTACHED
269
- → Execute sequentially
270
- → Sub-tasks COLLAPSED
271
- → All completed
272
- ```
273
-
274
- ### Single Role Mode Lifecycle
275
-
276
- ```
277
- Initial → Phase 1 Mode Routing (completed)
278
- → Phase 3 Role Analysis (in_progress)
279
- → 4 sub-tasks ATTACHED (Detection → Context → Agent → Validation)
280
- → Execute sequentially
281
- → Sub-tasks COLLAPSED
282
- → Completed
283
- ```
284
-
285
- ### Initial TodoWrite (Auto Mode)
286
-
287
- ```json
288
- [
289
- {"content": "Phase 1: Mode detection and parameter parsing", "status": "in_progress", "activeForm": "Detecting mode"},
290
- {"content": "Phase 2: Interactive Framework Generation", "status": "pending", "activeForm": "Generating framework"},
291
- {"content": "Phase 3: Parallel Role Analysis", "status": "pending", "activeForm": "Executing parallel analysis"},
292
- {"content": "Phase 4: Synthesis Integration", "status": "pending", "activeForm": "Executing synthesis"}
293
- ]
294
- ```
295
-
296
- ### Initial TodoWrite (Single Role Mode)
297
-
298
- ```json
299
- [
300
- {"content": "Phase 1: Mode detection and parameter parsing", "status": "in_progress", "activeForm": "Detecting mode"},
301
- {"content": "Phase 3: Single role analysis for {role_name}", "status": "pending", "activeForm": "Executing role analysis"}
302
- ]
303
- ```
304
-
305
- ## Session Management
306
-
307
- **⚡ FIRST ACTION**: Check `.workflow/active/` for existing sessions
308
-
309
- **Multiple Sessions Support**:
310
- - Different Claude instances can have different brainstorming sessions
311
- - If multiple sessions found, prompt user to select
312
- - If single session found, use it
313
- - If no session exists:
314
- - Auto mode: Create `WFS-[topic-slug]`
315
- - Single role mode: ERROR if no session (must run auto mode first)
316
-
317
- **Session Continuity**: All phases share session state via `workflow-session.json`
318
-
319
- ## Available Roles
320
-
321
- | Role ID | Title | Focus Area |
322
- |---------|-------|------------|
323
- | `data-architect` | 数据架构师 | Data models, storage strategies, data flow |
324
- | `product-manager` | 产品经理 | Product strategy, roadmap, prioritization |
325
- | `product-owner` | 产品负责人 | Backlog management, user stories, acceptance criteria |
326
- | `scrum-master` | 敏捷教练 | Process facilitation, impediment removal |
327
- | `subject-matter-expert` | 领域专家 | Domain knowledge, business rules, compliance |
328
- | `system-architect` | 系统架构师 | Technical architecture, scalability, integration |
329
- | `test-strategist` | 测试策略师 | Test strategy, quality assurance |
330
- | `ui-designer` | UI设计师 | Visual design, mockups, design systems |
331
- | `ux-expert` | UX专家 | User research, information architecture, journey |
332
-
333
- **Role Selection**: Auto mode → handled by artifacts (Phase 2). Single role mode → user specifies directly.
334
-
335
- ## Output Structure
336
-
337
- ```
338
- .workflow/active/WFS-{topic}/
339
- ├── workflow-session.json # Session metadata ONLY
340
- ├── .process/
341
- │ └── context-package.json # Phase 0 output (auto mode)
342
- └── .brainstorming/
343
- ├── guidance-specification.md # Framework (Phase 2, auto mode)
344
- ├── feature-index.json # Feature index (Phase 4, auto mode, feature_mode)
345
- ├── synthesis-changelog.md # Synthesis decisions audit trail (Phase 4, auto mode)
346
- ├── feature-specs/ # Feature specs (Phase 4, auto mode, feature_mode)
347
- │ ├── F-001-{slug}.md
348
- │ └── F-00N-{slug}.md
349
- ├── specs/
350
- │ └── terminology-template.json # Terminology schema
351
- ├── templates/
352
- │ └── role-templates/
353
- │ └── system-architect-template.md # System architect analysis template
354
- ├── agents/
355
- │ └── role-analysis-reviewer-agent.md # Role analysis validation agent
356
- ├── {role}/ # Role analyses (IMMUTABLE after Phase 3)
357
- │ ├── {role}-context.md # Interactive Q&A responses
358
- │ ├── analysis.md # Main/index document
359
- │ ├── analysis-cross-cutting.md # Cross-feature (feature_mode)
360
- │ └── analysis-F-{id}-{slug}.md # Per-feature (feature_mode)
361
- └── synthesis-specification.md # Integration (Phase 4, non-feature_mode only)
362
- ```
363
-
364
- ## Error Handling
365
-
366
- | Error | Recovery | Mode |
367
- |-------|----------|------|
368
- | Invalid role name | Show valid roles list, ask again | Single Role |
369
- | No active session | Auto mode: create new. Single role: error with guidance | Both |
370
- | Role selection failure | Default to product-manager | Auto |
371
- | Agent execution failure | Agent-specific retry with minimal dependencies | Both |
372
- | Template loading issues | Graceful degradation | Both |
373
- | Synthesis conflicts | Highlight disagreements without forced resolution | Auto |
374
- | Context overflow (>100KB) | Read only analysis.md index files | Auto |
375
-
376
- **Context Overflow Protection**:
377
- - Per-role limits: < 3000 words main, < 2000 words sub-docs, max 5 sub-docs
378
- - Synthesis protection: If total > 100KB, read only `analysis.md` (not sub-documents)
379
- - Recovery: reduce scope (--count 2) → use --summary-only → manual synthesis
380
-
381
- ## Coordinator Checklist
382
-
383
- **Pre-Phase Actions**:
384
- - [ ] Read Phase document via `Ref:` marker
385
- - [ ] Verify prerequisites (session exists, required files present)
386
- - [ ] Mark phase as `in_progress` in TodoWrite
387
- - [ ] Attach sub-tasks if applicable
388
-
389
- **Post-Phase Actions**:
390
- - [ ] Validate phase outputs exist
391
- - [ ] Collapse sub-tasks to phase summary
392
- - [ ] Mark phase as `completed` in TodoWrite
393
- - [ ] Auto-continue to next pending phase (auto mode)
394
- - [ ] Report completion (single role mode)
395
-
396
- ## Related Commands
397
-
398
- **Prerequisites**:
399
- - `/workflow:session:start` - Start a new workflow session (optional, brainstorm creates its own)
400
-
401
- **Follow-ups** (after brainstorm completes):
402
- - `/workflow-plan --session {sessionId}` - Generate implementation plan
403
- - `/workflow:brainstorm:synthesis --session {sessionId}` - Run synthesis standalone (if skipped)
404
-
405
- ## Reference Information
406
-
407
- **Template Source**: `~/.ccw/workflows/cli-templates/planning-roles/`
408
- **Style SKILL Packages**: `.claude/skills/style-{package-name}/`
1
+ ---
2
+ name: brainstorm
3
+ description: Unified brainstorming skill with dual-mode operation auto mode (framework generation, parallel multi-role analysis, cross-role synthesis) and single role analysis. Triggers on "brainstorm", "头脑风暴".
4
+ allowed-tools: Skill(*), Agent(conceptual-planning-agent, context-search-agent), AskUserQuestion(*), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*), Bash(*)
5
+ ---
6
+
7
+ # Brainstorm
8
+
9
+ Unified brainstorming skill combining interactive framework generation, multi-role parallel analysis, and cross-role synthesis into a single entry point with two operational modes.
10
+
11
+ ## Architecture Overview
12
+
13
+ ```
14
+ ┌─────────────────────────────────────────────────────────────┐
15
+ │ /brainstorm │
16
+ │ Unified Entry Point + Interactive Routing │
17
+ └───────────────────────┬─────────────────────────────────────┘
18
+
19
+ ┌─────────┴─────────┐
20
+ ↓ ↓
21
+ ┌─────────────────┐ ┌──────────────────┐
22
+ │ Auto Mode │ │ Single Role Mode │
23
+ │ (自动模式) │ │ (单角色分析模式) │
24
+ └────────┬────────┘ └────────┬─────────┘
25
+ │ │
26
+ ┌────────┼────────┐ │
27
+ ↓ ↓ ↓ ↓
28
+ Phase 2 Phase 3 Phase 4 Phase 3
29
+ Artifacts N×Role Synthesis 1×Role
30
+ (7步) Analysis (8步) Analysis
31
+ 并行 (4步)
32
+ ```
33
+
34
+ **Data Flow**:
35
+ ```
36
+ Auto Mode:
37
+ Phase 2 (artifacts) → guidance-specification.md + selected_roles[]
38
+ → Phase 3 (N × role-analysis) → {role}/analysis*.md (immutable)
39
+ → Phase 4 (synthesis) → feature-specs/ + feature-index.json + synthesis-changelog.md
40
+
41
+ Single Role Mode:
42
+ Phase 3 (1 × role-analysis) → {role}/analysis*.md
43
+ ```
44
+
45
+ ## Key Design Principles
46
+
47
+ 1. **Dual-Mode Routing**: Interactive mode selection via AskUserQuestion, with parameter-based auto-detection
48
+ 2. **Progressive Phase Loading**: Phase files loaded on-demand via `Ref:` markers, not all at once
49
+ 3. **Task Attachment/Collapse**: Sub-tasks attached during phase execution, collapsed after completion
50
+ 4. **Session Continuity**: All phases share session state via workflow-session.json
51
+ 5. **Auto-Continue Execution**: Phases chain automatically without user intervention between them
52
+ 6. **SPEC.md Quality Alignment**: Guidance specification and role analysis follow SPEC.md standards (Concepts & Terminology, Non-Goals, Data Model, State Machine, RFC 2119 constraints)
53
+ 7. **Template-Driven Analysis**: Role-specific templates (e.g., system-architect) ensure consistent, high-quality outputs
54
+ 8. **Quality Gates**: Automated validation of guidance specification and role analysis against quality standards
55
+
56
+ ## Auto Mode
57
+
58
+ When `--yes` or `-y`: Auto-select auto mode, skip interactive routing question, auto-select recommended roles, skip all clarification questions, use default answers.
59
+
60
+ ## Execution Flow
61
+
62
+ ### Phase 1: Mode Detection & Interactive Routing
63
+ Ref: phases/01-mode-routing.md
64
+
65
+ Parse arguments, detect mode from flags/parameters, or ask user via AskUserQuestion.
66
+
67
+ **Mode Detection Rules**:
68
+ 1. If `--yes` or `-y` flag present → **Auto Mode** (no question asked)
69
+ 2. If first arg matches a known role name → **Single Role Mode** (no question asked)
70
+ 3. If `--session` flag present without role name → **Ask user**
71
+ 4. Otherwise → **Ask user via AskUserQuestion**
72
+
73
+ **Output**: `execution_mode` ("auto" | "single-role"), parsed parameters
74
+
75
+ ---
76
+
77
+ ### Auto Mode Execution (execution_mode = "auto")
78
+
79
+ **Phase 1.5: Terminology & Boundary Definition**
80
+ - Extract 5-10 core domain terms from user input and Phase 1 context
81
+ - Generate terminology table (term, definition, aliases, category)
82
+ - Collect Non-Goals via AskUserQuestion (明确排除的范围)
83
+ - Store to `session.terminology` and `session.non_goals`
84
+
85
+ #### Phase 2: Interactive Framework Generation
86
+ Ref: phases/02-artifacts.md
87
+
88
+ Seven-phase interactive workflow: Context collection → Topic analysis → Role selection → Role questions → Conflict resolution → Final check → Generate specification.
89
+
90
+ **Input**: topic description, --count N, --yes flag
91
+ **Output**: guidance-specification.md (with Concepts & Terminology, Non-Goals, RFC 2119 constraints), workflow-session.json (selected_roles[], session_id)
92
+
93
+ **TodoWrite**: Attach 7 sub-tasks (Phase 0-5), execute sequentially, collapse on completion.
94
+
95
+ #### Phase 3: Parallel Role Analysis
96
+ Ref: phases/03-role-analysis.md
97
+
98
+ Execute role analysis for EACH selected role in parallel.
99
+
100
+ **Input**: selected_roles[] from Phase 2, session_id, guidance-specification.md
101
+ **Output**: {role}/analysis*.md for each role
102
+
103
+ **Parallel Execution**: Launch N role-analysis calls simultaneously (one message with multiple Skill invokes). Each role with `--skip-questions` flag.
104
+
105
+ For ui-designer: append `--style-skill {package}` if provided.
106
+
107
+ **Template-Driven Analysis**:
108
+ - Load role-specific template if exists (e.g., `templates/role-templates/system-architect-template.md`)
109
+ - Inject template into agent prompt as required structure
110
+ - For system-architect: MUST include Data Model, State Machine, Error Handling, Observability, Configuration Model, Boundary Scenarios
111
+
112
+ **Quality Validation**:
113
+ - After analysis generation, invoke `role-analysis-reviewer-agent` to validate against template
114
+ - Check MUST have sections (blocking), SHOULD have sections (warning), quality checks (RFC keywords, valid diagrams)
115
+ - Output validation report with score and recommendations
116
+
117
+ **TodoWrite**: Attach N parallel sub-tasks, execute concurrently, collapse on completion.
118
+
119
+ #### Phase 4: Synthesis Integration
120
+ Ref: phases/04-synthesis.md
121
+
122
+ Six-phase synthesis: Discovery → File discovery → Cross-role analysis → User interaction → Spec generation (single agent, sequential) + Conditional review → Finalization. Role analysis files are read-only (never modified). Spec is the final synthesis artifact.
123
+
124
+ **Input**: session_id from Phase 2, all role analysis files from Phase 3 (read-only)
125
+ **Output**: feature-specs/, feature-index.json, synthesis-changelog.md
126
+
127
+ **TodoWrite**: Attach synthesis sub-tasks, execute sequentially, collapse on completion.
128
+
129
+ ---
130
+
131
+ ### Single Role Mode Execution (execution_mode = "single-role")
132
+
133
+ #### Phase 3: Single Role Analysis
134
+ Ref: phases/03-role-analysis.md
135
+
136
+ Execute role analysis for ONE specified role with optional interactive context gathering.
137
+
138
+ **Input**: role_name, --session, --update, --include-questions, --skip-questions, --style-skill
139
+ **Output**: {role}/analysis*.md
140
+
141
+ **TodoWrite**: Attach 4 sub-tasks (Detection → Context → Agent → Validation), execute sequentially.
142
+
143
+ ---
144
+
145
+ **Phase Reference Documents** (read on-demand when phase executes):
146
+
147
+ | Phase | Document | Purpose | Used By |
148
+ |-------|----------|---------|---------|
149
+ | 1 | [phases/01-mode-routing.md](phases/01-mode-routing.md) | Parameter parsing, mode detection, interactive routing | Both modes |
150
+ | 2 | [phases/02-artifacts.md](phases/02-artifacts.md) | Interactive framework generation (7 phases) | Auto mode only |
151
+ | 3 | [phases/03-role-analysis.md](phases/03-role-analysis.md) | Role-specific analysis generation | Both modes |
152
+ | 4 | [phases/04-synthesis.md](phases/04-synthesis.md) | Cross-role synthesis and feature specs | Auto mode only |
153
+
154
+ ## Core Rules
155
+
156
+ 1. **Start with Mode Detection**: First action is Phase 1 (parse args + detect mode)
157
+ 2. **Interactive Routing**: If mode cannot be determined from args, ASK user via AskUserQuestion
158
+ 3. **No Preliminary Analysis**: Do not analyze topic before Phase 2 - artifacts handles all analysis
159
+ 4. **Parse Every Output**: Extract selected_roles from workflow-session.json after Phase 2
160
+ 5. **Auto-Continue via TodoList**: Check TodoList status to execute next pending phase automatically
161
+ 6. **Task Attachment Model**: Skill and Task executes attach sub-tasks to current workflow
162
+ 7. **⚠️ CRITICAL: DO NOT STOP**: Continuous multi-phase workflow in auto mode. After executing all attached tasks, immediately collapse them and execute next phase
163
+ 8. **Parallel Execution**: Auto mode Phase 3 attaches multiple agent tasks simultaneously for concurrent execution
164
+ 9. **Single Role Independence**: Single role mode operates independently without requiring artifacts or synthesis
165
+
166
+ ## Input Processing
167
+
168
+ ### Parameter Parsing
169
+
170
+ ```javascript
171
+ // Parse from user input (argument string)
172
+ const args = parseArguments(user_input);
173
+
174
+ // Flags
175
+ const auto_yes = args.includes('--yes') || args.includes('-y');
176
+ const count = extractFlag(args, '--count', 3); // default 3, max 9
177
+ const session_id = extractFlag(args, '--session', null);
178
+ const update_mode = args.includes('--update');
179
+ const include_questions = args.includes('--include-questions');
180
+ const skip_questions = args.includes('--skip-questions');
181
+ const style_skill = extractFlag(args, '--style-skill', null);
182
+
183
+ // Role detection
184
+ const VALID_ROLES = [
185
+ 'data-architect', 'product-manager', 'product-owner', 'scrum-master',
186
+ 'subject-matter-expert', 'system-architect', 'test-strategist',
187
+ 'ui-designer', 'ux-expert'
188
+ ];
189
+ const first_arg = args[0]; // first non-flag argument
190
+ const is_role = VALID_ROLES.includes(first_arg);
191
+
192
+ // Mode detection
193
+ if (auto_yes) {
194
+ execution_mode = 'auto';
195
+ topic = extractTopic(args);
196
+ } else if (is_role) {
197
+ execution_mode = 'single-role';
198
+ role_name = first_arg;
199
+ } else {
200
+ execution_mode = null; // Ask user
201
+ topic = extractTopic(args);
202
+ }
203
+ ```
204
+
205
+ ### Usage Examples
206
+
207
+ ```bash
208
+ # Auto mode - full pipeline
209
+ /brainstorm "Build real-time collaboration platform" --count 3
210
+ /brainstorm -y "GOAL: Build platform SCOPE: 100 users" --count 5
211
+ /brainstorm "Design payment system" --style-skill material-design
212
+
213
+ # Single role mode - individual analysis
214
+ /brainstorm system-architect --session WFS-xxx
215
+ /brainstorm ux-expert --include-questions
216
+ /brainstorm ui-designer --session WFS-xxx --update --style-skill material-design
217
+ /brainstorm product-manager --skip-questions
218
+
219
+ # Ambiguous - will ask interactively
220
+ /brainstorm --session WFS-xxx
221
+ /brainstorm
222
+ ```
223
+
224
+ ## Data Flow
225
+
226
+ ```
227
+ Phase 1 (Mode Routing):
228
+ Input: user arguments
229
+ Output: execution_mode, parsed_params
230
+
231
+ ┌───────┴───────┐
232
+ Auto Single Role
233
+ ↓ ↓
234
+ Phase 2: Phase 3:
235
+ Input: topic, count, auto_yes
236
+ Output: session_id ─────────────→ Input: role_name, session_id
237
+ selected_roles[] skip/include questions
238
+ guidance-specification.md style_skill
239
+ ↓ Output: {role}/analysis*.md
240
+ Phase 3:
241
+ Input: selected_roles[], session_id
242
+ guidance-specification.md
243
+ style_skill (for ui-designer)
244
+ Output: {role}/analysis*.md (N files, immutable after this point)
245
+
246
+ Phase 4:
247
+ Input: session_id, all analysis files (read-only)
248
+ Output: feature-specs/F-{id}-{slug}.md
249
+ feature-index.json
250
+ synthesis-changelog.md
251
+ ```
252
+
253
+ ## TodoWrite Pattern
254
+
255
+ ### Auto Mode Lifecycle
256
+
257
+ ```
258
+ Initial → Phase 1 Mode Routing (completed)
259
+ → Phase 2 Artifacts (in_progress)
260
+ → 7 sub-tasks ATTACHED (Phase 0-5)
261
+ → Execute sequentially
262
+ → Sub-tasks COLLAPSED
263
+ → Phase 3 Parallel Role Analysis (in_progress)
264
+ → N role sub-tasks ATTACHED simultaneously
265
+ → Execute concurrently
266
+ → Sub-tasks COLLAPSED
267
+ → Phase 4 Synthesis (in_progress)
268
+ → 8 sub-tasks ATTACHED
269
+ → Execute sequentially
270
+ → Sub-tasks COLLAPSED
271
+ → All completed
272
+ ```
273
+
274
+ ### Single Role Mode Lifecycle
275
+
276
+ ```
277
+ Initial → Phase 1 Mode Routing (completed)
278
+ → Phase 3 Role Analysis (in_progress)
279
+ → 4 sub-tasks ATTACHED (Detection → Context → Agent → Validation)
280
+ → Execute sequentially
281
+ → Sub-tasks COLLAPSED
282
+ → Completed
283
+ ```
284
+
285
+ ### Initial TodoWrite (Auto Mode)
286
+
287
+ ```json
288
+ [
289
+ {"content": "Phase 1: Mode detection and parameter parsing", "status": "in_progress", "activeForm": "Detecting mode"},
290
+ {"content": "Phase 2: Interactive Framework Generation", "status": "pending", "activeForm": "Generating framework"},
291
+ {"content": "Phase 3: Parallel Role Analysis", "status": "pending", "activeForm": "Executing parallel analysis"},
292
+ {"content": "Phase 4: Synthesis Integration", "status": "pending", "activeForm": "Executing synthesis"}
293
+ ]
294
+ ```
295
+
296
+ ### Initial TodoWrite (Single Role Mode)
297
+
298
+ ```json
299
+ [
300
+ {"content": "Phase 1: Mode detection and parameter parsing", "status": "in_progress", "activeForm": "Detecting mode"},
301
+ {"content": "Phase 3: Single role analysis for {role_name}", "status": "pending", "activeForm": "Executing role analysis"}
302
+ ]
303
+ ```
304
+
305
+ ## Session Management
306
+
307
+ **⚡ FIRST ACTION**: Check `.workflow/active/` for existing sessions
308
+
309
+ **Multiple Sessions Support**:
310
+ - Different Claude instances can have different brainstorming sessions
311
+ - If multiple sessions found, prompt user to select
312
+ - If single session found, use it
313
+ - If no session exists:
314
+ - Auto mode: Create `WFS-[topic-slug]`
315
+ - Single role mode: ERROR if no session (must run auto mode first)
316
+
317
+ **Session Continuity**: All phases share session state via `workflow-session.json`
318
+
319
+ ## Available Roles
320
+
321
+ | Role ID | Title | Focus Area |
322
+ |---------|-------|------------|
323
+ | `data-architect` | 数据架构师 | Data models, storage strategies, data flow |
324
+ | `product-manager` | 产品经理 | Product strategy, roadmap, prioritization |
325
+ | `product-owner` | 产品负责人 | Backlog management, user stories, acceptance criteria |
326
+ | `scrum-master` | 敏捷教练 | Process facilitation, impediment removal |
327
+ | `subject-matter-expert` | 领域专家 | Domain knowledge, business rules, compliance |
328
+ | `system-architect` | 系统架构师 | Technical architecture, scalability, integration |
329
+ | `test-strategist` | 测试策略师 | Test strategy, quality assurance |
330
+ | `ui-designer` | UI设计师 | Visual design, mockups, design systems |
331
+ | `ux-expert` | UX专家 | User research, information architecture, journey |
332
+
333
+ **Role Selection**: Auto mode → handled by artifacts (Phase 2). Single role mode → user specifies directly.
334
+
335
+ ## Output Structure
336
+
337
+ ```
338
+ .workflow/active/WFS-{topic}/
339
+ ├── workflow-session.json # Session metadata ONLY
340
+ ├── .process/
341
+ │ └── context-package.json # Phase 0 output (auto mode)
342
+ └── .brainstorming/
343
+ ├── guidance-specification.md # Framework (Phase 2, auto mode)
344
+ ├── feature-index.json # Feature index (Phase 4, auto mode, feature_mode)
345
+ ├── synthesis-changelog.md # Synthesis decisions audit trail (Phase 4, auto mode)
346
+ ├── feature-specs/ # Feature specs (Phase 4, auto mode, feature_mode)
347
+ │ ├── F-001-{slug}.md
348
+ │ └── F-00N-{slug}.md
349
+ ├── specs/
350
+ │ └── terminology-template.json # Terminology schema
351
+ ├── templates/
352
+ │ └── role-templates/
353
+ │ └── system-architect-template.md # System architect analysis template
354
+ ├── agents/
355
+ │ └── role-analysis-reviewer-agent.md # Role analysis validation agent
356
+ ├── {role}/ # Role analyses (IMMUTABLE after Phase 3)
357
+ │ ├── {role}-context.md # Interactive Q&A responses
358
+ │ ├── analysis.md # Main/index document
359
+ │ ├── analysis-cross-cutting.md # Cross-feature (feature_mode)
360
+ │ └── analysis-F-{id}-{slug}.md # Per-feature (feature_mode)
361
+ └── synthesis-specification.md # Integration (Phase 4, non-feature_mode only)
362
+ ```
363
+
364
+ ## Error Handling
365
+
366
+ | Error | Recovery | Mode |
367
+ |-------|----------|------|
368
+ | Invalid role name | Show valid roles list, ask again | Single Role |
369
+ | No active session | Auto mode: create new. Single role: error with guidance | Both |
370
+ | Role selection failure | Default to product-manager | Auto |
371
+ | Agent execution failure | Agent-specific retry with minimal dependencies | Both |
372
+ | Template loading issues | Graceful degradation | Both |
373
+ | Synthesis conflicts | Highlight disagreements without forced resolution | Auto |
374
+ | Context overflow (>100KB) | Read only analysis.md index files | Auto |
375
+
376
+ **Context Overflow Protection**:
377
+ - Per-role limits: < 3000 words main, < 2000 words sub-docs, max 5 sub-docs
378
+ - Synthesis protection: If total > 100KB, read only `analysis.md` (not sub-documents)
379
+ - Recovery: reduce scope (--count 2) → use --summary-only → manual synthesis
380
+
381
+ ## Coordinator Checklist
382
+
383
+ **Pre-Phase Actions**:
384
+ - [ ] Read Phase document via `Ref:` marker
385
+ - [ ] Verify prerequisites (session exists, required files present)
386
+ - [ ] Mark phase as `in_progress` in TodoWrite
387
+ - [ ] Attach sub-tasks if applicable
388
+
389
+ **Post-Phase Actions**:
390
+ - [ ] Validate phase outputs exist
391
+ - [ ] Collapse sub-tasks to phase summary
392
+ - [ ] Mark phase as `completed` in TodoWrite
393
+ - [ ] Auto-continue to next pending phase (auto mode)
394
+ - [ ] Report completion (single role mode)
395
+
396
+ ## Related Commands
397
+
398
+ **Prerequisites**:
399
+ - `/workflow:session:start` - Start a new workflow session (optional, brainstorm creates its own)
400
+
401
+ **Follow-ups** (after brainstorm completes):
402
+ - `/workflow-plan --session {sessionId}` - Generate implementation plan
403
+ - `/workflow:brainstorm:synthesis --session {sessionId}` - Run synthesis standalone (if skipped)
404
+
405
+ ## Reference Information
406
+
407
+ **Template Source**: `~/.ccw/workflows/cli-templates/planning-roles/`
408
+ **Style SKILL Packages**: `.claude/skills/style-{package-name}/`