ai-workflow-init 6.4.2 → 6.6.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 (29) hide show
  1. package/.claude/agents/requirement-ba.md +203 -0
  2. package/.claude/agents/requirement-researcher.md +270 -0
  3. package/.claude/agents/requirement-sa.md +259 -0
  4. package/.claude/agents/requirement-uiux.md +349 -0
  5. package/.claude/commands/beads-breakdown.md +278 -0
  6. package/.claude/commands/beads-create-epic-plan.md +205 -0
  7. package/.claude/commands/beads-done.md +248 -0
  8. package/.claude/commands/beads-next.md +260 -0
  9. package/.claude/commands/beads-status.md +247 -0
  10. package/.claude/commands/clarify-requirements.md +445 -192
  11. package/.claude/commands/create-plan.md +79 -2
  12. package/.claude/commands/execute-plan.md +48 -2
  13. package/.claude/settings.json +3 -3
  14. package/.claude/skills/skill-creator/SKILL.md +355 -0
  15. package/.claude/skills/skill-creator/references/output-patterns.md +82 -0
  16. package/.claude/skills/skill-creator/references/workflows.md +28 -0
  17. package/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
  18. package/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  19. package/.claude/skills/skill-creator/scripts/quick_validate.py +95 -0
  20. package/README.md +97 -3
  21. package/cli.js +21 -1
  22. package/docs/ai/planning/epic-template.md +155 -0
  23. package/docs/ai/planning/feature-template.md +19 -0
  24. package/docs/ai/requirements/req-template.md +164 -58
  25. package/docs/ai/requirements/templates/ba-template.md +151 -0
  26. package/docs/ai/requirements/templates/research-template.md +190 -0
  27. package/docs/ai/requirements/templates/sa-template.md +184 -0
  28. package/docs/ai/requirements/templates/uiux-template.md +325 -0
  29. package/package.json +1 -1
@@ -1,287 +1,540 @@
1
1
  ---
2
2
  name: clarify-requirements
3
- description: Clarify and document requirements through iterative Q&A sessions. (project)
3
+ description: Requirement Orchestrator - Coordinates BA, SA, Researcher, and UI/UX agents to produce comprehensive requirements.
4
4
  ---
5
5
 
6
6
  ## Goal
7
7
 
8
- Facilitate requirement gathering through structured Q&A sessions. Output a comprehensive requirement document at `docs/ai/requirements/req-{name}.md` that can be used as input for `/create-plan`.
8
+ Orchestrate requirement gathering through specialized agents to produce a comprehensive requirement document at `docs/ai/requirements/req-{name}.md`.
9
9
 
10
- ## When to Use
10
+ This command coordinates:
11
+ - **BA Agent**: Business analysis, user stories, functional requirements
12
+ - **SA Agent**: Technical feasibility, architecture recommendations
13
+ - **Researcher Agent**: Domain terminology, external research (conditional)
14
+ - **UI/UX Agent**: Wireframes, screen flows (conditional)
11
15
 
12
- - Complex features requiring multiple clarification rounds
13
- - Business logic is unclear or needs detailed specification
14
- - Design decisions need to be documented before planning
15
- - Stakeholder input needs to be captured and organized
16
+ ---
16
17
 
17
18
  ## Workflow Alignment
18
19
 
19
20
  - Provide brief status updates (1–3 sentences) before/after important actions.
20
21
  - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
21
22
  - Update todos immediately after progress; mark completed upon finish.
23
+ - Run agents in parallel where possible to optimize performance.
22
24
 
23
25
  ---
24
26
 
25
- ## Step 1: Analyze Initial Request
26
-
27
- **Parse user request to identify:**
28
- - **Feature scope**: What is the user trying to build?
29
- - **Feature type**: Backend-only, Frontend-only, Full-stack, Data/API, etc.
30
- - **Clarity level**: What's clear vs. ambiguous?
31
- - **Missing information**: What needs clarification?
32
- - **Complexity indicators**: Simple (skip this skill) vs. complex (proceed)
33
- - **Domain complexity**: Detect specialized terminology (finance, medical, legal, etc.)
34
- - **Existing requirement**: Check if user references existing `req-{name}.md` file
35
-
36
- **If feature is simple** (can be fully specified in 1-2 Q&A rounds):
37
- - Suggest: "This feature seems straightforward. Consider using `/create-plan` directly."
38
- - Proceed only if user confirms they want detailed requirement doc.
39
-
40
- **If existing requirement doc detected:**
41
- - Read the existing file: `Read(file_path="docs/ai/requirements/req-{name}.md")`
42
- - Ask user: "Found existing requirement doc. What would you like to do?"
43
- - Options:
44
- - "Update existing" → Load content, identify gaps, continue Q&A from where it left off
45
- - "Start fresh" → Backup existing to archive, create new
46
- - "Review only" → Display current content, ask for specific sections to update
47
-
48
- **Output:**
49
- - List of areas needing clarification
50
- - Recommended rounds to skip (based on feature type)
51
- - Flag if Glossary section is needed (domain-specific terms detected)
52
- - Mode: "new" | "update" | "review"
27
+ ## Step 0: Pre-flight Check
28
+
29
+ ### Check for Existing Requirement
30
+
31
+ **If user mentions existing requirement doc:**
32
+
33
+ ```
34
+ Read(file_path="docs/ai/requirements/req-{name}.md")
35
+ ```
36
+
37
+ **Ask user:**
38
+ ```
39
+ AskUserQuestion(questions=[{
40
+ question: "Found existing requirement doc. What would you like to do?",
41
+ header: "Mode",
42
+ options: [
43
+ { label: "Update existing", description: "Enhance with new agents, fill gaps" },
44
+ { label: "Start fresh", description: "Archive current, create new" },
45
+ { label: "Review only", description: "Show current state, identify gaps" }
46
+ ],
47
+ multiSelect: false
48
+ }])
49
+ ```
50
+
51
+ - **Update**: Load existing, identify what's missing, run relevant agents
52
+ - **Fresh**: Backup to `archive/`, start from scratch
53
+ - **Review**: Display summary, suggest next steps
53
54
 
54
55
  ---
55
56
 
56
- ## Step 2: Structured Q&A Session
57
+ ## Step 1: Analyze User Prompt
57
58
 
58
- **Purpose:** Gather requirements through focused questions. This step may repeat multiple times.
59
+ ### Parse Request
59
60
 
60
- **Tool:** AskUserQuestion(questions=[...])
61
+ Analyze user prompt to determine:
61
62
 
62
- ### Smart Round Selection
63
+ | Aspect | Detection Method | Output |
64
+ |--------|------------------|--------|
65
+ | **Feature Type** | Keywords: UI, API, page, endpoint, database | `UI` / `API` / `Data` / `Full-stack` |
66
+ | **Complexity** | Scope indicators, number of features | `Simple` / `Medium` / `Complex` |
67
+ | **Domain Terms** | Industry jargon, unfamiliar terms | List of terms needing research |
68
+ | **UI Components** | Mentions of screens, forms, flows | Boolean: needs UI/UX |
69
+ | **Clarity Level** | How specific is the request | `Clear` / `Vague` / `Very Vague` |
63
70
 
64
- Before each round, evaluate relevance based on:
65
- - **Feature type** from Step 1
66
- - **Previous answers** collected
71
+ ### Determine Agent Strategy
67
72
 
68
- **Skip Round Logic:**
69
- | Feature Type | Skip Rounds |
70
- |--------------|-------------|
71
- | Backend-only / API | Round 2 (User Flows) if no UI |
72
- | Data processing | Round 4 (Edge Cases) → ask minimal |
73
- | Simple CRUD | Round 3 (Business Rules) if straightforward |
74
- | UI-only | Round 5 (Performance/Security) → ask minimal |
73
+ Based on analysis:
75
74
 
76
- **Before skipping, confirm with user:**
77
- > "Based on your answers, Round {N} ({topic}) seems less relevant for this feature. Should we skip it or cover briefly?"
75
+ | Scenario | Agents to Run | Execution |
76
+ |----------|---------------|-----------|
77
+ | Simple API feature | BA → SA | Sequential |
78
+ | Complex API feature | BA → SA | Sequential |
79
+ | Simple UI feature | BA + SA (parallel) → UI/UX | Mixed |
80
+ | Complex full-stack | BA → SA → UI/UX | Sequential |
81
+ | Domain-specific | BA + Researcher (parallel) → SA → UI/UX | Mixed |
82
+ | Very vague request | BA only first | Single, then reassess |
78
83
 
79
- Options: "Skip entirely", "Cover briefly (1-2 questions)", "Cover in full"
84
+ ### Decision Output
80
85
 
81
- ---
86
+ ```markdown
87
+ ## Prompt Analysis
82
88
 
83
- ### Question Categories (ask in priority order, 2-4 questions per round):
89
+ **Feature**: {derived name}
90
+ **Type**: {UI / API / Full-stack / Data}
91
+ **Complexity**: {Simple / Medium / Complex}
92
+ **Clarity**: {Clear / Vague / Very Vague}
84
93
 
85
- ### Round 1: Problem & Users (Required)
86
- 1. **Problem Statement**: What specific problem does this solve?
87
- 2. **Target Users**: Who are the primary users? What are their goals?
88
- 3. **Success Metrics**: How will we know this feature is successful?
94
+ **Agents Required**:
95
+ - [x] BA Agent (always)
96
+ - [x] SA Agent (always)
97
+ - [ ] Researcher Agent (domain terms detected: {list})
98
+ - [ ] UI/UX Agent (UI components needed)
89
99
 
90
- ### Round 2: Functional Requirements (Required)
91
- 4. **Core Functionality**: What are the must-have features?
92
- 5. **User Flows**: What are the main user journeys? *(Skip if backend-only)*
93
- 6. **Inputs/Outputs**: What data goes in? What comes out?
100
+ **Execution Plan**:
101
+ 1. {Step 1}
102
+ 2. {Step 2}
103
+ ...
104
+ ```
94
105
 
95
- ### Round 3: Business Rules & Logic (Conditional)
96
- 7. **Business Rules**: What rules govern the behavior?
97
- 8. **Calculations/Logic**: Any specific formulas or logic?
98
- 9. **Validations**: What validations are needed?
106
+ ---
99
107
 
100
- ### Round 4: Edge Cases & Constraints (Conditional)
101
- 10. **Edge Cases**: What happens in unusual situations?
102
- 11. **Error Handling**: How should errors be handled?
103
- 12. **Constraints**: Technical, business, or time limitations?
108
+ ## Step 2: Execute BA Agent
104
109
 
105
- ### Round 5: Non-Functional & Scope (Conditional)
106
- 13. **Performance**: Any performance requirements? *(Skip if UI-only)*
107
- 14. **Security**: Authentication, authorization, data protection?
108
- 15. **Out of Scope**: What is explicitly NOT included?
110
+ **Always runs first (or parallel with Researcher if domain terms detected)**
109
111
 
112
+ ### Invoke BA Agent
113
+
114
+ ```
115
+ Task(
116
+ subagent_type='general-purpose',
117
+ description='BA requirement analysis',
118
+ prompt="Read agent definition: .claude/agents/requirement-ba.md
119
+
120
+ Execute the BA Agent workflow for feature: {feature-name}
121
+
122
+ User's original request:
123
+ ---
124
+ {user prompt}
110
125
  ---
111
126
 
112
- **Q&A Format:**
113
- - Use AskUserQuestion with 2-4 options per question
114
- - Include "I need to think about this" option for complex questions
115
- - Allow multi-select where appropriate
127
+ Output to: docs/ai/requirements/agents/ba-{name}.md
116
128
 
117
- **After each round:**
118
- - Summarize what was learned
119
- - Identify remaining gaps
120
- - Evaluate if next round is relevant
121
- - Ask if user wants to continue clarifying or finalize
129
+ Follow all steps in the agent definition. Use AskUserQuestion for Q&A rounds."
130
+ )
131
+ ```
132
+
133
+ ### BA Completion Check
134
+
135
+ After BA completes, verify output exists:
136
+ - `docs/ai/requirements/agents/ba-{name}.md`
137
+
138
+ Extract key info for next agents:
139
+ - Feature type confirmed
140
+ - User stories
141
+ - Functional requirements
142
+ - Domain terms (if any discovered)
122
143
 
123
144
  ---
124
145
 
125
- ## Step 3: Document Clarifications
146
+ ## Step 3: Execute Parallel Agents (Conditional)
147
+
148
+ Based on Step 1 analysis, run applicable agents in parallel.
149
+
150
+ ### 3a: Researcher Agent (if domain terms detected)
151
+
152
+ ```
153
+ Task(
154
+ subagent_type='general-purpose',
155
+ description='Domain research',
156
+ prompt="Read agent definition: .claude/agents/requirement-researcher.md
157
+
158
+ Research the following terms/concepts for feature: {feature-name}
159
+
160
+ Terms to research:
161
+ - {term 1}
162
+ - {term 2}
163
+ - {term 3}
164
+
165
+ Context from BA document: docs/ai/requirements/agents/ba-{name}.md
166
+
167
+ Output to: docs/ai/requirements/agents/research-{name}.md
168
+
169
+ Follow all steps in the agent definition.",
170
+ run_in_background: true
171
+ )
172
+ ```
173
+
174
+ ### 3b: SA Agent (always)
175
+
176
+ ```
177
+ Task(
178
+ subagent_type='general-purpose',
179
+ description='Solution architecture',
180
+ prompt="Read agent definition: .claude/agents/requirement-sa.md
181
+
182
+ Perform technical feasibility assessment for feature: {feature-name}
183
+
184
+ BA document: docs/ai/requirements/agents/ba-{name}.md
126
185
 
127
- **After each Q&A round, update internal notes:**
186
+ Read project standards:
187
+ - docs/ai/project/CODE_CONVENTIONS.md
188
+ - docs/ai/project/PROJECT_STRUCTURE.md
189
+
190
+ Output to: docs/ai/requirements/agents/sa-{name}.md
191
+
192
+ Follow all steps in the agent definition.",
193
+ run_in_background: true
194
+ )
195
+ ```
196
+
197
+ ### Wait for Parallel Agents
198
+
199
+ If running in background, use TaskOutput to collect results:
128
200
 
129
201
  ```
130
- ## Clarifications Log
131
- | # | Question | Answer | Category |
132
- |---|----------|--------|----------|
133
- | 1 | {question} | {answer} | {FR/BR/NFR/Edge} |
202
+ TaskOutput(task_id={researcher_task_id}, block=true)
203
+ TaskOutput(task_id={sa_task_id}, block=true)
134
204
  ```
135
205
 
136
- **Categorize answers:**
137
- - **FR**: Functional Requirement
138
- - **BR**: Business Rule
139
- - **NFR**: Non-Functional Requirement
140
- - **Edge**: Edge Case
141
- - **OOS**: Out of Scope
142
- - **TERM**: Terminology/Glossary item
206
+ ---
207
+
208
+ ## Step 4: Execute UI/UX Agent (Conditional)
209
+
210
+ **Only if UI components are needed (detected in Step 1)**
211
+
212
+ ### Check if Needed
213
+
214
+ UI/UX Agent is needed if:
215
+ - Feature type is `UI` or `Full-stack`
216
+ - BA document mentions screens, forms, pages, dashboards
217
+ - User explicitly mentioned UI/UX in request
143
218
 
144
- **Track domain terms:**
145
- - If user uses specialized terms, add to Glossary section
146
- - Ask for definitions if terms are ambiguous
219
+ ### Invoke UI/UX Agent
220
+
221
+ ```
222
+ Task(
223
+ subagent_type='general-purpose',
224
+ description='UI/UX design',
225
+ prompt="Read agent definition: .claude/agents/requirement-uiux.md
226
+
227
+ Design UI/UX for feature: {feature-name}
228
+
229
+ BA document: docs/ai/requirements/agents/ba-{name}.md
230
+ SA document: docs/ai/requirements/agents/sa-{name}.md (for constraints)
231
+
232
+ Output to: docs/ai/requirements/agents/uiux-{name}.md
233
+
234
+ Follow all steps in the agent definition."
235
+ )
236
+ ```
147
237
 
148
238
  ---
149
239
 
150
- ## Step 4: Generate Requirement Document
240
+ ## Step 5: Resolve Conflicts (If Any)
151
241
 
152
- **Trigger:** User indicates they're ready to finalize OR all key areas are covered.
242
+ ### Check for Conflicts
153
243
 
154
- ### Load Template
244
+ Compare agent outputs for inconsistencies:
155
245
 
156
- **Tool:** Read(file_path="docs/ai/requirements/req-template.md")
246
+ | Conflict Type | Detection | Resolution |
247
+ |---------------|-----------|------------|
248
+ | **Feasibility** | SA says not feasible, BA has as must-have | Ask user to adjust priority or scope |
249
+ | **Technical** | SA recommends X, research shows Y is standard | Present both, let user decide |
250
+ | **Scope** | Agents produced different scope understanding | Clarify with user |
157
251
 
158
- **Instructions:**
159
- 1. Read the template file to understand the required structure and format
160
- 2. Use the template as the baseline - follow its section order and formatting exactly
161
- 3. Fill in sections with data collected from Q&A rounds
162
- 4. For optional sections with no data collected → remove the section entirely (don't leave placeholders)
163
- 5. Keep required sections even if minimal data (Problem Statement, Functional Requirements, Acceptance Criteria)
252
+ ### Conflict Resolution
164
253
 
165
- **Template Section Mapping:**
166
- | Template Section | Data Source |
167
- |------------------|-------------|
168
- | 1. Problem Statement | Round 1: Problem & Users |
169
- | 2. User Stories | Round 1: Target Users + Round 2: Core Functionality |
170
- | 3. Business Rules | Round 3: Business Rules |
171
- | 4. Functional Requirements | Round 2: Core Functionality, Inputs/Outputs |
172
- | 5. Non-Functional Requirements | Round 5: Performance, Security |
173
- | 6. Edge Cases & Constraints | Round 4: Edge Cases, Constraints |
174
- | 7. Clarifications Log | All rounds: Q&A history |
175
- | 8. Out of Scope | Round 5: Out of Scope |
176
- | 9. Acceptance Criteria | Derived from Functional Requirements |
177
- | 10. References | User-provided links |
178
- | 11. Glossary | Domain terms collected (TERM category) |
254
+ ```
255
+ AskUserQuestion(questions=[{
256
+ question: "Conflict detected: {describe conflict}. How should we proceed?",
257
+ header: "Resolve",
258
+ options: [
259
+ { label: "{Option A}", description: "{Explanation}" },
260
+ { label: "{Option B}", description: "{Explanation}" },
261
+ { label: "Discuss further", description: "Need more context" }
262
+ ],
263
+ multiSelect: false
264
+ }])
265
+ ```
179
266
 
180
- ### File Naming & Versioning Strategy
267
+ ---
181
268
 
182
- **Auto-name requirement:**
183
- - Derive `req-{name}` from feature description (kebab-case, concise)
184
- - Example: "User Authentication Flow" → `req-user-authentication`
269
+ ## Step 6: Consolidate Final Requirement
185
270
 
186
- **If file already exists:**
187
- 1. **Backup existing file** to archive folder:
188
- ```
189
- docs/ai/requirements/archive/req-{name}_{timestamp}.md
190
- ```
191
- - Timestamp format: `YYYYMMDD-HHMMSS`
192
- - Example: `archive/req-user-authentication_20250115-143022.md`
271
+ ### Read Template
193
272
 
194
- 2. **Overwrite** the main file: `docs/ai/requirements/req-{name}.md`
273
+ ```
274
+ Read(file_path="docs/ai/requirements/req-template.md")
275
+ ```
195
276
 
196
- 3. **Notify user:**
197
- > "Previous version backed up to `archive/req-{name}_{timestamp}.md`"
277
+ ### Gather All Agent Outputs
198
278
 
199
- **Create archive folder if not exists:**
200
- ```bash
201
- mkdir -p docs/ai/requirements/archive
202
279
  ```
280
+ Read(file_path="docs/ai/requirements/agents/ba-{name}.md")
281
+ Read(file_path="docs/ai/requirements/agents/sa-{name}.md")
282
+ Read(file_path="docs/ai/requirements/agents/research-{name}.md") # if exists
283
+ Read(file_path="docs/ai/requirements/agents/uiux-{name}.md") # if exists
284
+ ```
285
+
286
+ ### Generate Consolidated Document
287
+
288
+ Create `docs/ai/requirements/req-{name}.md` with:
289
+
290
+ ```markdown
291
+ # Requirement: {Feature Name}
292
+
293
+ > Generated: {YYYY-MM-DD}
294
+ > Status: Draft | Review | Approved
295
+ > Complexity: {Low / Medium / High}
296
+
297
+ ## Quick Links
298
+
299
+ | Document | Status |
300
+ |----------|--------|
301
+ | [BA Analysis](agents/ba-{name}.md) | ✅ Complete |
302
+ | [SA Assessment](agents/sa-{name}.md) | ✅ Complete |
303
+ | [Domain Research](agents/research-{name}.md) | {✅ Complete / ⏭️ Skipped} |
304
+ | [UI/UX Design](agents/uiux-{name}.md) | {✅ Complete / ⏭️ Skipped} |
305
+
306
+ ---
307
+
308
+ ## 1. Executive Summary
309
+
310
+ {Synthesized from all agents - 3-5 sentences covering what, why, how}
311
+
312
+ ---
313
+
314
+ ## 2. Problem Statement
315
+
316
+ {From BA document}
317
+
318
+ ---
319
+
320
+ ## 3. Users & User Stories
321
+
322
+ {From BA document - consolidated user stories table}
323
+
324
+ ---
325
+
326
+ ## 4. Functional Requirements
327
+
328
+ {From BA document - FR table}
329
+
330
+ ---
331
+
332
+ ## 5. Business Rules
333
+
334
+ {From BA document - BR table}
335
+
336
+ ---
337
+
338
+ ## 6. Technical Assessment
339
+
340
+ ### Feasibility
341
+ {From SA document - feasibility summary}
342
+
343
+ ### Recommended Architecture
344
+ {From SA document - key architecture decisions}
345
+
346
+ ### Technology Stack
347
+ {From SA document - stack table}
348
+
349
+ ### Risks
350
+ {From SA document - risk table}
351
+
352
+ ---
353
+
354
+ ## 7. UI/UX Design (if applicable)
355
+
356
+ ### Screen Inventory
357
+ {From UI/UX document}
358
+
359
+ ### Key Wireframes
360
+ {From UI/UX document - main screens only}
361
+
362
+ ### User Flows
363
+ {From UI/UX document - flow diagrams}
364
+
365
+ ---
366
+
367
+ ## 8. Domain Context (if applicable)
368
+
369
+ ### Glossary
370
+ {From Research document - key terms}
371
+
372
+ ### Compliance & Standards
373
+ {From Research document - relevant standards}
374
+
375
+ ---
376
+
377
+ ## 9. Implementation Guidance
378
+
379
+ ### Suggested Phases
380
+ {From SA document}
381
+
382
+ ### Dependencies
383
+ {From BA + SA documents}
203
384
 
204
385
  ---
205
386
 
206
- ### Generate document sections:
387
+ ## 10. Out of Scope
388
+
389
+ {From BA document}
207
390
 
208
- 1. **Problem Statement**: From Round 1 answers
209
- 2. **User Stories**: Derived from users + functionality
210
- 3. **Business Rules**: From Round 3
211
- 4. **Functional Requirements**: From Rounds 2-3, prioritized
212
- 5. **Non-Functional Requirements**: From Round 5
213
- 6. **Edge Cases & Constraints**: From Round 4
214
- 7. **Clarifications Log**: Complete Q&A history
215
- 8. **Out of Scope**: Explicit exclusions
216
- 9. **Acceptance Criteria**: Derived from requirements (Given/When/Then)
217
- 10. **References**: Links to related docs
218
- 11. **Glossary**: Domain-specific terms *(only if terms were collected)*
391
+ ---
219
392
 
220
- **Write file:**
221
- - Path: `docs/ai/requirements/req-{name}.md`
393
+ ## 11. Open Questions
394
+
395
+ {Consolidated from all agents}
222
396
 
223
397
  ---
224
398
 
225
- ## Step 5: Review & Confirm
399
+ ## 12. Acceptance Criteria
400
+
401
+ {Derived from FRs - Given/When/Then format}
226
402
 
227
- **Present summary to user:**
403
+ ---
404
+
405
+ ## Next Steps
228
406
 
407
+ 1. Review this requirement document
408
+ 2. Run `/create-plan req-{name}` to generate implementation plan
409
+ 3. Address open questions before implementation
229
410
  ```
411
+
412
+ ### File Naming & Versioning
413
+
414
+ **Auto-name requirement:**
415
+ - Derive `req-{name}` from feature (kebab-case, concise)
416
+ - Example: "User Authentication Flow" → `req-user-authentication`
417
+
418
+ **If file already exists:**
419
+ 1. Backup to `docs/ai/requirements/archive/req-{name}_{timestamp}.md`
420
+ 2. Overwrite main file
421
+ 3. Notify user of backup
422
+
423
+ ---
424
+
425
+ ## Step 7: Summary & Next Steps
426
+
427
+ ### Present Summary
428
+
429
+ ```markdown
230
430
  ## Requirement Document Created
231
431
 
232
- **File:** docs/ai/requirements/req-{name}.md
233
- {If backup created: **Previous version:** archive/req-{name}_{timestamp}.md}
432
+ **File**: docs/ai/requirements/req-{name}.md
234
433
 
235
- ### Summary
236
- - {X} Functional Requirements
237
- - {Y} Business Rules
238
- - {Z} Edge Cases documented
239
- - {N} Clarification rounds completed
240
- - {M} Rounds skipped (not relevant)
241
- {If glossary: - {T} Terms defined in Glossary}
434
+ ### Agents Executed
435
+ | Agent | Output | Status |
436
+ |-------|--------|--------|
437
+ | BA | ba-{name}.md | Complete |
438
+ | SA | sa-{name}.md | Complete |
439
+ | Researcher | research-{name}.md | {✅ / ⏭️ Skipped} |
440
+ | UI/UX | uiux-{name}.md | {✅ / ⏭️ Skipped} |
242
441
 
243
- ### Key Requirements
244
- 1. [FR-01] {main requirement}
245
- 2. [FR-02] {second requirement}
246
- 3. [BR-01] {key business rule}
442
+ ### Key Findings
443
+ - **Feasibility**: {Feasible / Feasible with changes / Issues}
444
+ - **Complexity**: {Low / Medium / High}
445
+ - **Open Questions**: {count}
247
446
 
248
447
  ### Next Steps
249
- 1. Review the requirement document
250
- 2. Run `/create-plan` to generate implementation plan
448
+ 1. Review requirement: `docs/ai/requirements/req-{name}.md`
449
+ 2. Address open questions (if any)
450
+ 3. Create plan: `/create-plan` (will auto-link to this requirement)
251
451
  ```
252
452
 
253
- **Offer options:**
254
- - "Review document" → Read and display full content
255
- - "Continue clarifying" → Return to Step 2
256
- - "Proceed to planning" → Suggest `/create-plan docs/ai/requirements/req-{name}.md`
453
+ ### Offer Options
454
+
455
+ ```
456
+ AskUserQuestion(questions=[{
457
+ question: "What would you like to do next?",
458
+ header: "Next",
459
+ options: [
460
+ { label: "View full document", description: "Display the consolidated requirement" },
461
+ { label: "Create plan", description: "Run /create-plan for this requirement" },
462
+ { label: "Continue refining", description: "Run more Q&A or agent passes" }
463
+ ],
464
+ multiSelect: false
465
+ }])
466
+ ```
257
467
 
258
468
  ---
259
469
 
260
- ## Step 6: Next Actions
470
+ ## Decision Trees
471
+
472
+ ### When to Skip Agents
261
473
 
262
- Suggest next steps based on user choice:
474
+ ```
475
+ Researcher Agent:
476
+ ├── Domain terms detected? ─── Yes ──▶ Run
477
+ └── No ──▶ Skip
478
+
479
+ UI/UX Agent:
480
+ ├── Feature type UI or Full-stack? ─── Yes ──▶ Run
481
+ ├── BA mentions screens/forms/pages? ─── Yes ──▶ Run
482
+ └── No ──▶ Skip
483
+ ```
263
484
 
264
- - **If more clarification needed:** Continue Q&A session
265
- - **If ready to plan:** `/create-plan` with requirement doc reference
266
- - **If needs stakeholder review:** Share the requirement doc for review
485
+ ### Complexity Escalation
486
+
487
+ ```
488
+ Simple (1-2 Q&A rounds):
489
+ └── Consider: "This seems straightforward. Proceed with full agent workflow or quick mode?"
490
+
491
+ Complex (many unknowns):
492
+ └── Recommend: "This is complex. Suggest breaking down into smaller requirements."
493
+ ```
267
494
 
268
495
  ---
269
496
 
270
- ## Tips for Effective Requirement Gathering
497
+ ## Error Handling
271
498
 
272
- 1. **Start broad, then narrow**: Begin with problem/users, then dive into specifics
273
- 2. **Confirm understanding**: Summarize after each round
274
- 3. **Document everything**: Even "obvious" decisions should be recorded
275
- 4. **Identify assumptions**: Make implicit assumptions explicit
276
- 5. **Define boundaries**: Clear out-of-scope prevents scope creep
277
- 6. **Skip smartly**: Not every feature needs all rounds - adapt to context
278
- 7. **Capture terminology**: Domain terms prevent miscommunication later
499
+ | Error | Action |
500
+ |-------|--------|
501
+ | Agent fails | Retry once, then proceed without that agent's output |
502
+ | Template not found | Use fallback minimal structure |
503
+ | Conflict unresolved | Document as open question, proceed |
504
+ | User abandons Q&A | Save progress, allow resume |
279
505
 
280
506
  ---
281
507
 
282
508
  ## Notes
283
509
 
284
- - This command is designed for iterative use - user can clear chat and resume with the requirement doc
285
- - The output requirement doc serves as single source of truth for `/create-plan`
286
- - Requirement doc can be updated later using `/modify-plan` workflow
287
- - Previous versions are preserved in `archive/` folder for reference
510
+ ### Agent Output Files
511
+
512
+ All agent outputs are saved in `docs/ai/requirements/agents/`:
513
+ - `ba-{name}.md` - Business Analysis
514
+ - `sa-{name}.md` - Solution Architecture
515
+ - `research-{name}.md` - Domain Research
516
+ - `uiux-{name}.md` - UI/UX Design
517
+
518
+ These provide detailed backup and audit trail for the consolidated `req-{name}.md`.
519
+
520
+ ### Integration with Planning
521
+
522
+ The consolidated requirement document is designed to be consumed by `/create-plan`:
523
+ - Section mappings are compatible with planning template
524
+ - Technical assessment informs architecture decisions
525
+ - UI/UX wireframes inform implementation phases
526
+
527
+ ### Parallel Execution
528
+
529
+ Maximize parallelism where possible:
530
+ - BA + Researcher can run in parallel (if both needed)
531
+ - SA can start after BA completes (needs BA output)
532
+ - UI/UX can start after SA completes (needs both outputs)
533
+
534
+ Optimal parallel execution for full workflow:
535
+ ```
536
+ BA ──────────────┐
537
+ ├──▶ SA ──────────┐
538
+ Researcher ──────┘ ├──▶ UI/UX ──▶ Consolidate
539
+
540
+ ```