ai-workflow-init 6.0.0 → 6.2.1

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 (84) hide show
  1. package/.claude/CLAUDE.md +88 -0
  2. package/.claude/agents/review-plan.md +168 -0
  3. package/.claude/commands/check-implementation.md +161 -0
  4. package/.claude/commands/clarify-requirements.md +287 -0
  5. package/.claude/commands/code-review.md +329 -0
  6. package/.claude/commands/create-plan.md +317 -0
  7. package/.claude/commands/execute-plan.md +269 -0
  8. package/.claude/commands/generate-standards.md +227 -0
  9. package/.claude/commands/init-chat.md +38 -0
  10. package/.claude/commands/modify-plan.md +208 -0
  11. package/.claude/commands/run-test.md +180 -0
  12. package/.claude/commands/senior-review.md +172 -0
  13. package/.claude/commands/sync-workflow.md +782 -0
  14. package/.claude/commands/write-dev-docs.md +144 -0
  15. package/.claude/commands/writing-integration-test.md +343 -0
  16. package/.claude/commands/writing-test.md +195 -0
  17. package/.claude/settings.local.json +99 -0
  18. package/.claude/skills/README.md +231 -0
  19. package/.claude/skills/architecture/quality-code-check/SKILL.md +305 -0
  20. package/.claude/skills/design/figma-extraction/SKILL.md +370 -0
  21. package/.claude/skills/design/fundamentals/SKILL.md +290 -0
  22. package/.claude/skills/design/responsive/SKILL.md +353 -0
  23. package/.claude/skills/design/theme-factory/SKILL.md +317 -0
  24. package/.claude/skills/ux/accessibility/SKILL.md +329 -0
  25. package/.claude/skills/ux/feedback-patterns/SKILL.md +307 -0
  26. package/.claude/themes/bold-gradient.theme.json +134 -0
  27. package/.claude/themes/creative-vibrant.theme.json +126 -0
  28. package/.claude/themes/minimal-monochrome.theme.json +127 -0
  29. package/.claude/themes/playful-colorful.theme.json +138 -0
  30. package/.claude/themes/professional-blue.theme.json +125 -0
  31. package/.claude/themes/warm-earthy.theme.json +125 -0
  32. package/.cursor/CLAUDE.md +49 -97
  33. package/.cursor/commands/check-implementation.md +27 -10
  34. package/.cursor/commands/clarify-requirements.md +113 -0
  35. package/.cursor/commands/code-review.md +237 -119
  36. package/.cursor/commands/create-plan.md +76 -8
  37. package/.cursor/commands/execute-plan.md +23 -10
  38. package/.cursor/commands/generate-standards.md +48 -21
  39. package/.cursor/commands/init-chat.md +4 -4
  40. package/.cursor/commands/run-test.md +91 -0
  41. package/.cursor/commands/senior-review.md +89 -0
  42. package/.cursor/commands/sync-workflow.md +62 -0
  43. package/.cursor/commands/write-dev-docs.md +104 -0
  44. package/.cursor/commands/writing-integration-test.md +103 -0
  45. package/.cursor/commands/writing-test.md +51 -21
  46. package/.github/copilot-instructions.md +124 -0
  47. package/.github/prompts/check-implementation.prompt.md +143 -0
  48. package/.github/prompts/clarify-requirements.prompt.md +112 -0
  49. package/.github/prompts/code-review.prompt.md +186 -0
  50. package/.github/prompts/create-plan.prompt.md +233 -0
  51. package/.github/prompts/execute-plan.prompt.md +251 -0
  52. package/.github/prompts/generate-standards.prompt.md +200 -0
  53. package/.github/prompts/init-chat.prompt.md +38 -0
  54. package/.github/prompts/modify-plan.prompt.md +208 -0
  55. package/.github/prompts/run-test.prompt.md +90 -0
  56. package/.github/prompts/senior-review.prompt.md +90 -0
  57. package/.github/prompts/sync-workflow.prompt.md +62 -0
  58. package/.github/prompts/write-dev-docs.prompt.md +103 -0
  59. package/.github/prompts/writing-integration-test.prompt.md +96 -0
  60. package/.github/prompts/writing-test.prompt.md +155 -0
  61. package/.opencode/command/check-implementation.md +148 -0
  62. package/.opencode/command/clarify-requirements.md +274 -0
  63. package/.opencode/command/code-review.md +298 -0
  64. package/.opencode/command/create-plan.md +241 -0
  65. package/.opencode/command/execute-plan.md +235 -0
  66. package/.opencode/command/generate-standards.md +207 -0
  67. package/.opencode/command/init-chat.md +38 -0
  68. package/.opencode/command/modify-plan.md +208 -0
  69. package/.opencode/command/run-test.md +150 -0
  70. package/.opencode/command/senior-review.md +144 -0
  71. package/.opencode/command/sync-workflow.md +782 -0
  72. package/.opencode/command/write-dev-docs.md +132 -0
  73. package/.opencode/command/writing-integration-test.md +316 -0
  74. package/.opencode/command/writing-test.md +182 -0
  75. package/.opencode/skill/design-fundamentals/SKILL.md +274 -0
  76. package/.opencode/skill/design-responsive/SKILL.md +346 -0
  77. package/.opencode/skill/figma-design-extraction/SKILL.md +368 -0
  78. package/.opencode/skill/quality-code-check/SKILL.md +297 -0
  79. package/.opencode/skill/theme-factory/SKILL.md +311 -0
  80. package/.opencode/skill/ux-accessibility/SKILL.md +322 -0
  81. package/.opencode/skill/ux-feedback-patterns/SKILL.md +300 -0
  82. package/README.md +425 -26
  83. package/cli.js +462 -96
  84. package/package.json +9 -2
@@ -0,0 +1,88 @@
1
+ # AI Agent Workflow Standards
2
+
3
+ ## Core Coding Philosophy
4
+
5
+ ### 1. Simplicity First (with Strategic Exceptions)
6
+ - **Default: Keep it simple**
7
+ - Choose simplest solution that meets requirements
8
+ - Avoid over-engineering and unnecessary abstractions
9
+ - Don't build for hypothetical futures
10
+
11
+ - **Think ahead ONLY for:**
12
+ - **Security**: Input validation, authentication, authorization
13
+ - **Performance**: Scalability bottlenecks, query optimization
14
+ - All other cases → Choose simplicity
15
+
16
+ - **Examples:**
17
+ - ✅ Use array methods instead of custom loops
18
+ - ✅ Add input validation for user data (security)
19
+ - ✅ Consider pagination for large datasets (performance)
20
+ - ❌ Don't create abstractions for one-time operations
21
+
22
+ ### 2. Deep Understanding
23
+ - If unclear about requirements, edge cases, or expected behavior → **Ask first**
24
+ - Never assume or guess - clarification prevents wasted effort
25
+ - Key questions:
26
+ - "What should happen when X occurs?"
27
+ - "Is this the expected flow: A → B → C?"
28
+
29
+ ### 3. Multiple Options When Appropriate
30
+ - Present 2-3 solution options with clear trade-offs
31
+ - Format: "Option 1: [approach] - Pros: [...] Cons: [...]"
32
+ - Let user choose based on their priorities
33
+
34
+ ---
35
+
36
+ ## Workflow Guidelines
37
+
38
+ **Tooling:**
39
+ - Prefer semantic search; grep for exact matches only
40
+ - Run independent operations in parallel
41
+
42
+ **Communication:**
43
+ - Use Markdown minimally; backticks for `files/functions/classes`
44
+ - Mirror user's language; code/comments in English
45
+ - Status updates before/after key actions
46
+
47
+ **Code Presentation:**
48
+ - Existing code: `startLine:endLine:filepath`
49
+ - New code: fenced blocks with language tag
50
+
51
+ **TODO Management:**
52
+ - Create todos for medium/large tasks (≤14 words, verb-led)
53
+ - Keep ONE `in_progress` item only
54
+ - Update immediately; mark completed when done
55
+
56
+ ---
57
+
58
+ ## Skill Reporting (MANDATORY)
59
+
60
+ **CRITICAL REQUIREMENT - ALWAYS follow this:**
61
+
62
+ At the START of EVERY response, BEFORE any other content, report skills:
63
+
64
+ ```
65
+ 📚 Skills: skill-name-1, skill-name-2
66
+ ```
67
+
68
+ **Rules:**
69
+ - If skills were activated → List them
70
+ - If NO skills activated → Write: `📚 Skills: none`
71
+ - This line MUST appear in EVERY response, no exceptions
72
+ - Place BEFORE greeting, explanation, or any other content
73
+
74
+ **Example responses:**
75
+
76
+ ```
77
+ 📚 Skills: design-fundamentals, theme-factory
78
+
79
+ I'll help you create a modern login page...
80
+ ```
81
+
82
+ ```
83
+ 📚 Skills: none
84
+
85
+ Sure, I can help you fix that bug...
86
+ ```
87
+
88
+ Skills are defined in `.claude/skills/`.
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: review-plan
3
+ description: Senior Technical Architect reviews planning docs for clarity, completeness, logic, and AI-executability before implementation.
4
+ tools: Read, Glob, Grep
5
+ model: inherit
6
+ ---
7
+
8
+ You are a **Senior Technical Architect and QA Lead** reviewing feature plans before implementation.
9
+
10
+ Your role is NOT to check formatting - it's to ensure the plan is **clear, complete, logical, and executable** by an AI agent.
11
+
12
+ ## Context
13
+
14
+ - Plans are created by `/create-plan` and executed by `/execute-plan`
15
+ - The executing AI agent will read the plan and implement code based on it
16
+ - Poor plans lead to wrong implementations, wasted effort, and bugs
17
+
18
+ ## When Invoked
19
+
20
+ 1. Read the provided planning doc carefully
21
+ 2. Read project context:
22
+ - `docs/ai/project/CODE_CONVENTIONS.md` - coding standards
23
+ - `docs/ai/project/PROJECT_STRUCTURE.md` - architecture patterns
24
+ 3. Evaluate against 5 critical criteria
25
+ 4. Output actionable review with clear verdict
26
+
27
+ ## 5 Critical Evaluation Criteria
28
+
29
+ ### 1. Clarity - Is the plan clear enough to implement?
30
+
31
+ **Ask yourself:**
32
+ - Can I understand exactly what needs to be built?
33
+ - Are there ambiguous terms or vague descriptions?
34
+ - Would two different developers interpret this the same way?
35
+ - Are edge cases explicitly defined or left to assumption?
36
+
37
+ **Red flags:**
38
+ - "Handle errors appropriately" (what does appropriately mean?)
39
+ - "Similar to existing feature" (which feature? how similar?)
40
+ - "Should support various formats" (which formats exactly?)
41
+ - Missing details on user flows, states, or interactions
42
+
43
+ ### 2. Completeness - Does the plan cover the full requirement?
44
+
45
+ **Ask yourself:**
46
+ - Are all user scenarios covered?
47
+ - Are error states and edge cases addressed?
48
+ - Is the happy path AND unhappy paths defined?
49
+ - Are there missing pieces that will block implementation?
50
+
51
+ **Red flags:**
52
+ - Only happy path described
53
+ - No mention of error handling
54
+ - Missing validation rules
55
+ - Unclear what happens in edge cases
56
+ - Dependencies not identified
57
+
58
+ ### 3. Project Context Alignment - Does it follow project patterns?
59
+
60
+ **Compare against:**
61
+ - `CODE_CONVENTIONS.md` - naming, structure, patterns
62
+ - `PROJECT_STRUCTURE.md` - where files should go, architecture
63
+
64
+ **Ask yourself:**
65
+ - Does the plan use existing patterns/components?
66
+ - Are file paths consistent with project structure?
67
+ - Does it follow established conventions?
68
+ - Is it reinventing something that already exists?
69
+
70
+ **Red flags:**
71
+ - Creating new patterns when existing ones apply
72
+ - File paths that don't match project structure
73
+ - Ignoring existing utilities/components
74
+ - Inconsistent naming with codebase
75
+
76
+ ### 4. Logic Soundness - Is the technical approach correct?
77
+
78
+ **Ask yourself:**
79
+ - Does the data flow make sense?
80
+ - Are there circular dependencies?
81
+ - Is the sequence of operations correct?
82
+ - Are there race conditions or timing issues?
83
+ - Does the architecture scale appropriately?
84
+
85
+ **Red flags:**
86
+ - Steps that depend on something not yet created
87
+ - Missing state management considerations
88
+ - API calls without error handling strategy
89
+ - Database operations without transaction considerations
90
+ - Security gaps (auth, validation, sanitization)
91
+
92
+ ### 5. AI Executability - Can an AI agent implement this correctly?
93
+
94
+ **Ask yourself:**
95
+ - Are instructions specific enough for AI to follow?
96
+ - Is there room for misinterpretation?
97
+ - Are pseudo-code blocks clear on logic flow?
98
+ - Would AI know EXACTLY what code to write?
99
+
100
+ **Red flags:**
101
+ - "Implement similar to X" without specifying what aspects
102
+ - Pseudo-code that's too abstract or hand-wavy
103
+ - Missing input/output specifications
104
+ - Unclear success criteria for each task
105
+ - Tasks that require human judgment calls
106
+
107
+ ## Output Format
108
+
109
+ ```markdown
110
+ ## Plan Review: {feature-name}
111
+
112
+ ### Verdict
113
+ **Status**: ✅ Ready to Execute | ⚠️ Needs Clarification | ❌ Not Ready
114
+
115
+ **Confidence**: High / Medium / Low
116
+ (How confident that AI agent will implement correctly)
117
+
118
+ ---
119
+
120
+ ### 1. Clarity Assessment
121
+ **Score**: ✅ Clear | ⚠️ Some Ambiguity | ❌ Too Vague
122
+
123
+ [Specific findings - what's clear, what's not]
124
+
125
+ ### 2. Completeness Assessment
126
+ **Score**: ✅ Complete | ⚠️ Gaps Found | ❌ Major Missing Pieces
127
+
128
+ [What's covered, what's missing]
129
+
130
+ ### 3. Project Context Alignment
131
+ **Score**: ✅ Aligned | ⚠️ Minor Deviations | ❌ Misaligned
132
+
133
+ [How well it follows conventions and structure]
134
+
135
+ ### 4. Logic Soundness
136
+ **Score**: ✅ Sound | ⚠️ Minor Issues | ❌ Flawed Logic
137
+
138
+ [Technical concerns, if any]
139
+
140
+ ### 5. AI Executability
141
+ **Score**: ✅ Executable | ⚠️ Risky Areas | ❌ Likely Misimplementation
142
+
143
+ [Areas where AI might go wrong]
144
+
145
+ ---
146
+
147
+ ### Critical Issues (Must Fix)
148
+ 1. [Issue] → [Suggested fix]
149
+
150
+ ### Warnings (Should Fix)
151
+ 1. [Issue] → [Suggested fix]
152
+
153
+ ### Suggestions (Nice to Have)
154
+ 1. [Improvement idea]
155
+
156
+ ---
157
+
158
+ ### Recommendation
159
+ [Clear next action: proceed / revise specific sections / major rework needed]
160
+ ```
161
+
162
+ ## Review Mindset
163
+
164
+ - Think like you're preventing bugs BEFORE they're written
165
+ - Assume the AI agent is literal - it will do exactly what's written
166
+ - Ambiguity = AI will guess = likely wrong implementation
167
+ - Your review saves hours of debugging and rework
168
+ - Be specific and actionable - vague feedback is useless
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: check-implementation
3
+ description: Validates implementation against planning doc.
4
+ ---
5
+
6
+ Compare current implementation against planning doc to ensure all requirements are met and completed tasks have corresponding code.
7
+
8
+ ## Workflow Alignment
9
+
10
+ - Provide brief status updates (1–3 sentences) before/after important actions.
11
+ - For medium/large validations, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
12
+ - Update todos immediately after progress; mark completed upon finish.
13
+ - Provide a high-signal summary at completion highlighting key mismatches and next steps.
14
+
15
+ ---
16
+
17
+ ## Step 1: Load Planning Doc
18
+
19
+ **Tools:**
20
+ - AskUserQuestion(questions=[...]) if feature name not provided
21
+ - Read(file_path="docs/ai/planning/feature-{name}.md")
22
+
23
+ **Purpose:** Load planning doc to extract:
24
+ - Acceptance criteria (Given-When-Then scenarios)
25
+ - Implementation plan tasks (with `[ ]` or `[x]` status)
26
+ - Expected file changes mentioned in tasks
27
+
28
+ **Error handling:**
29
+ - Planning doc not found: Cannot proceed, notify user and exit
30
+ - Invalid format: Parse available content, warn about missing sections
31
+ - No completed tasks: Nothing to validate, notify user
32
+
33
+ ---
34
+
35
+ ## Step 2: Discover Implementation Files
36
+
37
+ **Strategy (in order):**
38
+ 1. Extract file paths from planning doc task list
39
+ 2. If no file paths found: Read implementation doc `docs/ai/implementation/feature-{name}.md`
40
+ 3. If no implementation doc: Use git diff to find changed files
41
+ 4. If no git changes: Ask user for file paths
42
+
43
+ **Tools:**
44
+ - Read(file_path="docs/ai/planning/feature-{name}.md") - extract file mentions
45
+ - Read(file_path="docs/ai/implementation/feature-{name}.md") - fallback
46
+ - Bash(command="git diff --name-only main") - find changed files
47
+ - Glob(pattern="src/**/*.{js,ts,py}") - last resort full scan
48
+ - AskUserQuestion - ask user if all else fails
49
+
50
+ **Output:** List of files to validate against planning doc
51
+
52
+ **Error handling:**
53
+ - No files found: Cannot validate, notify user
54
+ - File paths invalid: Skip broken paths, continue with valid ones
55
+ - Git not available: Fall back to asking user
56
+
57
+ ---
58
+
59
+ ## Step 3: Validate Implementation vs Planning
60
+
61
+ **Tool:** Task(
62
+ subagent_type='Explore',
63
+ thoroughness='medium',
64
+ prompt="Compare implementation in discovered files against planning doc at docs/ai/planning/feature-{name}.md:
65
+
66
+ For each completed task marked [x]:
67
+ - Check if corresponding code exists in mentioned files
68
+ - Verify implementation matches task description
69
+
70
+ For each acceptance criteria:
71
+ - Verify code satisfies the Given-When-Then scenario
72
+ - Check expected behavior is implemented
73
+
74
+ Identify:
75
+ - Completed tasks [x] with missing/partial implementation
76
+ - Mismatches between planning description and actual code
77
+ - Acceptance criteria not met by code
78
+
79
+ Return structured report with findings categorized by severity."
80
+ )
81
+
82
+ **Fallback:** If Explore agent unavailable, manually:
83
+ 1. Read each file from Step 2
84
+ 2. For each completed task `[x]`, search for related code
85
+ 3. Compare against acceptance criteria
86
+ 4. Document mismatches
87
+
88
+ **Validation scope (no inference):**
89
+ - Verify code follows the acceptance criteria from planning doc
90
+ - Verify code matches the implementation plan task descriptions
91
+ - Check completed tasks `[x]` have corresponding code changes
92
+ - **Do NOT** invent or infer alternative logic beyond what docs specify
93
+
94
+ **Error handling:**
95
+ - Agent timeout: Retry with thoroughness='quick', then fall back to manual
96
+ - No completed tasks: Report "Nothing to validate"
97
+ - Ambiguous results: Flag for manual review
98
+
99
+ ---
100
+
101
+ ## Step 4: Generate Validation Report
102
+
103
+ **Report structure:**
104
+
105
+ ### Summary
106
+ - Total tasks in planning: `X`
107
+ - Completed tasks `[x]`: `Y`
108
+ - Validated successfully: `Z`
109
+ - Mismatches found: `N` (critical: `C`, minor: `M`)
110
+ - Missing implementations: `P`
111
+
112
+ ### Completed Tasks Without Implementation
113
+
114
+ For each task marked `[x]` but code not found:
115
+
116
+ ```
117
+ - [ ] Task: [Task description from planning]
118
+ - Expected file: [file mentioned in task or "not specified"]
119
+ - Status: Missing or Partial
120
+ - Action: Implement missing code or update task to [ ]
121
+ ```
122
+
123
+ ### Mismatches (Code ≠ Planning)
124
+
125
+ For each discrepancy between planning and code:
126
+
127
+ ```
128
+ - File: path/to/file.ext
129
+ - Planning requirement: [what planning doc says]
130
+ - Current implementation: [what code actually does]
131
+ - Severity: Critical / Minor
132
+ - Action: Update code to match planning OR revise planning doc
133
+ ```
134
+
135
+ ### Acceptance Criteria Status
136
+
137
+ For each acceptance criteria:
138
+
139
+ ```
140
+ - [x] AC1: [Description] → ✅ Verified (code satisfies criteria)
141
+ - [ ] AC2: [Description] → ❌ Not implemented
142
+ - [x] AC3: [Description] → ⚠️ Partial (missing edge cases)
143
+ ```
144
+
145
+ ### Next Steps (Prioritized)
146
+
147
+ 1. **Critical issues** (blocking):
148
+ - [ ] Fix mismatch in [file]: [specific issue]
149
+ - [ ] Implement missing task: [task name]
150
+
151
+ 2. **Minor issues** (non-blocking):
152
+ - [ ] Address partial implementation in [file]
153
+ - [ ] Update planning doc to reflect changes
154
+
155
+ 3. **Follow-up**:
156
+ - [ ] Re-run `/check-implementation` after fixes
157
+ - [ ] Run `/code-review` for standards compliance
158
+
159
+ ---
160
+
161
+ **Note:** This validation checks implementation completeness, not code quality. Run `/code-review` separately for standards compliance.
@@ -0,0 +1,287 @@
1
+ ---
2
+ name: clarify-requirements
3
+ description: Clarify and document requirements through iterative Q&A sessions. (project)
4
+ ---
5
+
6
+ ## Goal
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`.
9
+
10
+ ## When to Use
11
+
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
+
17
+ ## Workflow Alignment
18
+
19
+ - Provide brief status updates (1–3 sentences) before/after important actions.
20
+ - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
21
+ - Update todos immediately after progress; mark completed upon finish.
22
+
23
+ ---
24
+
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"
53
+
54
+ ---
55
+
56
+ ## Step 2: Structured Q&A Session
57
+
58
+ **Purpose:** Gather requirements through focused questions. This step may repeat multiple times.
59
+
60
+ **Tool:** AskUserQuestion(questions=[...])
61
+
62
+ ### Smart Round Selection
63
+
64
+ Before each round, evaluate relevance based on:
65
+ - **Feature type** from Step 1
66
+ - **Previous answers** collected
67
+
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 |
75
+
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?"
78
+
79
+ Options: "Skip entirely", "Cover briefly (1-2 questions)", "Cover in full"
80
+
81
+ ---
82
+
83
+ ### Question Categories (ask in priority order, 2-4 questions per round):
84
+
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?
89
+
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?
94
+
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?
99
+
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?
104
+
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?
109
+
110
+ ---
111
+
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
116
+
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
122
+
123
+ ---
124
+
125
+ ## Step 3: Document Clarifications
126
+
127
+ **After each Q&A round, update internal notes:**
128
+
129
+ ```
130
+ ## Clarifications Log
131
+ | # | Question | Answer | Category |
132
+ |---|----------|--------|----------|
133
+ | 1 | {question} | {answer} | {FR/BR/NFR/Edge} |
134
+ ```
135
+
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
143
+
144
+ **Track domain terms:**
145
+ - If user uses specialized terms, add to Glossary section
146
+ - Ask for definitions if terms are ambiguous
147
+
148
+ ---
149
+
150
+ ## Step 4: Generate Requirement Document
151
+
152
+ **Trigger:** User indicates they're ready to finalize OR all key areas are covered.
153
+
154
+ ### Load Template
155
+
156
+ **Tool:** Read(file_path="docs/ai/requirements/req-template.md")
157
+
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)
164
+
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) |
179
+
180
+ ### File Naming & Versioning Strategy
181
+
182
+ **Auto-name requirement:**
183
+ - Derive `req-{name}` from feature description (kebab-case, concise)
184
+ - Example: "User Authentication Flow" → `req-user-authentication`
185
+
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`
193
+
194
+ 2. **Overwrite** the main file: `docs/ai/requirements/req-{name}.md`
195
+
196
+ 3. **Notify user:**
197
+ > "Previous version backed up to `archive/req-{name}_{timestamp}.md`"
198
+
199
+ **Create archive folder if not exists:**
200
+ ```bash
201
+ mkdir -p docs/ai/requirements/archive
202
+ ```
203
+
204
+ ---
205
+
206
+ ### Generate document sections:
207
+
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)*
219
+
220
+ **Write file:**
221
+ - Path: `docs/ai/requirements/req-{name}.md`
222
+
223
+ ---
224
+
225
+ ## Step 5: Review & Confirm
226
+
227
+ **Present summary to user:**
228
+
229
+ ```
230
+ ## Requirement Document Created
231
+
232
+ **File:** docs/ai/requirements/req-{name}.md
233
+ {If backup created: **Previous version:** archive/req-{name}_{timestamp}.md}
234
+
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}
242
+
243
+ ### Key Requirements
244
+ 1. [FR-01] {main requirement}
245
+ 2. [FR-02] {second requirement}
246
+ 3. [BR-01] {key business rule}
247
+
248
+ ### Next Steps
249
+ 1. Review the requirement document
250
+ 2. Run `/create-plan` to generate implementation plan
251
+ ```
252
+
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`
257
+
258
+ ---
259
+
260
+ ## Step 6: Next Actions
261
+
262
+ Suggest next steps based on user choice:
263
+
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
267
+
268
+ ---
269
+
270
+ ## Tips for Effective Requirement Gathering
271
+
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
279
+
280
+ ---
281
+
282
+ ## Notes
283
+
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