ai-flow-dev 2.1.1 β†’ 2.1.3

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.
@@ -0,0 +1,709 @@
1
+ # AI Flow - Phase 10: User Stories Generation πŸ“–
2
+
3
+ **YOU ARE AN EXPERT PRODUCT OWNER AND AGILE SPECIALIST.**
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
+ ---
28
+
29
+ ## Prerequisites
30
+
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
+ ---
38
+
39
+ ## Duration
40
+
41
+ ⏱️ **Estimated Time:**
42
+
43
+ - All Epics: 30-60 minutes
44
+ - One Epic: 5-10 minutes
45
+ - One User Story: 2-3 minutes
46
+
47
+ ---
48
+
49
+ ## Workflow: 4 Steps
50
+
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
+ ```
79
+
80
+ **Display mode:**
81
+
82
+ ```
83
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
84
+ πŸ“– Phase 10: User Stories Generation
85
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
86
+
87
+ Mode: [ALL | EPIC: EP-001 | STORY: HU-001-001]
88
+ ```
89
+
90
+ **Load required documentation:**
91
+
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
+ ```
104
+
105
+ **If docs/roadmap.md NOT found:**
106
+
107
+ ```
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): _
117
+ ```
118
+
119
+ ---
120
+
121
+ ### Step 10.2: Execute Based on Mode
122
+
123
+ ---
124
+
125
+ #### **Mode 1: ALL (No parameters)**
126
+
127
+ **Show scope selection:**
128
+
129
+ ```
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
210
+ ```
211
+
212
+ ---
213
+
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)
234
+
235
+ User Stories to generate: 5
236
+
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/
252
+
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)
259
+
260
+ Total: 5 User Stories, 13 SP, 19 tasks, 24 test cases
261
+
262
+ Next: Start implementing with /flow-dev-feature HU-001-001
263
+ ```
264
+
265
+ ---
266
+
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
277
+
278
+ File size: 4.2 KB
279
+ Last modified: 2025-12-10 15:30
280
+
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
286
+
287
+ Your choice (2): _
288
+
289
+ [If user chooses 1: Regenerate]
290
+
291
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
292
+ πŸ”„ Regenerating HU-001-001
293
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
294
+
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
+ ```
348
+
349
+ ---
350
+
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
359
+
360
+ EP-{{XXX}}: {{EPIC_NAME}}
361
+
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}}
374
+
375
+ ---
376
+
377
+ ## Criterios de AceptaciΓ³n
378
+
379
+ ### Escenario 1: {{SCENARIO_NAME}}
380
+
381
+ **Dado que** {{PRECONDITION}}
382
+ **Cuando** {{ACTION}}
383
+ **Entonces** {{EXPECTED_RESULT}}
384
+
385
+ ### Escenario 2: {{SCENARIO_NAME}}
386
+
387
+ **Dado que** {{PRECONDITION}}
388
+ **Cuando** {{ACTION}}
389
+ **Entonces** {{EXPECTED_RESULT}}
390
+
391
+ ### Escenario 3: {{SCENARIO_NAME}}
392
+
393
+ **Dado que** {{PRECONDITION}}
394
+ **Cuando** {{ACTION}}
395
+ **Entonces** {{EXPECTED_RESULT}}
396
+
397
+ **[Generate 3-5 scenarios covering: happy path, error cases, edge cases]**
398
+
399
+ ---
400
+
401
+ ## Tareas TΓ©cnicas
402
+
403
+ > **Source:** Inherited from docs/roadmap.md Feature {{FEATURE_NUMBER}}
404
+
405
+ ### Backend
406
+
407
+ - [ ] **T-{{XXX}}-001:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
408
+ File: {{FILE_PATH}}
409
+ Dependencies: {{DEPENDENCIES}}
410
+
411
+ - [ ] **T-{{XXX}}-002:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
412
+ File: {{FILE_PATH}}
413
+ Dependencies: {{DEPENDENCIES}}
414
+
415
+ ### Frontend (if applicable)
416
+
417
+ - [ ] **T-{{XXX}}-003:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
418
+ File: {{FILE_PATH}}
419
+ Dependencies: {{DEPENDENCIES}}
420
+
421
+ ### Testing
422
+
423
+ - [ ] **T-{{XXX}}-004:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
424
+ File: {{FILE_PATH}}
425
+ Dependencies: {{DEPENDENCIES}}
426
+
427
+ **Total Tasks:** {{N}}
428
+ **Total SP:** {{TOTAL_SP}} Story Points
429
+
430
+ ---
431
+
432
+ ## Casos de Prueba (QA)
433
+
434
+ > **Derived from:** Acceptance Criteria (1 scenario = 1-2 test cases)
435
+
436
+ ### TC-{{XXX}}-001: {{TEST_NAME}} (Happy Path)
437
+
438
+ - **PrecondiciΓ³n:** {{INITIAL_STATE}}
439
+ - **Pasos:**
440
+ 1. {{STEP_1}}
441
+ 2. {{STEP_2}}
442
+ 3. {{STEP_3}}
443
+ - **Resultado Esperado:** {{EXPECTED_OUTCOME}}
444
+ - **Prioridad:** Alta
445
+ - **Tipo:** Funcional | IntegraciΓ³n | E2E
446
+
447
+ ### TC-{{XXX}}-002: {{TEST_NAME}} (Error Case)
448
+
449
+ - **PrecondiciΓ³n:** {{INITIAL_STATE}}
450
+ - **Pasos:**
451
+ 1. {{STEP_1}}
452
+ 2. {{STEP_2}}
453
+ - **Resultado Esperado:** {{ERROR_MESSAGE}}
454
+ - **Prioridad:** Alta
455
+ - **Tipo:** Funcional
456
+
457
+ ### TC-{{XXX}}-003: {{TEST_NAME}} (Edge Case)
458
+
459
+ - **PrecondiciΓ³n:** {{INITIAL_STATE}}
460
+ - **Pasos:**
461
+ 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
+ ---
470
+
471
+ ## EstimaciΓ³n
472
+
473
+ - **Story Points:** {{SP}} SP (from roadmap)
474
+ - **Tiempo Estimado:** {{TIME_RANGE}} (e.g., 6-8h, 1-2d)
475
+ - **Complejidad:** Baja | Media | Alta
476
+
477
+ ---
478
+
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
538
+ ```
539
+
540
+ ---
541
+
542
+ ### Step 10.4: Update Roadmap with Links
543
+
544
+ **After generating User Stories, update docs/roadmap.md to add links:**
545
+
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:**
557
+
558
+ ```markdown
559
+ ### Feature 1.1: Login bΓ‘sico β€’ 5 SP (~6-8h)
560
+
561
+ **User Story:** πŸ“– [HU-001-001](./.ai-flow/user-stories/EP-001/HU-001-001.md)
562
+
563
+ **Status:** βšͺ Not Started
564
+
565
+ **Tasks:**
566
+
567
+ - [ ] T001 Write User entity tests β€’ 1 SP
568
+ - [ ] T002 Create User entity β€’ 1 SP
569
+ ...
570
+ ```
571
+
572
+ ---
573
+
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
626
+
627
+ ---
628
+
629
+ ## ⚠️ Rules & Constraints
630
+
631
+ ### **NEVER:**
632
+
633
+ - ❌ 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
648
+ - βœ… Create backup before regenerating
649
+
650
+ ---
651
+
652
+ ## πŸ“Š Summary Format
653
+
654
+ **After generation, show:**
655
+
656
+ ```
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!
676
+
677
+ Next steps:
678
+ 1. Review User Stories in docs/user-stories/ folder
679
+ 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! πŸŽ‰
684
+ ```
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)