|
| 1 | +--- |
| 2 | +description: Generate comprehensive requirements for a specification |
| 3 | +allowed-tools: Bash, Glob, Grep, LS, Read, Write, Edit, MultiEdit, Update, WebSearch, WebFetch |
| 4 | +argument-hint: <feature-name> |
| 5 | +--- |
| 6 | + |
| 7 | +# Requirements Generation |
| 8 | + |
| 9 | +Generate comprehensive requirements for feature: **$1** |
| 10 | + |
| 11 | +## Context Validation |
| 12 | + |
| 13 | +### Steering Context |
| 14 | +- Architecture context: @.kiro/steering/structure.md |
| 15 | +- Technical constraints: @.kiro/steering/tech.md |
| 16 | +- Product context: @.kiro/steering/product.md |
| 17 | +- Custom steering: Load all "Always" mode custom steering files from .kiro/steering/ |
| 18 | + |
| 19 | +### Existing Spec Context |
| 20 | +- Current spec directory: !`bash -c 'ls -la .kiro/specs/$1/'` |
| 21 | +- Current requirements: `.kiro/specs/$1/requirements.md` |
| 22 | +- Spec metadata: `.kiro/specs/$1/spec.json` |
| 23 | + |
| 24 | +## Task: Generate Initial Requirements |
| 25 | + |
| 26 | +### 1. Read Existing Requirements Template |
| 27 | +Read the existing requirements.md file created by spec-init to extract the project description. |
| 28 | + |
| 29 | +### 2. Generate Complete Requirements |
| 30 | +Generate an initial set of requirements in EARS format based on the project description, then iterate with the user to refine them until they are complete and accurate. |
| 31 | + |
| 32 | +Don't focus on implementation details in this phase. Instead, just focus on writing requirements which will later be turned into a design. |
| 33 | + |
| 34 | +### Requirements Generation Guidelines |
| 35 | +1. **Focus on Core Functionality**: Start with the essential features from the user's idea |
| 36 | +2. **Use EARS Format**: All acceptance criteria must use proper EARS syntax |
| 37 | +3. **No Sequential Questions**: Generate initial version first, then iterate based on user feedback |
| 38 | +4. **Keep It Manageable**: Create a solid foundation that can be expanded through user review |
| 39 | +5. **Choose an appropriate subject**: For software projects, use the concrete system/service name (e.g., "Checkout Service") instead of a generic subject. For non-software, choose a responsible subject (e.g., process/workflow, team/role, artifact/document, campaign, protocol). |
| 40 | + |
| 41 | +### 3. EARS Format Requirements |
| 42 | + |
| 43 | +**EARS (Easy Approach to Requirements Syntax)** is the recommended format for acceptance criteria: |
| 44 | + |
| 45 | +**Primary EARS Patterns:** |
| 46 | +- WHEN [event/condition] THEN [system/subject] SHALL [response] |
| 47 | +- IF [precondition/state] THEN [system/subject] SHALL [response] |
| 48 | +- WHILE [ongoing condition] THE [system/subject] SHALL [continuous behavior] |
| 49 | +- WHERE [location/context/trigger] THE [system/subject] SHALL [contextual behavior] |
| 50 | + |
| 51 | +**Combined Patterns:** |
| 52 | +- WHEN [event] AND [additional condition] THEN [system/subject] SHALL [response] |
| 53 | +- IF [condition] AND [additional condition] THEN [system/subject] SHALL [response] |
| 54 | + |
| 55 | +### 4. Requirements Document Structure |
| 56 | +Update requirements.md with complete content in the language specified in spec.json (check `.kiro/specs/$1/spec.json` for "language" field): |
| 57 | + |
| 58 | +```markdown |
| 59 | +# Requirements Document |
| 60 | + |
| 61 | +## Introduction |
| 62 | +[Clear introduction summarizing the feature and its business value] |
| 63 | + |
| 64 | +## Requirements |
| 65 | + |
| 66 | +### Requirement 1: [Major Objective Area] |
| 67 | +**Objective:** As a [role/stakeholder], I want [feature/capability/outcome], so that [benefit] |
| 68 | + |
| 69 | +#### Acceptance Criteria |
| 70 | +This section should have EARS requirements |
| 71 | + |
| 72 | +1. WHEN [event] THEN [system/subject] SHALL [response] |
| 73 | +2. IF [precondition] THEN [system/subject] SHALL [response] |
| 74 | +3. WHILE [ongoing condition] THE [system/subject] SHALL [continuous behavior] |
| 75 | +4. WHERE [location/context/trigger] THE [system/subject] SHALL [contextual behavior] |
| 76 | + |
| 77 | +### Requirement 2: [Next Major Objective Area] |
| 78 | +**Objective:** As a [role/stakeholder], I want [feature/capability/outcome], so that [benefit] |
| 79 | + |
| 80 | +1. WHEN [event] THEN [system/subject] SHALL [response] |
| 81 | +2. WHEN [event] AND [condition] THEN [system/subject] SHALL [response] |
| 82 | + |
| 83 | +### Requirement 3: [Additional Major Areas] |
| 84 | +[Continue pattern for all major functional areas] |
| 85 | +``` |
| 86 | + |
| 87 | +### 5. Update Metadata |
| 88 | +Update spec.json with: |
| 89 | +```json |
| 90 | +{ |
| 91 | + "phase": "requirements-generated", |
| 92 | + "approvals": { |
| 93 | + "requirements": { |
| 94 | + "generated": true, |
| 95 | + "approved": false |
| 96 | + } |
| 97 | + }, |
| 98 | + "updated_at": "current_timestamp" |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +### 6. Document Generation Only |
| 103 | +Generate the requirements document content ONLY. Do not include any review or approval instructions in the actual document file. |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## Next Phase: Interactive Approval |
| 108 | + |
| 109 | +After generating requirements.md, review the requirements and choose: |
| 110 | + |
| 111 | +**If requirements look good:** |
| 112 | +Run `/kiro:spec-design $1 -y` to proceed to design phase |
| 113 | + |
| 114 | +**If requirements need modification:** |
| 115 | +Request changes, then re-run this command after modifications |
| 116 | + |
| 117 | +The `-y` flag auto-approves requirements and generates design directly, streamlining the workflow while maintaining review enforcement. |
| 118 | + |
| 119 | +## Instructions |
| 120 | + |
| 121 | +1. **Check spec.json for language** - Use the language specified in the metadata |
| 122 | +2. **Generate initial requirements** based on the feature idea WITHOUT asking sequential questions first |
| 123 | +3. **Apply EARS format** - Use proper EARS syntax patterns for all acceptance criteria |
| 124 | +4. **Focus on core functionality** - Start with essential features and user workflows |
| 125 | +5. **Structure clearly** - Group related functionality into logical requirement areas |
| 126 | +6. **Make requirements testable** - Each acceptance criterion should be verifiable |
| 127 | +7. **Update tracking metadata** upon completion |
| 128 | + |
| 129 | +Generate requirements that provide a solid foundation for the design phase, focusing on the core functionality from the feature idea. |
| 130 | +think |
0 commit comments