ai-flow-dev 2.1.3 → 2.1.4

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 (96) hide show
  1. package/README.md +25 -38
  2. package/dist/cli.js +68 -46
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +5 -5
  5. package/prompts/backend/flow-build-phase-0.md +31 -63
  6. package/prompts/backend/flow-build-phase-1.md +9 -17
  7. package/prompts/backend/flow-build-phase-10.md +199 -585
  8. package/prompts/backend/flow-build-phase-2.md +152 -86
  9. package/prompts/backend/flow-build-phase-3.md +108 -68
  10. package/prompts/backend/flow-build-phase-4.md +5 -8
  11. package/prompts/backend/flow-build-phase-5.md +39 -12
  12. package/prompts/backend/flow-build-phase-6.md +29 -8
  13. package/prompts/backend/flow-build-phase-7.md +120 -40
  14. package/prompts/backend/flow-build-phase-8.md +28 -65
  15. package/prompts/backend/flow-build-phase-9.md +267 -1298
  16. package/prompts/backend/flow-build.md +881 -957
  17. package/prompts/backend/flow-dev-commit.md +27 -50
  18. package/prompts/backend/flow-dev-feature.md +1929 -2017
  19. package/prompts/backend/flow-dev-fix.md +936 -964
  20. package/prompts/backend/flow-dev-refactor.md +672 -701
  21. package/prompts/backend/flow-dev-review.md +356 -389
  22. package/prompts/backend/flow-dev-work.md +1066 -1118
  23. package/prompts/backend/flow-docs-sync.md +20 -196
  24. package/prompts/frontend/flow-build-phase-0.md +503 -484
  25. package/prompts/frontend/flow-build-phase-1.md +445 -433
  26. package/prompts/frontend/flow-build-phase-2.md +910 -957
  27. package/prompts/frontend/flow-build-phase-3.md +692 -664
  28. package/prompts/frontend/flow-build-phase-4.md +478 -463
  29. package/prompts/frontend/flow-build-phase-5.md +488 -467
  30. package/prompts/frontend/flow-build-phase-6.md +571 -550
  31. package/prompts/frontend/flow-build-phase-7.md +560 -592
  32. package/prompts/frontend/flow-build-phase-8.md +17 -42
  33. package/prompts/frontend/flow-build.md +457 -503
  34. package/prompts/frontend/flow-docs-sync.md +14 -35
  35. package/prompts/mobile/flow-build-phase-0.md +104 -97
  36. package/prompts/mobile/flow-build-phase-1.md +137 -122
  37. package/prompts/mobile/flow-build-phase-2.md +123 -130
  38. package/prompts/mobile/flow-build-phase-3.md +144 -149
  39. package/prompts/mobile/flow-build-phase-4.md +140 -132
  40. package/prompts/mobile/flow-build-phase-5.md +70 -70
  41. package/prompts/mobile/flow-build-phase-6.md +136 -134
  42. package/prompts/mobile/flow-build-phase-7.md +24 -58
  43. package/prompts/mobile/flow-build-phase-8.md +17 -42
  44. package/prompts/mobile/flow-build.md +47 -97
  45. package/prompts/mobile/flow-docs-sync.md +13 -32
  46. package/prompts/shared/mermaid-guidelines.md +106 -0
  47. package/prompts/shared/scope-levels.md +126 -0
  48. package/prompts/shared/story-points.md +65 -0
  49. package/prompts/shared/task-format.md +86 -0
  50. package/templates/AGENT.template.md +194 -15
  51. package/templates/backend/README.template.md +2 -32
  52. package/templates/backend/ai-instructions.template.md +2 -32
  53. package/templates/backend/copilot-instructions.template.md +2 -22
  54. package/templates/backend/docs/api.template.md +89 -20
  55. package/templates/backend/docs/architecture.template.md +165 -53
  56. package/templates/backend/docs/business-flows.template.md +7 -14
  57. package/templates/backend/docs/code-standards.template.md +2 -38
  58. package/templates/backend/docs/contributing.template.md +2 -16
  59. package/templates/backend/docs/data-model.template.md +125 -21
  60. package/templates/backend/docs/operations.template.md +179 -50
  61. package/templates/backend/docs/testing.template.md +2 -42
  62. package/templates/backend/project-brief.template.md +2 -28
  63. package/templates/backend/specs/configuration.template.md +2 -14
  64. package/templates/backend/specs/security.template.md +2 -32
  65. package/templates/frontend/README.template.md +2 -18
  66. package/templates/frontend/ai-instructions.template.md +2 -20
  67. package/templates/frontend/docs/api-integration.template.md +12 -30
  68. package/templates/frontend/docs/components.template.md +2 -28
  69. package/templates/frontend/docs/error-handling.template.md +11 -27
  70. package/templates/frontend/docs/operations.template.md +8 -18
  71. package/templates/frontend/docs/performance.template.md +8 -18
  72. package/templates/frontend/docs/pwa.template.md +8 -18
  73. package/templates/frontend/docs/state-management.template.md +2 -28
  74. package/templates/frontend/docs/styling.template.md +2 -26
  75. package/templates/frontend/docs/testing.template.md +2 -28
  76. package/templates/frontend/project-brief.template.md +2 -16
  77. package/templates/frontend/specs/accessibility.template.md +8 -18
  78. package/templates/frontend/specs/configuration.template.md +2 -24
  79. package/templates/frontend/specs/security.template.md +10 -24
  80. package/templates/fullstack/README.template.md +17 -47
  81. package/templates/fullstack/ai-instructions.template.md +17 -45
  82. package/templates/fullstack/project-brief.template.md +16 -42
  83. package/templates/fullstack/specs/configuration.template.md +16 -42
  84. package/templates/mobile/README.template.md +11 -29
  85. package/templates/mobile/ai-instructions.template.md +11 -27
  86. package/templates/mobile/docs/app-store.template.md +11 -29
  87. package/templates/mobile/docs/architecture.template.md +14 -38
  88. package/templates/mobile/docs/native-features.template.md +16 -44
  89. package/templates/mobile/docs/navigation.template.md +9 -23
  90. package/templates/mobile/docs/offline-strategy.template.md +10 -26
  91. package/templates/mobile/docs/permissions.template.md +9 -23
  92. package/templates/mobile/docs/state-management.template.md +12 -32
  93. package/templates/mobile/docs/testing.template.md +14 -38
  94. package/templates/mobile/project-brief.template.md +12 -30
  95. package/templates/mobile/specs/build-configuration.template.md +10 -26
  96. package/templates/mobile/specs/deployment.template.md +9 -23
@@ -1,709 +1,323 @@
1
- # AI Flow - Phase 10: User Stories Generation 📖
1
+ # AI Flow - Phase 10: User Stories Generation
2
2
 
3
3
  **YOU ARE AN EXPERT PRODUCT OWNER AND AGILE SPECIALIST.**
4
4
 
5
- Your mission in Phase 10 is to generate detailed, actionable User Stories with acceptance criteria, technical tasks, and test cases from the roadmap generated in Phase 9.
6
-
7
- ---
8
-
9
- ## 🎯 Phase 10 Objective
10
-
11
- Generate executable User Stories following agile best practices with:
12
-
13
- - **Gherkin-style acceptance criteria** (Given/When/Then)
14
- - **Technical task breakdown** (Backend/Frontend/Testing)
15
- - **QA test cases** derived from acceptance criteria
16
- - **Definition of Done** checklist
17
- - **Story Points** inherited from roadmap
18
-
19
- ---
20
-
21
- ## Command Modes
22
-
23
- - **`/flow-build fase 10`** → Generate all User Stories (or Sprint 1 selection)
24
- - **`/flow-build fase 10 EP-XXX`** → Generate User Stories for specific Epic
25
- - **`/flow-build fase 10 HU-XXX-XXX`** → Generate/regenerate specific User Story
26
-
27
- ---
5
+ Generate detailed User Stories from the roadmap created in Phase 9.
28
6
 
29
7
  ## Prerequisites
30
8
 
31
- Before executing Phase 10, verify:
32
-
33
- - ✅ Phase 9 completed (`docs/roadmap.md` exists)
34
- - ✅ All Phase 1-8 documentation exists
35
- - ✅ Roadmap contains Epics, Features, and Tasks
36
-
37
- ---
9
+ - Phase 9 completed (`docs/roadmap.md` exists with context variables)
10
+ - All Phase 1-8 documentation exists
38
11
 
39
12
  ## Duration
40
13
 
41
- ⏱️ **Estimated Time:**
42
-
43
14
  - All Epics: 30-60 minutes
44
15
  - One Epic: 5-10 minutes
45
16
  - One User Story: 2-3 minutes
46
17
 
47
18
  ---
48
19
 
49
- ## Workflow: 4 Steps
20
+ ## Command Modes
50
21
 
51
- ### Step 10.1: Mode Detection & Context Loading (Automatic)
52
-
53
- **Parse command arguments:**
54
-
55
- ```typescript
56
- const args = getArguments(); // From /flow-build fase 10 [args]
57
-
58
- if (!args || args.length === 0) {
59
- mode = 'ALL'; // Generate all or prompt for selection
60
- } else if (args[0].match(/^EP-\d{3}$/)) {
61
- mode = 'EPIC';
62
- targetId = args[0]; // e.g., EP-001
63
- } else if (args[0].match(/^HU-\d{3}-\d{3}$/)) {
64
- mode = 'STORY';
65
- targetId = args[0]; // e.g., HU-001-001
66
- } else {
67
- showError(`Invalid format: ${args[0]}`);
68
- showHelp(`
69
- Usage:
70
- /flow-build fase 10 → Generate all (or Sprint 1)
71
- /flow-build fase 10 EP-001 → Generate Epic 001 User Stories
72
- /flow-build fase 10 HU-001-001 → Generate specific User Story
73
-
74
- Output location: docs/user-stories/
75
- `);
76
- exit();
77
- }
78
22
  ```
79
-
80
- **Display mode:**
81
-
23
+ /flow-build fase 10 → Generate all (or Sprint 1 selection)
24
+ /flow-build fase 10 EP-001 → Generate User Stories for specific Epic
25
+ /flow-build fase 10 HU-001-001 → Generate/regenerate specific User Story
82
26
  ```
83
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
84
- 📖 Phase 10: User Stories Generation
85
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
86
27
 
87
- Mode: [ALL | EPIC: EP-001 | STORY: HU-001-001]
88
- ```
28
+ ---
89
29
 
90
- **Load required documentation:**
30
+ ## Workflow: 4 Steps
91
31
 
92
- ```
93
- Loading project context...
94
-
95
- ✅ docs/roadmap.md (5 Epics, 18 Features, 89 SP)
96
- ✅ project-brief.md (business context)
97
- ✅ ai-instructions.md (tech stack, patterns)
98
- ✅ docs/data-model.md (entities, relationships)
99
- ✅ docs/architecture.md (system design)
100
- ✅ docs/api.md (endpoints)
101
- ✅ specs/security.md (auth, validation)
102
- ✅ docs/testing.md (test strategy)
103
- ```
32
+ ### Step 10.1: Load Context from Roadmap
104
33
 
105
- **If docs/roadmap.md NOT found:**
34
+ **Extract from `docs/roadmap.md`:**
106
35
 
107
36
  ```
108
- Error: docs/roadmap.md not found
109
-
110
- Phase 10 requires docs/roadmap.md from Phase 9.
111
-
112
- Options:
113
- 1. ✅ Generate roadmap first: /flow-build fase 9
114
- 2. ⏭️ Exit and run Phase 9 manually
115
-
116
- Your choice (1): _
37
+ CONTEXT LOADED
38
+ ├── Language: {{LANGUAGE}}
39
+ ├── Framework: {{FRAMEWORK}}
40
+ ├── Architecture: {{ARCHITECTURE}}
41
+ ├── Epics: X
42
+ ├── Features: X
43
+ ├── Tasks: X
44
+ └── Total SP: X
117
45
  ```
118
46
 
119
- ---
120
-
121
- ### Step 10.2: Execute Based on Mode
47
+ **Load additional context from:**
48
+ - `project-brief.md` - Business context, target users
49
+ - `ai-instructions.md` - Tech stack, patterns
50
+ - `docs/api.md` - Endpoints specification
51
+ - `specs/security.md` - Security requirements
122
52
 
123
53
  ---
124
54
 
125
- #### **Mode 1: ALL (No parameters)**
55
+ ### Step 10.2: Select Scope
126
56
 
127
- **Show scope selection:**
57
+ **Show options:**
128
58
 
129
59
  ```
130
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
131
- 📋 Scope Selection
132
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
133
-
134
- Found 5 Epics with 18 Features in docs/roadmap.md
135
-
136
- Total Story Points: 89 SP (~4-5 weeks for 1 dev)
137
-
138
- Generate User Stories for:
139
-
140
- A) ✅ All Epics (18 User Stories) - Complete backlog
141
- Epics: EP-001, EP-002, EP-003, EP-004, EP-005
142
- Time: ~40-50 minutes
143
-
144
- B) 📋 Sprint 1 Epics only (Priority P0/P1) - Quick start
145
- Epics: EP-001 (5 stories), EP-002 (3 stories)
146
- Total: 8 User Stories
147
- Time: ~15-20 minutes
148
-
149
- C) 🎯 Specific Epics (select which ones)
150
- Choose from: EP-001, EP-002, EP-003, EP-004, EP-005
151
-
152
- D) ⏭️ Cancel (run specific Epic later)
153
- Example: /flow-build fase 10 EP-001
154
-
155
- Your choice (B): _
156
- ```
157
-
158
- **If choice B (Sprint 1):**
159
-
160
- ```
161
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
162
- 📖 Generating Sprint 1 User Stories
163
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
164
-
165
- Selected Epics:
166
- - EP-001: Autenticación (5 stories, 13 SP)
167
- - EP-002: Gestión Usuarios (3 stories, 21 SP)
168
-
169
- Total: 8 User Stories, 34 SP
170
-
171
- Generating...
172
-
173
- [████████████████████] EP-001 (5/5) ✅
174
- ✅ HU-001-001.md - Login básico (5 SP)
175
- ✅ HU-001-002.md - Login OAuth (3 SP)
176
- ✅ HU-001-003.md - Recuperación contraseña (3 SP)
177
- ✅ HU-001-004.md - Refresh tokens (1 SP)
178
- ✅ HU-001-005.md - Logout (1 SP)
179
-
180
- [████████████████████] EP-002 (3/3) ✅
181
- ✅ HU-002-001.md - CRUD usuarios (8 SP)
182
- ✅ HU-002-002.md - Perfiles y roles (8 SP)
183
- ✅ HU-002-003.md - Admin dashboard (5 SP)
184
-
185
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
186
- ✅ Sprint 1 User Stories Generated
187
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
188
-
189
- Created:
190
- 📁 .ai-flow/user-stories/
191
- ├── EP-001/
192
- │ ├── HU-001-001.md ✅
193
- │ ├── HU-001-002.md ✅
194
- │ ├── HU-001-003.md ✅
195
- │ ├── HU-001-004.md ✅
196
- │ └── HU-001-005.md ✅
197
- └── EP-002/
198
- ├── HU-002-001.md ✅
199
- ├── HU-002-002.md ✅
200
- └── HU-002-003.md ✅
201
-
202
- Total: 8 User Stories (34 SP)
203
-
204
- 🚀 Ready to start Sprint 1!
205
-
206
- Next steps:
207
- 1. Review User Stories in .ai-flow/user-stories/ folder
208
- 2. Start implementing: /flow-dev-feature HU-001-001
209
- 3. Generate more Epics later: /flow-build fase 10 EP-003
60
+ SCOPE SELECTION
61
+ ├── A) All Epics (complete backlog)
62
+ ├── B) Sprint 1 only (P0/P1 priorities)
63
+ ├── C) Specific Epics (select which)
64
+ └── D) Cancel
210
65
  ```
211
66
 
212
67
  ---
213
68
 
214
- #### **Mode 2: EPIC (e.g., /flow-build fase 10 EP-001)**
215
-
216
- ```
217
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
218
- 📖 Generating User Stories for EP-001
219
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
220
-
221
- Loading Epic from docs/roadmap.md...
222
-
223
- Epic: EP-001 - Autenticación y Seguridad
224
- Priority: P0 (Critical)
225
- Story Points: 13 SP
226
- Features: 5
227
-
228
- Features in this Epic:
229
- 1. Feature 1.1: Login básico (5 SP)
230
- 2. Feature 1.2: Login OAuth (3 SP)
231
- 3. Feature 1.3: Recuperación contraseña (3 SP)
232
- 4. Feature 1.4: Refresh tokens (1 SP)
233
- 5. Feature 1.5: Logout (1 SP)
69
+ ### Step 10.3: Generate User Story Documents
234
70
 
235
- User Stories to generate: 5
71
+ **For each Feature in roadmap, create `docs/user-stories/EP-XXX/HU-XXX-YYY.md`:**
236
72
 
237
- Generating...
238
-
239
- [████████████████████] (5/5) ✅
240
-
241
- ✅ HU-001-001.md created (Login básico)
242
- ✅ HU-001-002.md created (Login OAuth)
243
- ✅ HU-001-003.md created (Recuperación contraseña)
244
- ✅ HU-001-004.md created (Refresh tokens)
245
- ✅ HU-001-005.md created (Logout)
246
-
247
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
248
- ✅ EP-001 User Stories Generated
249
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
250
-
251
- Location: .ai-flow/user-stories/EP-001/
73
+ ```markdown
74
+ # User Story: HU-{{EPIC}}-{{FEATURE}}
252
75
 
253
- Files created:
254
- - HU-001-001.md (5 SP, 6 tasks, 8 test cases)
255
- - HU-001-002.md (3 SP, 4 tasks, 5 test cases)
256
- - HU-001-003.md (3 SP, 5 tasks, 6 test cases)
257
- - HU-001-004.md (1 SP, 2 tasks, 3 test cases)
258
- - HU-001-005.md (1 SP, 2 tasks, 2 test cases)
76
+ **Title:** {{FEATURE_NAME}}
77
+ **Priority:** {{PRIORITY}} (Must Have | Should Have | Could Have)
78
+ **Story Points:** {{SP}} SP
79
+ **Sprint:** {{SPRINT}} or "Backlog"
259
80
 
260
- Total: 5 User Stories, 13 SP, 19 tasks, 24 test cases
81
+ ## Description
261
82
 
262
- Next: Start implementing with /flow-dev-feature HU-001-001
263
- ```
83
+ **As a** {{USER_TYPE}}
84
+ **I want** {{DESIRED_FUNCTIONALITY}}
85
+ **So that** {{USER_BENEFIT}}
264
86
 
265
87
  ---
266
88
 
267
- #### **Mode 3: STORY (e.g., /flow-build fase 10 HU-001-001)**
268
-
269
- ```
270
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
271
- 📖 Generating User Story: HU-001-001
272
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
273
-
274
- Checking if file exists...
275
-
276
- ⚠️ .ai-flow/user-stories/EP-001/HU-001-001.md already exists
89
+ ## Acceptance Criteria
277
90
 
278
- File size: 4.2 KB
279
- Last modified: 2025-12-10 15:30
91
+ > Minimum 5-6 scenarios: Happy path (2-3) + Error cases (2) + Edge/Security (1-2)
280
92
 
281
- Options:
282
- 1. 🔄 Regenerate (overwrite completely)
283
- 2. 📝 Update (merge new content, preserve manual edits)
284
- 3. 👀 View current (show existing content)
285
- 4. ❌ Cancel
93
+ 1. **Given** {{PRECONDITION}}
94
+ **When** {{ACTION}}
95
+ **Then** {{EXPECTED_RESULT}}
286
96
 
287
- Your choice (2): _
97
+ 2. **Given** {{PRECONDITION}}
98
+ **When** {{ACTION}}
99
+ **Then** {{EXPECTED_RESULT}}
288
100
 
289
- [If user chooses 1: Regenerate]
101
+ 3. **Given** {{ERROR_PRECONDITION}}
102
+ **When** {{ERROR_ACTION}}
103
+ **Then** {{ERROR_RESULT}}
290
104
 
291
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
292
- 🔄 Regenerating HU-001-001
293
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
105
+ 4. **Given** {{EDGE_PRECONDITION}}
106
+ **When** {{EDGE_ACTION}}
107
+ **Then** {{EDGE_RESULT}}
294
108
 
295
- ⚠️ WARNING: This will overwrite all manual changes!
296
-
297
- Backup current file? (Y/n): Y
298
-
299
- ✅ Backup created: docs/user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
300
-
301
- Loading context from docs/roadmap.md...
302
- - Epic: EP-001 Autenticación
303
- - Feature: 1.1 Login básico (5 SP)
304
- - Priority: P0
305
-
306
- Generating User Story...
307
-
308
- ✅ HU-001-001.md regenerated successfully!
309
-
310
- Changes:
311
- + Added 2 new acceptance criteria (password strength, rate limiting)
312
- + Updated 3 test cases (added edge cases)
313
- + Refreshed Definition of Done
314
- ~ No changes to technical tasks
315
-
316
- Location: .ai-flow/user-stories/EP-001/HU-001-001.md
317
- Backup: .ai-flow/user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
318
-
319
- [If file doesn't exist - New User Story]
320
-
321
- ✅ File doesn't exist, creating new User Story...
322
-
323
- Context from roadmap:
324
- - Epic: EP-001 Autenticación
325
- - Feature: 1.1 Login básico (5 SP)
326
- - Priority: P0 (Critical)
327
- - Tasks: 6 (from docs/roadmap.md)
328
-
329
- Generating User Story with:
330
- ✅ User Story format (Como/Quiero/Para)
331
- ✅ Acceptance Criteria (Gherkin Given/When/Then)
332
- ✅ Technical Tasks (Backend/Frontend/Testing)
333
- ✅ QA Test Cases (derived from criteria)
334
- ✅ Estimation (Story Points + Time)
335
- ✅ Dependencies
336
- ✅ Definition of Done
337
-
338
- ✅ HU-001-001.md created successfully!
339
-
340
- Location: .ai-flow/user-stories/EP-001/HU-001-001.md
341
- Size: 4.2 KB
342
- Tasks: 6
343
- Test Cases: 8
344
- Story Points: 5 SP (~6-8h)
345
-
346
- Next: Implement with /flow-dev-feature HU-001-001
347
- ```
109
+ 5. **Given** {{SECURITY_PRECONDITION}}
110
+ **When** {{SECURITY_ACTION}}
111
+ **Then** {{SECURITY_RESULT}}
348
112
 
349
113
  ---
350
114
 
351
- ### Step 10.3: Generate User Story Document
352
-
353
- **For each User Story, generate complete `.md` file with this structure:**
354
-
355
- ```markdown
356
- # 📖 Historia de Usuario: HU-{{XXX}}-{{YYY}} - {{TÍTULO}}
357
-
358
- ## Epic
115
+ ## Technical Notes
359
116
 
360
- EP-{{XXX}}: {{EPIC_NAME}}
117
+ > From ai-instructions.md, architecture.md, security.md
361
118
 
362
- ## Historia de Usuario
363
-
364
- **ID:** HU-{{XXX}}-{{YYY}}
365
- **Título:** {{FEATURE_NAME}}
366
- **Prioridad:** {{PRIORITY}} (Alta | Media | Baja)
367
- **Sprint:** {{SPRINT_NUMBER}} o "Backlog"
368
- **Story Points:** {{SP}} SP
369
- **Estimación:** {{TIME_ESTIMATE}}
370
-
371
- **Como:** {{USER_TYPE}}
372
- **Quiero:** {{DESIRED_FUNCTIONALITY}}
373
- **Para:** {{USER_BENEFIT}}
119
+ - {{IMPLEMENTATION_DETAIL_1}}
120
+ - {{IMPLEMENTATION_DETAIL_2}}
121
+ - {{SECURITY_REQUIREMENT}}
122
+ - {{INTEGRATION_DETAIL}}
374
123
 
375
124
  ---
376
125
 
377
- ## Criterios de Aceptación
378
-
379
- ### Escenario 1: {{SCENARIO_NAME}}
126
+ ## Tasks
380
127
 
381
- **Dado que** {{PRECONDITION}}
382
- **Cuando** {{ACTION}}
383
- **Entonces** {{EXPECTED_RESULT}}
128
+ > Inherited from docs/roadmap.md Feature {{FEATURE_NUMBER}}
384
129
 
385
- ### Escenario 2: {{SCENARIO_NAME}}
130
+ {{TASKS_FROM_ROADMAP}}
386
131
 
387
- **Dado que** {{PRECONDITION}}
388
- **Cuando** {{ACTION}}
389
- **Entonces** {{EXPECTED_RESULT}}
390
-
391
- ### Escenario 3: {{SCENARIO_NAME}}
132
+ ---
392
133
 
393
- **Dado que** {{PRECONDITION}}
394
- **Cuando** {{ACTION}}
395
- **Entonces** {{EXPECTED_RESULT}}
134
+ ## Dependencies
396
135
 
397
- **[Generate 3-5 scenarios covering: happy path, error cases, edge cases]**
136
+ - **Requires:** {{REQUIRED_STORIES}}
137
+ - **Blocks:** {{BLOCKED_STORIES}}
138
+ - **Related:** {{RELATED_STORIES}}
398
139
 
399
140
  ---
400
141
 
401
- ## Tareas Técnicas
142
+ ## Definition of Done
402
143
 
403
- > **Source:** Inherited from docs/roadmap.md Feature {{FEATURE_NUMBER}}
144
+ - [ ] Code implemented and peer reviewed
145
+ - [ ] Unit tests passing (coverage >= 80%)
146
+ - [ ] Integration tests implemented
147
+ - [ ] Security requirements verified
148
+ - [ ] API documentation updated
149
+ - [ ] QA validation completed
150
+ - [ ] No lint/format errors
404
151
 
405
- ### Backend
152
+ ---
406
153
 
407
- - [ ] **T-{{XXX}}-001:** {{TASK_DESCRIPTION}} • {{SP}} SP (~{{TIME}})
408
- File: {{FILE_PATH}}
409
- Dependencies: {{DEPENDENCIES}}
154
+ ## Estimation
410
155
 
411
- - [ ] **T-{{XXX}}-002:** {{TASK_DESCRIPTION}} • {{SP}} SP (~{{TIME}})
412
- File: {{FILE_PATH}}
413
- Dependencies: {{DEPENDENCIES}}
156
+ - **Story Points:** {{SP}} SP
157
+ - **Time Estimate:** {{TIME_RANGE}}
158
+ - **Complexity:** {{COMPLEXITY}} (Low | Medium | High)
414
159
 
415
- ### Frontend (if applicable)
160
+ ---
416
161
 
417
- - [ ] **T-{{XXX}}-003:** {{TASK_DESCRIPTION}} • {{SP}} SP (~{{TIME}})
418
- File: {{FILE_PATH}}
419
- Dependencies: {{DEPENDENCIES}}
162
+ ## Assignment
420
163
 
421
- ### Testing
164
+ - **Assigned to:** (Unassigned)
165
+ - **Start date:** (TBD)
166
+ - **Due date:** (TBD)
167
+ - **Status:** Draft | Ready | In Progress | Done
168
+ ```
422
169
 
423
- - [ ] **T-{{XXX}}-004:** {{TASK_DESCRIPTION}} • {{SP}} SP (~{{TIME}})
424
- File: {{FILE_PATH}}
425
- Dependencies: {{DEPENDENCIES}}
170
+ ---
426
171
 
427
- **Total Tasks:** {{N}}
428
- **Total SP:** {{TOTAL_SP}} Story Points
172
+ ### Step 10.4: Generate Test Cases (Separate Files)
429
173
 
430
- ---
174
+ **For each User Story, create `docs/user-stories/EP-XXX/tests/TC-XXX-YYY.md`:**
431
175
 
432
- ## Casos de Prueba (QA)
176
+ ```markdown
177
+ # Test Cases: HU-{{EPIC}}-{{FEATURE}}
433
178
 
434
- > **Derived from:** Acceptance Criteria (1 scenario = 1-2 test cases)
179
+ > Derived from Acceptance Criteria (1-2 test cases per scenario)
435
180
 
436
- ### TC-{{XXX}}-001: {{TEST_NAME}} (Happy Path)
181
+ ## TC-001: {{TEST_NAME}} (Happy Path)
437
182
 
438
- - **Precondición:** {{INITIAL_STATE}}
439
- - **Pasos:**
183
+ - **Precondition:** {{INITIAL_STATE}}
184
+ - **Test Data:**
185
+ - Field1: `value1`
186
+ - Field2: `value2`
187
+ - **Steps:**
440
188
  1. {{STEP_1}}
441
189
  2. {{STEP_2}}
442
190
  3. {{STEP_3}}
443
- - **Resultado Esperado:** {{EXPECTED_OUTCOME}}
444
- - **Prioridad:** Alta
445
- - **Tipo:** Funcional | Integración | E2E
191
+ - **Expected Result:** {{EXPECTED_OUTCOME}}
192
+ - **Priority:** High
193
+ - **Type:** Functional
194
+ - **Automatable:** Yes/No
446
195
 
447
- ### TC-{{XXX}}-002: {{TEST_NAME}} (Error Case)
196
+ ## TC-002: {{TEST_NAME}} (Error Case)
448
197
 
449
- - **Precondición:** {{INITIAL_STATE}}
450
- - **Pasos:**
198
+ - **Precondition:** {{INITIAL_STATE}}
199
+ - **Test Data:**
200
+ - Field1: `invalid_value`
201
+ - **Steps:**
451
202
  1. {{STEP_1}}
452
203
  2. {{STEP_2}}
453
- - **Resultado Esperado:** {{ERROR_MESSAGE}}
454
- - **Prioridad:** Alta
455
- - **Tipo:** Funcional
204
+ - **Expected Result:** {{ERROR_MESSAGE}}
205
+ - **Priority:** High
206
+ - **Type:** Functional
456
207
 
457
- ### TC-{{XXX}}-003: {{TEST_NAME}} (Edge Case)
208
+ ## TC-003: {{TEST_NAME}} (Edge Case)
458
209
 
459
- - **Precondición:** {{INITIAL_STATE}}
460
- - **Pasos:**
210
+ - **Precondition:** {{INITIAL_STATE}}
211
+ - **Test Data:**
212
+ - Field1: `boundary_value`
213
+ - **Steps:**
461
214
  1. {{STEP_1}}
462
- 2. {{STEP_2}}
463
- - **Resultado Esperado:** {{EXPECTED_BEHAVIOR}}
464
- - **Prioridad:** Media
465
- - **Tipo:** Límites | Validación
466
-
467
- **[Generate 1-2 test cases per acceptance scenario = 3-10 total]**
468
-
469
- ---
215
+ - **Expected Result:** {{EXPECTED_BEHAVIOR}}
216
+ - **Priority:** Medium
217
+ - **Type:** Boundary
470
218
 
471
- ## Estimación
219
+ ## TC-004: {{TEST_NAME}} (Security)
472
220
 
473
- - **Story Points:** {{SP}} SP (from roadmap)
474
- - **Tiempo Estimado:** {{TIME_RANGE}} (e.g., 6-8h, 1-2d)
475
- - **Complejidad:** Baja | Media | Alta
221
+ - **Precondition:** {{SECURITY_STATE}}
222
+ - **Test Data:**
223
+ - Attempts: 5
224
+ - **Steps:**
225
+ 1. {{SECURITY_STEP}}
226
+ - **Expected Result:** {{SECURITY_OUTCOME}}
227
+ - **Priority:** High
228
+ - **Type:** Security
476
229
 
477
230
  ---
478
231
 
479
- ## Dependencias
480
-
481
- - **Requiere:** {{REQUIRED_STORIES}} (e.g., HU-001-001 completed)
482
- - **Bloquea:** {{BLOCKED_STORIES}} (e.g., HU-002-003 cannot start)
483
- - **Relacionado con:** {{RELATED_STORIES}}
484
-
485
- ---
486
-
487
- ## Definición de Done (DoD)
488
-
489
- - [ ] Código implementado siguiendo ai-instructions.md
490
- - [ ] Code review aprobado (mín 1 revisor)
491
- - [ ] Tests unitarios escritos (cobertura > 80%)
492
- - [ ] Tests de integración pasando
493
- - [ ] Casos de prueba QA ejecutados y aprobados ({{N}}/{{N}})
494
- - [ ] Documentación técnica actualizada (docs/api.md, etc.)
495
- - [ ] Sin errores de lint ni formateo
496
- - [ ] Deploy a staging exitoso
497
- - [ ] Product Owner aprobó la funcionalidad
498
-
499
- ---
500
-
501
- ## Notas Técnicas
502
-
503
- > **Context from:**
504
- >
505
- > - ai-instructions.md ({{FRAMEWORK}} patterns)
506
- > - docs/architecture.md ({{ARCHITECTURE_PATTERN}})
507
- > - specs/security.md (authentication, validation)
508
-
509
- ### Consideraciones de Implementación:
510
-
511
- - {{TECHNICAL_NOTE_1}}
512
- - {{TECHNICAL_NOTE_2}}
513
- - {{ARCHITECTURE_DECISION}}
514
-
515
- ### APIs/Servicios Involucrados:
516
-
517
- - **Endpoint:** `{{HTTP_METHOD}} {{ENDPOINT_PATH}}`
518
- - **Servicio externo:** {{EXTERNAL_SERVICE}} (if any)
519
-
520
- ### Seguridad/Performance:
521
-
522
- - {{SECURITY_CONSIDERATION}}
523
- - {{PERFORMANCE_OPTIMIZATION}}
524
-
525
- ---
526
-
527
- ## Diseño/Prototipo
528
-
529
- 🎨 **Diseño:** {{DESIGN_LINK}} (if provided by user)
530
-
531
- ---
532
-
533
- ## Historial
534
-
535
- - **Creada:** {{DATE}} (Phase 10)
536
- - **Actualizada:** {{DATE}} (if regenerated)
537
- - **Estado:** Draft | Ready | In Progress | Done
232
+ **Total Test Cases:** {{N}}
233
+ **Coverage:** {{N}}/{{TOTAL_CRITERIA}} (100%)
538
234
  ```
539
235
 
540
236
  ---
541
237
 
542
- ### Step 10.4: Update Roadmap with Links
543
-
544
- **After generating User Stories, update docs/roadmap.md to add links:**
238
+ ### Step 10.5: Update Roadmap with Links
545
239
 
546
- ```
547
- Updating docs/roadmap.md with User Story links...
548
-
549
- ✅ Updated Feature 1.1 with link to HU-001-001
550
- ✅ Updated Feature 1.2 with link to HU-001-002
551
- ✅ Updated Feature 1.3 with link to HU-001-003
552
-
553
- docs/roadmap.md updated successfully!
554
- ```
555
-
556
- **Updated docs/roadmap.md format:**
240
+ **After generating, update `docs/roadmap.md`:**
557
241
 
558
242
  ```markdown
559
- ### Feature 1.1: Login básico 5 SP (~6-8h)
243
+ ### Feature 1.1: {{FEATURE_NAME}}{{SP}} SP
560
244
 
561
- **User Story:** 📖 [HU-001-001](./.ai-flow/user-stories/EP-001/HU-001-001.md)
562
-
563
- **Status:** ⚪ Not Started
245
+ **User Story:** [HU-001-001](docs/user-stories/EP-001/HU-001-001.md)
246
+ **Status:** Not Started
564
247
 
565
248
  **Tasks:**
566
-
567
- - [ ] T001 Write User entity tests • 1 SP
568
- - [ ] T002 Create User entity • 1 SP
569
- ...
249
+ {{TASKS}}
570
250
  ```
571
251
 
572
252
  ---
573
253
 
574
- ## 🎯 Generation Rules
575
-
576
- ### **1. User Story Format**
577
-
578
- - **Como:** Extract from project-brief.md (target users)
579
- - **Quiero:** From Feature name in roadmap
580
- - **Para:** From Feature scope/benefits
581
-
582
- ### **2. Acceptance Criteria**
583
-
584
- - **Minimum 3 scenarios:** Happy path + Error case + Edge case
585
- - **Gherkin format:** Dado/Cuando/Entonces (Given/When/Then)
586
- - **Testable:** Each scenario = executable test
587
- - **Based on:** API docs, business flows, security specs
588
-
589
- ### **3. Technical Tasks**
590
-
591
- - **Inherit from roadmap:** Use Tasks from docs/roadmap.md Feature
592
- - **Add file paths:** Exact location where code goes
593
- - **Add dependencies:** Which tasks block others
594
- - **Keep Story Points:** From roadmap estimation
595
-
596
- ### **4. Test Cases**
597
-
598
- - **Derive from criteria:** 1-2 test cases per acceptance scenario
599
- - **Types:** Funcional, Integración, E2E, Límites
600
- - **Priority:** Alta for happy/error paths, Media for edge cases
601
- - **Format:** Precondición Pasos Resultado esperado
602
-
603
- ### **5. Definition of Done**
604
-
605
- **Standard checklist (same for all stories):**
606
-
607
- - Code implemented
608
- - Code review passed
609
- - Tests written (unit + integration)
610
- - Tests passing
611
- - QA test cases executed
612
- - Documentation updated
613
- - Lint/format clean
614
- - Staging deploy successful
615
- - PO approval
616
-
617
- ### **6. Technical Notes**
618
-
619
- **Pull from documentation:**
620
-
621
- - `ai-instructions.md` → Framework patterns, code conventions
622
- - `docs/architecture.md` → Architecture pattern (Hexagonal, Clean, etc.)
623
- - `docs/data-model.md` → Entity schemas, relationships
624
- - `specs/security.md` → Auth requirements, validations
625
- - `docs/api.md` → Endpoint details
254
+ ## Generation Rules
255
+
256
+ ### User Story Format
257
+ - **Title:** From Feature name in roadmap
258
+ - **Priority:** MoSCoW (Must/Should/Could/Won't Have)
259
+ - **As a:** From project-brief.md (target users)
260
+ - **I want:** From Feature description
261
+ - **So that:** User value/benefit
262
+
263
+ ### Acceptance Criteria
264
+ - **Minimum 5-6 scenarios**
265
+ - **Gherkin format:** Given/When/Then
266
+ - **Include:** Happy path, Error cases, Edge cases, Security
267
+ - **Each scenario = executable test**
268
+
269
+ ### Technical Notes
270
+ - Pull from ai-instructions.md, architecture.md, security.md
271
+ - Be specific (e.g., "bcrypt 12 rounds", not "hash passwords")
272
+ - Include rate limiting, logging, integrations
273
+
274
+ ### Tasks
275
+ - **Inherit from roadmap** (don't duplicate)
276
+ - Keep same format: `TXXX [CAT] Desc • N SP → {{path}} | deps: X`
277
+ - Keep Story Points from roadmap
278
+
279
+ ### Test Cases
280
+ - **Separate file** per User Story
281
+ - 1-2 test cases per acceptance scenario
282
+ - Include specific test data
283
+ - Mark priority and type
626
284
 
627
285
  ---
628
286
 
629
- ## ⚠️ Rules & Constraints
630
-
631
- ### **NEVER:**
287
+ ## DO NOT
632
288
 
633
289
  - ❌ Create User Story without roadmap context
634
- - ❌ Duplicate tasks from roadmap (reference, don't copy)
635
- - ❌ Skip acceptance criteria
636
- - ❌ Generate test cases without criteria
637
- - ❌ Use generic DoD (personalize per story if needed)
638
- - ❌ Forget to update docs/roadmap.md with links
639
-
640
- ### **ALWAYS:**
641
-
642
- - ✅ Inherit Story Points from roadmap
643
- - ✅ Generate 3-5 acceptance scenarios (Gherkin)
644
- - ✅ Derive 1-2 test cases per scenario
645
- - ✅ Link back to Epic and Feature
646
- - ✅ Include technical context from docs
647
- - ✅ Update docs/roadmap.md with User Story links
290
+ - ❌ Skip acceptance criteria (minimum 5-6 required)
291
+ - ❌ Generate generic test cases without test data
292
+ - ❌ Duplicate tasks from roadmap
293
+ - ❌ Omit security scenarios
294
+ - ❌ Hardcode language-specific details
295
+ - ❌ Forget to update roadmap with links
296
+
297
+ ## ALWAYS
298
+
299
+ - ✅ Inherit context variables from roadmap
300
+ - ✅ Generate 5-6 Gherkin acceptance scenarios
301
+ - ✅ Include security scenarios
302
+ - ✅ Derive test cases from criteria
303
+ - ✅ Separate test cases into tests/ folder
304
+ - ✅ Update roadmap with User Story links
648
305
  - ✅ Create backup before regenerating
649
306
 
650
307
  ---
651
308
 
652
- ## 📊 Summary Format
653
-
654
- **After generation, show:**
309
+ ## Summary
655
310
 
656
311
  ```
657
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
658
- PHASE 10 COMPLETE: USER STORIES GENERATED
659
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
660
-
661
- Generated: {{N}} User Stories
662
- Total Story Points: {{SP}} SP
663
- Total Tasks: {{TASKS}}
664
- Total Test Cases: {{TC}}
665
-
666
- Files created:
667
- 📁 docs/user-stories/
668
- ├── EP-001/ (5 stories, 13 SP)
669
- ├── EP-002/ (3 stories, 21 SP)
670
- └── EP-003/ (4 stories, 18 SP)
671
-
672
- Updated:
673
- ✅ docs/roadmap.md (added User Story links)
674
-
675
- 🚀 Ready to start development!
312
+ PHASE 10 COMPLETE
313
+ ├── Generated: X User Stories
314
+ ├── Total SP: X SP
315
+ ├── Test Cases: X
316
+ ├── Files: docs/user-stories/EP-XXX/
317
+ └── Updated: docs/roadmap.md (added links)
676
318
 
677
319
  Next steps:
678
- 1. Review User Stories in docs/user-stories/ folder
320
+ 1. Review User Stories in docs/user-stories/
679
321
  2. Start implementing: /flow-dev-feature HU-001-001
680
- 3. Track progress: /flow-dev-work
681
- 4. Generate more stories: /flow-build fase 10 EP-004
682
-
683
- Happy coding! 🎉
322
+ 3. Generate more: /flow-build fase 10 EP-XXX
684
323
  ```
685
-
686
- ---
687
-
688
- ## 🔗 Integration with Phase 9
689
-
690
- **Phase 9 provides:**
691
-
692
- - Epics structure
693
- - Features with Story Points
694
- - Technical tasks breakdown
695
- - Dependencies
696
-
697
- **Phase 10 adds:**
698
-
699
- - User Story format (Como/Quiero/Para)
700
- - Acceptance criteria (Gherkin)
701
- - Test cases (derived from criteria)
702
- - Definition of Done
703
- - Technical context from all docs
704
-
705
- **Together they form:** Complete backlog ready for execution
706
-
707
- ---
708
-
709
- **EXECUTION:** Execute workflow based on detected mode (ALL | EPIC | STORY)