|
| 1 | +--- |
| 2 | +name: 'step-01-understand' |
| 3 | +description: 'Analyze the requirement delta between current state and what user wants to build' |
| 4 | + |
| 5 | +workflow_path: '{project-root}/_bmad/bmm/workflows/bmad-quick-flow/create-tech-spec' |
| 6 | +nextStepFile: '{workflow_path}/steps/step-02-investigate.md' |
| 7 | +skipToStepFile: '{workflow_path}/steps/step-03-generate.md' |
| 8 | +templateFile: '{workflow_path}/tech-spec-template.md' |
| 9 | +wipFile: '{implementation_artifacts}/tech-spec-wip.md' |
| 10 | +--- |
| 11 | + |
| 12 | +# Step 1: Analyze Requirement Delta |
| 13 | + |
| 14 | +**Progress: Step 1 of 4** - Next: Deep Investigation |
| 15 | + |
| 16 | +## RULES: |
| 17 | + |
| 18 | +- MUST NOT skip steps. |
| 19 | +- MUST NOT optimize sequence. |
| 20 | +- MUST follow exact instructions. |
| 21 | +- MUST NOT look ahead to future steps. |
| 22 | + |
| 23 | +## CONTEXT: |
| 24 | + |
| 25 | +- Variables from `workflow.md` are available in memory. |
| 26 | +- Focus: Define the technical requirement delta and scope. |
| 27 | +- Investigation: Perform surface-level code scans ONLY to verify the delta. Reserve deep dives into implementation consequences for Step 2. |
| 28 | +- Objective: Establish a verifiable delta between current state and target state. |
| 29 | + |
| 30 | +## SEQUENCE OF INSTRUCTIONS |
| 31 | + |
| 32 | +### 0. Check for Work in Progress |
| 33 | + |
| 34 | +a) **Before anything else, check if `{wipFile}` exists:** |
| 35 | + |
| 36 | +b) **IF WIP FILE EXISTS:** |
| 37 | + |
| 38 | +1. Read the frontmatter and extract: `title`, `slug`, `stepsCompleted` |
| 39 | +2. Calculate progress: `lastStep = max(stepsCompleted)` |
| 40 | +3. Present to user: |
| 41 | + |
| 42 | +``` |
| 43 | +Hey {user_name}! Found a tech-spec in progress: |
| 44 | +
|
| 45 | +**{title}** - Step {lastStep} of 4 complete |
| 46 | +
|
| 47 | +Is this what you're here to continue? |
| 48 | +
|
| 49 | +[y] Yes, pick up where I left off |
| 50 | +[n] No, archive it and start something new |
| 51 | +``` |
| 52 | + |
| 53 | +4. **HALT and wait for user selection.** |
| 54 | + |
| 55 | +a) **Menu Handling:** |
| 56 | + |
| 57 | +- **[y] Continue existing:** |
| 58 | + - Jump directly to the appropriate step based on `stepsCompleted`: |
| 59 | + - `[1]` → Load `{nextStepFile}` (Step 2) |
| 60 | + - `[1, 2]` → Load `{skipToStepFile}` (Step 3) |
| 61 | + - `[1, 2, 3]` → Load `{workflow_path}/steps/step-04-review.md` (Step 4) |
| 62 | +- **[n] Archive and start fresh:** |
| 63 | + - Rename `{wipFile}` to `{implementation_artifacts}/tech-spec-{slug}-archived-{date}.md` |
| 64 | + |
| 65 | +### 1. Greet and Ask for Initial Request |
| 66 | + |
| 67 | +a) **Greet the user briefly:** |
| 68 | + |
| 69 | +"Hey {user_name}! What are we building today?" |
| 70 | + |
| 71 | +b) **Get their initial description.** Don't ask detailed questions yet - just understand enough to know where to look. |
| 72 | + |
| 73 | +### 2. Quick Orient Scan |
| 74 | + |
| 75 | +a) **Before asking detailed questions, do a rapid scan to understand the landscape:** |
| 76 | + |
| 77 | +b) **Check for existing context docs:** |
| 78 | + |
| 79 | +- Check `{output_folder}` for planning documents (PRD, architecture, epics) |
| 80 | +- Check for `**/project-context.md` - if it exists, skim for patterns and conventions |
| 81 | +- Check for any existing stories or specs related to user's request |
| 82 | + |
| 83 | +c) **If user mentioned specific code/features, do a quick scan:** |
| 84 | + |
| 85 | +- Search for relevant files/classes/functions they mentioned |
| 86 | +- Skim the structure (don't deep-dive yet - that's Step 2) |
| 87 | +- Note: tech stack, obvious patterns, file locations |
| 88 | + |
| 89 | +d) **Build mental model:** |
| 90 | + |
| 91 | +- What's the likely landscape for this feature? |
| 92 | +- What's the likely scope based on what you found? |
| 93 | +- What questions do you NOW have, informed by the code? |
| 94 | + |
| 95 | +**This scan should take < 30 seconds. Just enough to ask smart questions.** |
| 96 | + |
| 97 | +### 3. Ask Informed Questions |
| 98 | + |
| 99 | +a) **Now ask clarifying questions - but make them INFORMED by what you found:** |
| 100 | + |
| 101 | +Instead of generic questions like "What's the scope?", ask specific ones like: |
| 102 | +- "`AuthService` handles validation in the controller — should the new field follow that pattern or move it to a dedicated validator?" |
| 103 | +- "`NavigationSidebar` component uses local state for the 'collapsed' toggle — should we stick with that or move it to the global store?" |
| 104 | +- "The epics doc mentions X - is this related?" |
| 105 | + |
| 106 | +**Adapt to {user_skill_level}.** Technical users want technical questions. Non-technical users need translation. |
| 107 | + |
| 108 | +b) **If no existing code is found:** |
| 109 | + |
| 110 | +- Ask about intended architecture, patterns, constraints |
| 111 | +- Ask what similar systems they'd like to emulate |
| 112 | + |
| 113 | +### 4. Capture Core Understanding |
| 114 | + |
| 115 | +a) **From the conversation, extract and confirm:** |
| 116 | + |
| 117 | +- **Title**: A clear, concise name for this work |
| 118 | +- **Slug**: URL-safe version of title (lowercase, hyphens, no spaces) |
| 119 | +- **Problem Statement**: What problem are we solving? |
| 120 | +- **Solution**: High-level approach (1-2 sentences) |
| 121 | +- **In Scope**: What's included |
| 122 | +- **Out of Scope**: What's explicitly NOT included |
| 123 | + |
| 124 | +b) **Ask the user to confirm the captured understanding before proceeding.** |
| 125 | + |
| 126 | +### 5. Initialize WIP File |
| 127 | + |
| 128 | +a) **Create the tech-spec WIP file:** |
| 129 | + |
| 130 | +1. Copy template from `{templateFile}` |
| 131 | +2. Write to `{wipFile}` |
| 132 | +3. Update frontmatter with captured values: |
| 133 | + ```yaml |
| 134 | + --- |
| 135 | + title: '{title}' |
| 136 | + slug: '{slug}' |
| 137 | + created: '{date}' |
| 138 | + status: 'in-progress' |
| 139 | + stepsCompleted: [1] |
| 140 | + tech_stack: [] |
| 141 | + files_to_modify: [] |
| 142 | + code_patterns: [] |
| 143 | + test_patterns: [] |
| 144 | + --- |
| 145 | + ``` |
| 146 | +4. Fill in Overview section with Problem Statement, Solution, and Scope |
| 147 | +5. Fill in Context for Development section with any technical preferences or constraints gathered during informed discovery. |
| 148 | +6. Write the file |
| 149 | + |
| 150 | +b) **Report to user:** |
| 151 | + |
| 152 | +"Created: `{wipFile}` |
| 153 | + |
| 154 | +**Captured:** |
| 155 | + |
| 156 | +- Title: {title} |
| 157 | +- Problem: {problem_statement_summary} |
| 158 | +- Scope: {scope_summary}" |
| 159 | + |
| 160 | +### 6. Present Checkpoint Menu |
| 161 | + |
| 162 | +a) **Display menu:** |
| 163 | + |
| 164 | +``` |
| 165 | +[a] Advanced Elicitation - dig deeper into requirements |
| 166 | +[c] Continue - proceed to next step |
| 167 | +[p] Party Mode - bring in other experts |
| 168 | +``` |
| 169 | + |
| 170 | +b) **HALT and wait for user selection.** |
| 171 | + |
| 172 | +#### Menu Handling: |
| 173 | + |
| 174 | +- **[a]**: Load and execute `{advanced_elicitation}`, then return here and redisplay menu |
| 175 | +- **[c]**: Load and execute `{nextStepFile}` (Map Technical Constraints) |
| 176 | +- **[p]**: Load and execute `{party_mode_exec}`, then return here and redisplay menu |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## REQUIRED OUTPUTS: |
| 181 | + |
| 182 | +- MUST initialize WIP file with captured metadata. |
| 183 | + |
| 184 | +## VERIFICATION CHECKLIST: |
| 185 | + |
| 186 | +- [ ] WIP check performed FIRST before any greeting. |
| 187 | +- [ ] `{wipFile}` created with correct frontmatter, Overview, Context for Development, and `stepsCompleted: [1]`. |
| 188 | +- [ ] User selected [c] to continue. |
0 commit comments