ai-flow-dev 2.1.1 β†’ 2.1.2

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,707 @@
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 (`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
+ exit();
75
+ }
76
+ ```
77
+
78
+ **Display mode:**
79
+
80
+ ```
81
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
82
+ πŸ“– Phase 10: User Stories Generation
83
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
84
+
85
+ Mode: [ALL | EPIC: EP-001 | STORY: HU-001-001]
86
+ ```
87
+
88
+ **Load required documentation:**
89
+
90
+ ```
91
+ Loading project context...
92
+
93
+ βœ… roadmap.md (5 Epics, 18 Features, 89 SP)
94
+ βœ… project-brief.md (business context)
95
+ βœ… ai-instructions.md (tech stack, patterns)
96
+ βœ… docs/data-model.md (entities, relationships)
97
+ βœ… docs/architecture.md (system design)
98
+ βœ… docs/api.md (endpoints)
99
+ βœ… specs/security.md (auth, validation)
100
+ βœ… docs/testing.md (test strategy)
101
+ ```
102
+
103
+ **If roadmap.md NOT found:**
104
+
105
+ ```
106
+ ❌ Error: roadmap.md not found
107
+
108
+ Phase 10 requires roadmap.md from Phase 9.
109
+
110
+ Options:
111
+ 1. βœ… Generate roadmap first: /flow-build fase 9
112
+ 2. ⏭️ Exit and run Phase 9 manually
113
+
114
+ Your choice (1): _
115
+ ```
116
+
117
+ ---
118
+
119
+ ### Step 10.2: Execute Based on Mode
120
+
121
+ ---
122
+
123
+ #### **Mode 1: ALL (No parameters)**
124
+
125
+ **Show scope selection:**
126
+
127
+ ```
128
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
129
+ πŸ“‹ Scope Selection
130
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
131
+
132
+ Found 5 Epics with 18 Features in roadmap.md
133
+
134
+ Total Story Points: 89 SP (~4-5 weeks for 1 dev)
135
+
136
+ Generate User Stories for:
137
+
138
+ A) βœ… All Epics (18 User Stories) - Complete backlog
139
+ Epics: EP-001, EP-002, EP-003, EP-004, EP-005
140
+ Time: ~40-50 minutes
141
+
142
+ B) πŸ“‹ Sprint 1 Epics only (Priority P0/P1) - Quick start
143
+ Epics: EP-001 (5 stories), EP-002 (3 stories)
144
+ Total: 8 User Stories
145
+ Time: ~15-20 minutes
146
+
147
+ C) 🎯 Specific Epics (select which ones)
148
+ Choose from: EP-001, EP-002, EP-003, EP-004, EP-005
149
+
150
+ D) ⏭️ Cancel (run specific Epic later)
151
+ Example: /flow-build fase 10 EP-001
152
+
153
+ Your choice (B): _
154
+ ```
155
+
156
+ **If choice B (Sprint 1):**
157
+
158
+ ```
159
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
160
+ πŸ“– Generating Sprint 1 User Stories
161
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
162
+
163
+ Selected Epics:
164
+ - EP-001: AutenticaciΓ³n (5 stories, 13 SP)
165
+ - EP-002: GestiΓ³n Usuarios (3 stories, 21 SP)
166
+
167
+ Total: 8 User Stories, 34 SP
168
+
169
+ Generating...
170
+
171
+ [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] EP-001 (5/5) βœ…
172
+ βœ… HU-001-001.md - Login bΓ‘sico (5 SP)
173
+ βœ… HU-001-002.md - Login OAuth (3 SP)
174
+ βœ… HU-001-003.md - RecuperaciΓ³n contraseΓ±a (3 SP)
175
+ βœ… HU-001-004.md - Refresh tokens (1 SP)
176
+ βœ… HU-001-005.md - Logout (1 SP)
177
+
178
+ [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] EP-002 (3/3) βœ…
179
+ βœ… HU-002-001.md - CRUD usuarios (8 SP)
180
+ βœ… HU-002-002.md - Perfiles y roles (8 SP)
181
+ βœ… HU-002-003.md - Admin dashboard (5 SP)
182
+
183
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
184
+ βœ… Sprint 1 User Stories Generated
185
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
186
+
187
+ Created:
188
+ πŸ“ user-stories/
189
+ β”œβ”€β”€ EP-001/
190
+ β”‚ β”œβ”€β”€ HU-001-001.md βœ…
191
+ β”‚ β”œβ”€β”€ HU-001-002.md βœ…
192
+ β”‚ β”œβ”€β”€ HU-001-003.md βœ…
193
+ β”‚ β”œβ”€β”€ HU-001-004.md βœ…
194
+ β”‚ └── HU-001-005.md βœ…
195
+ └── EP-002/
196
+ β”œβ”€β”€ HU-002-001.md βœ…
197
+ β”œβ”€β”€ HU-002-002.md βœ…
198
+ └── HU-002-003.md βœ…
199
+
200
+ Total: 8 User Stories (34 SP)
201
+
202
+ πŸš€ Ready to start Sprint 1!
203
+
204
+ Next steps:
205
+ 1. Review User Stories in user-stories/ folder
206
+ 2. Start implementing: /flow-dev-feature HU-001-001
207
+ 3. Generate more Epics later: /flow-build fase 10 EP-003
208
+ ```
209
+
210
+ ---
211
+
212
+ #### **Mode 2: EPIC (e.g., /flow-build fase 10 EP-001)**
213
+
214
+ ```
215
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
216
+ πŸ“– Generating User Stories for EP-001
217
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
218
+
219
+ Loading Epic from roadmap.md...
220
+
221
+ Epic: EP-001 - AutenticaciΓ³n y Seguridad
222
+ Priority: P0 (Critical)
223
+ Story Points: 13 SP
224
+ Features: 5
225
+
226
+ Features in this Epic:
227
+ 1. Feature 1.1: Login bΓ‘sico (5 SP)
228
+ 2. Feature 1.2: Login OAuth (3 SP)
229
+ 3. Feature 1.3: RecuperaciΓ³n contraseΓ±a (3 SP)
230
+ 4. Feature 1.4: Refresh tokens (1 SP)
231
+ 5. Feature 1.5: Logout (1 SP)
232
+
233
+ User Stories to generate: 5
234
+
235
+ Generating...
236
+
237
+ [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] (5/5) βœ…
238
+
239
+ βœ… HU-001-001.md created (Login bΓ‘sico)
240
+ βœ… HU-001-002.md created (Login OAuth)
241
+ βœ… HU-001-003.md created (RecuperaciΓ³n contraseΓ±a)
242
+ βœ… HU-001-004.md created (Refresh tokens)
243
+ βœ… HU-001-005.md created (Logout)
244
+
245
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
246
+ βœ… EP-001 User Stories Generated
247
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
248
+
249
+ Location: user-stories/EP-001/
250
+
251
+ Files created:
252
+ - HU-001-001.md (5 SP, 6 tasks, 8 test cases)
253
+ - HU-001-002.md (3 SP, 4 tasks, 5 test cases)
254
+ - HU-001-003.md (3 SP, 5 tasks, 6 test cases)
255
+ - HU-001-004.md (1 SP, 2 tasks, 3 test cases)
256
+ - HU-001-005.md (1 SP, 2 tasks, 2 test cases)
257
+
258
+ Total: 5 User Stories, 13 SP, 19 tasks, 24 test cases
259
+
260
+ Next: Start implementing with /flow-dev-feature HU-001-001
261
+ ```
262
+
263
+ ---
264
+
265
+ #### **Mode 3: STORY (e.g., /flow-build fase 10 HU-001-001)**
266
+
267
+ ```
268
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
269
+ πŸ“– Generating User Story: HU-001-001
270
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
271
+
272
+ Checking if file exists...
273
+
274
+ ⚠️ user-stories/EP-001/HU-001-001.md already exists
275
+
276
+ File size: 4.2 KB
277
+ Last modified: 2025-12-10 15:30
278
+
279
+ Options:
280
+ 1. πŸ”„ Regenerate (overwrite completely)
281
+ 2. πŸ“ Update (merge new content, preserve manual edits)
282
+ 3. πŸ‘€ View current (show existing content)
283
+ 4. ❌ Cancel
284
+
285
+ Your choice (2): _
286
+
287
+ [If user chooses 1: Regenerate]
288
+
289
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
290
+ πŸ”„ Regenerating HU-001-001
291
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
292
+
293
+ ⚠️ WARNING: This will overwrite all manual changes!
294
+
295
+ Backup current file? (Y/n): Y
296
+
297
+ βœ… Backup created: user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
298
+
299
+ Loading context from roadmap.md...
300
+ - Epic: EP-001 AutenticaciΓ³n
301
+ - Feature: 1.1 Login bΓ‘sico (5 SP)
302
+ - Priority: P0
303
+
304
+ Generating User Story...
305
+
306
+ βœ… HU-001-001.md regenerated successfully!
307
+
308
+ Changes:
309
+ + Added 2 new acceptance criteria (password strength, rate limiting)
310
+ + Updated 3 test cases (added edge cases)
311
+ + Refreshed Definition of Done
312
+ ~ No changes to technical tasks
313
+
314
+ Location: user-stories/EP-001/HU-001-001.md
315
+ Backup: user-stories/EP-001/.backup/HU-001-001.2025-12-12.md
316
+
317
+ [If file doesn't exist - New User Story]
318
+
319
+ βœ… File doesn't exist, creating new User Story...
320
+
321
+ Context from roadmap:
322
+ - Epic: EP-001 AutenticaciΓ³n
323
+ - Feature: 1.1 Login bΓ‘sico (5 SP)
324
+ - Priority: P0 (Critical)
325
+ - Tasks: 6 (from roadmap.md)
326
+
327
+ Generating User Story with:
328
+ βœ… User Story format (Como/Quiero/Para)
329
+ βœ… Acceptance Criteria (Gherkin Given/When/Then)
330
+ βœ… Technical Tasks (Backend/Frontend/Testing)
331
+ βœ… QA Test Cases (derived from criteria)
332
+ βœ… Estimation (Story Points + Time)
333
+ βœ… Dependencies
334
+ βœ… Definition of Done
335
+
336
+ βœ… HU-001-001.md created successfully!
337
+
338
+ Location: user-stories/EP-001/HU-001-001.md
339
+ Size: 4.2 KB
340
+ Tasks: 6
341
+ Test Cases: 8
342
+ Story Points: 5 SP (~6-8h)
343
+
344
+ Next: Implement with /flow-dev-feature HU-001-001
345
+ ```
346
+
347
+ ---
348
+
349
+ ### Step 10.3: Generate User Story Document
350
+
351
+ **For each User Story, generate complete `.md` file with this structure:**
352
+
353
+ ```markdown
354
+ # πŸ“– Historia de Usuario: HU-{{XXX}}-{{YYY}} - {{TÍTULO}}
355
+
356
+ ## Epic
357
+
358
+ EP-{{XXX}}: {{EPIC_NAME}}
359
+
360
+ ## Historia de Usuario
361
+
362
+ **ID:** HU-{{XXX}}-{{YYY}}
363
+ **TΓ­tulo:** {{FEATURE_NAME}}
364
+ **Prioridad:** {{PRIORITY}} (Alta | Media | Baja)
365
+ **Sprint:** {{SPRINT_NUMBER}} o "Backlog"
366
+ **Story Points:** {{SP}} SP
367
+ **EstimaciΓ³n:** {{TIME_ESTIMATE}}
368
+
369
+ **Como:** {{USER_TYPE}}
370
+ **Quiero:** {{DESIRED_FUNCTIONALITY}}
371
+ **Para:** {{USER_BENEFIT}}
372
+
373
+ ---
374
+
375
+ ## Criterios de AceptaciΓ³n
376
+
377
+ ### Escenario 1: {{SCENARIO_NAME}}
378
+
379
+ **Dado que** {{PRECONDITION}}
380
+ **Cuando** {{ACTION}}
381
+ **Entonces** {{EXPECTED_RESULT}}
382
+
383
+ ### Escenario 2: {{SCENARIO_NAME}}
384
+
385
+ **Dado que** {{PRECONDITION}}
386
+ **Cuando** {{ACTION}}
387
+ **Entonces** {{EXPECTED_RESULT}}
388
+
389
+ ### Escenario 3: {{SCENARIO_NAME}}
390
+
391
+ **Dado que** {{PRECONDITION}}
392
+ **Cuando** {{ACTION}}
393
+ **Entonces** {{EXPECTED_RESULT}}
394
+
395
+ **[Generate 3-5 scenarios covering: happy path, error cases, edge cases]**
396
+
397
+ ---
398
+
399
+ ## Tareas TΓ©cnicas
400
+
401
+ > **Source:** Inherited from roadmap.md Feature {{FEATURE_NUMBER}}
402
+
403
+ ### Backend
404
+
405
+ - [ ] **T-{{XXX}}-001:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
406
+ File: {{FILE_PATH}}
407
+ Dependencies: {{DEPENDENCIES}}
408
+
409
+ - [ ] **T-{{XXX}}-002:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
410
+ File: {{FILE_PATH}}
411
+ Dependencies: {{DEPENDENCIES}}
412
+
413
+ ### Frontend (if applicable)
414
+
415
+ - [ ] **T-{{XXX}}-003:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
416
+ File: {{FILE_PATH}}
417
+ Dependencies: {{DEPENDENCIES}}
418
+
419
+ ### Testing
420
+
421
+ - [ ] **T-{{XXX}}-004:** {{TASK_DESCRIPTION}} β€’ {{SP}} SP (~{{TIME}})
422
+ File: {{FILE_PATH}}
423
+ Dependencies: {{DEPENDENCIES}}
424
+
425
+ **Total Tasks:** {{N}}
426
+ **Total SP:** {{TOTAL_SP}} Story Points
427
+
428
+ ---
429
+
430
+ ## Casos de Prueba (QA)
431
+
432
+ > **Derived from:** Acceptance Criteria (1 scenario = 1-2 test cases)
433
+
434
+ ### TC-{{XXX}}-001: {{TEST_NAME}} (Happy Path)
435
+
436
+ - **PrecondiciΓ³n:** {{INITIAL_STATE}}
437
+ - **Pasos:**
438
+ 1. {{STEP_1}}
439
+ 2. {{STEP_2}}
440
+ 3. {{STEP_3}}
441
+ - **Resultado Esperado:** {{EXPECTED_OUTCOME}}
442
+ - **Prioridad:** Alta
443
+ - **Tipo:** Funcional | IntegraciΓ³n | E2E
444
+
445
+ ### TC-{{XXX}}-002: {{TEST_NAME}} (Error Case)
446
+
447
+ - **PrecondiciΓ³n:** {{INITIAL_STATE}}
448
+ - **Pasos:**
449
+ 1. {{STEP_1}}
450
+ 2. {{STEP_2}}
451
+ - **Resultado Esperado:** {{ERROR_MESSAGE}}
452
+ - **Prioridad:** Alta
453
+ - **Tipo:** Funcional
454
+
455
+ ### TC-{{XXX}}-003: {{TEST_NAME}} (Edge Case)
456
+
457
+ - **PrecondiciΓ³n:** {{INITIAL_STATE}}
458
+ - **Pasos:**
459
+ 1. {{STEP_1}}
460
+ 2. {{STEP_2}}
461
+ - **Resultado Esperado:** {{EXPECTED_BEHAVIOR}}
462
+ - **Prioridad:** Media
463
+ - **Tipo:** LΓ­mites | ValidaciΓ³n
464
+
465
+ **[Generate 1-2 test cases per acceptance scenario = 3-10 total]**
466
+
467
+ ---
468
+
469
+ ## EstimaciΓ³n
470
+
471
+ - **Story Points:** {{SP}} SP (from roadmap)
472
+ - **Tiempo Estimado:** {{TIME_RANGE}} (e.g., 6-8h, 1-2d)
473
+ - **Complejidad:** Baja | Media | Alta
474
+
475
+ ---
476
+
477
+ ## Dependencias
478
+
479
+ - **Requiere:** {{REQUIRED_STORIES}} (e.g., HU-001-001 completed)
480
+ - **Bloquea:** {{BLOCKED_STORIES}} (e.g., HU-002-003 cannot start)
481
+ - **Relacionado con:** {{RELATED_STORIES}}
482
+
483
+ ---
484
+
485
+ ## DefiniciΓ³n de Done (DoD)
486
+
487
+ - [ ] CΓ³digo implementado siguiendo ai-instructions.md
488
+ - [ ] Code review aprobado (mΓ­n 1 revisor)
489
+ - [ ] Tests unitarios escritos (cobertura > 80%)
490
+ - [ ] Tests de integraciΓ³n pasando
491
+ - [ ] Casos de prueba QA ejecutados y aprobados ({{N}}/{{N}})
492
+ - [ ] DocumentaciΓ³n tΓ©cnica actualizada (docs/api.md, etc.)
493
+ - [ ] Sin errores de lint ni formateo
494
+ - [ ] Deploy a staging exitoso
495
+ - [ ] Product Owner aprobΓ³ la funcionalidad
496
+
497
+ ---
498
+
499
+ ## Notas TΓ©cnicas
500
+
501
+ > **Context from:**
502
+ >
503
+ > - ai-instructions.md ({{FRAMEWORK}} patterns)
504
+ > - docs/architecture.md ({{ARCHITECTURE_PATTERN}})
505
+ > - specs/security.md (authentication, validation)
506
+
507
+ ### Consideraciones de ImplementaciΓ³n:
508
+
509
+ - {{TECHNICAL_NOTE_1}}
510
+ - {{TECHNICAL_NOTE_2}}
511
+ - {{ARCHITECTURE_DECISION}}
512
+
513
+ ### APIs/Servicios Involucrados:
514
+
515
+ - **Endpoint:** `{{HTTP_METHOD}} {{ENDPOINT_PATH}}`
516
+ - **Servicio externo:** {{EXTERNAL_SERVICE}} (if any)
517
+
518
+ ### Seguridad/Performance:
519
+
520
+ - {{SECURITY_CONSIDERATION}}
521
+ - {{PERFORMANCE_OPTIMIZATION}}
522
+
523
+ ---
524
+
525
+ ## DiseΓ±o/Prototipo
526
+
527
+ 🎨 **Diseño:** {{DESIGN_LINK}} (if provided by user)
528
+
529
+ ---
530
+
531
+ ## Historial
532
+
533
+ - **Creada:** {{DATE}} (Phase 10)
534
+ - **Actualizada:** {{DATE}} (if regenerated)
535
+ - **Estado:** Draft | Ready | In Progress | Done
536
+ ```
537
+
538
+ ---
539
+
540
+ ### Step 10.4: Update Roadmap with Links
541
+
542
+ **After generating User Stories, update roadmap.md to add links:**
543
+
544
+ ```
545
+ Updating roadmap.md with User Story links...
546
+
547
+ βœ… Updated Feature 1.1 with link to HU-001-001
548
+ βœ… Updated Feature 1.2 with link to HU-001-002
549
+ βœ… Updated Feature 1.3 with link to HU-001-003
550
+
551
+ roadmap.md updated successfully!
552
+ ```
553
+
554
+ **Updated roadmap.md format:**
555
+
556
+ ```markdown
557
+ ### Feature 1.1: Login bΓ‘sico β€’ 5 SP (~6-8h)
558
+
559
+ **User Story:** πŸ“– [HU-001-001](./user-stories/EP-001/HU-001-001.md)
560
+
561
+ **Status:** βšͺ Not Started
562
+
563
+ **Tasks:**
564
+
565
+ - [ ] T001 Write User entity tests β€’ 1 SP
566
+ - [ ] T002 Create User entity β€’ 1 SP
567
+ ...
568
+ ```
569
+
570
+ ---
571
+
572
+ ## 🎯 Generation Rules
573
+
574
+ ### **1. User Story Format**
575
+
576
+ - **Como:** Extract from project-brief.md (target users)
577
+ - **Quiero:** From Feature name in roadmap
578
+ - **Para:** From Feature scope/benefits
579
+
580
+ ### **2. Acceptance Criteria**
581
+
582
+ - **Minimum 3 scenarios:** Happy path + Error case + Edge case
583
+ - **Gherkin format:** Dado/Cuando/Entonces (Given/When/Then)
584
+ - **Testable:** Each scenario = executable test
585
+ - **Based on:** API docs, business flows, security specs
586
+
587
+ ### **3. Technical Tasks**
588
+
589
+ - **Inherit from roadmap:** Use Tasks from roadmap.md Feature
590
+ - **Add file paths:** Exact location where code goes
591
+ - **Add dependencies:** Which tasks block others
592
+ - **Keep Story Points:** From roadmap estimation
593
+
594
+ ### **4. Test Cases**
595
+
596
+ - **Derive from criteria:** 1-2 test cases per acceptance scenario
597
+ - **Types:** Funcional, IntegraciΓ³n, E2E, LΓ­mites
598
+ - **Priority:** Alta for happy/error paths, Media for edge cases
599
+ - **Format:** PrecondiciΓ³n β†’ Pasos β†’ Resultado esperado
600
+
601
+ ### **5. Definition of Done**
602
+
603
+ **Standard checklist (same for all stories):**
604
+
605
+ - Code implemented
606
+ - Code review passed
607
+ - Tests written (unit + integration)
608
+ - Tests passing
609
+ - QA test cases executed
610
+ - Documentation updated
611
+ - Lint/format clean
612
+ - Staging deploy successful
613
+ - PO approval
614
+
615
+ ### **6. Technical Notes**
616
+
617
+ **Pull from documentation:**
618
+
619
+ - `ai-instructions.md` β†’ Framework patterns, code conventions
620
+ - `docs/architecture.md` β†’ Architecture pattern (Hexagonal, Clean, etc.)
621
+ - `docs/data-model.md` β†’ Entity schemas, relationships
622
+ - `specs/security.md` β†’ Auth requirements, validations
623
+ - `docs/api.md` β†’ Endpoint details
624
+
625
+ ---
626
+
627
+ ## ⚠️ Rules & Constraints
628
+
629
+ ### **NEVER:**
630
+
631
+ - ❌ Create User Story without roadmap context
632
+ - ❌ Duplicate tasks from roadmap (reference, don't copy)
633
+ - ❌ Skip acceptance criteria
634
+ - ❌ Generate test cases without criteria
635
+ - ❌ Use generic DoD (personalize per story if needed)
636
+ - ❌ Forget to update roadmap.md with links
637
+
638
+ ### **ALWAYS:**
639
+
640
+ - βœ… Inherit Story Points from roadmap
641
+ - βœ… Generate 3-5 acceptance scenarios (Gherkin)
642
+ - βœ… Derive 1-2 test cases per scenario
643
+ - βœ… Link back to Epic and Feature
644
+ - βœ… Include technical context from docs
645
+ - βœ… Update roadmap.md with User Story links
646
+ - βœ… Create backup before regenerating
647
+
648
+ ---
649
+
650
+ ## πŸ“Š Summary Format
651
+
652
+ **After generation, show:**
653
+
654
+ ```
655
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
656
+ βœ… PHASE 10 COMPLETE: USER STORIES GENERATED
657
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
658
+
659
+ Generated: {{N}} User Stories
660
+ Total Story Points: {{SP}} SP
661
+ Total Tasks: {{TASKS}}
662
+ Total Test Cases: {{TC}}
663
+
664
+ Files created:
665
+ πŸ“ user-stories/
666
+ β”œβ”€β”€ EP-001/ (5 stories, 13 SP)
667
+ β”œβ”€β”€ EP-002/ (3 stories, 21 SP)
668
+ └── EP-003/ (4 stories, 18 SP)
669
+
670
+ Updated:
671
+ βœ… roadmap.md (added User Story links)
672
+
673
+ πŸš€ Ready to start development!
674
+
675
+ Next steps:
676
+ 1. Review User Stories in user-stories/ folder
677
+ 2. Start implementing: /flow-dev-feature HU-001-001
678
+ 3. Track progress: /flow-dev-work
679
+ 4. Generate more stories: /flow-build fase 10 EP-004
680
+
681
+ Happy coding! πŸŽ‰
682
+ ```
683
+
684
+ ---
685
+
686
+ ## πŸ”— Integration with Phase 9
687
+
688
+ **Phase 9 provides:**
689
+
690
+ - Epics structure
691
+ - Features with Story Points
692
+ - Technical tasks breakdown
693
+ - Dependencies
694
+
695
+ **Phase 10 adds:**
696
+
697
+ - User Story format (Como/Quiero/Para)
698
+ - Acceptance criteria (Gherkin)
699
+ - Test cases (derived from criteria)
700
+ - Definition of Done
701
+ - Technical context from all docs
702
+
703
+ **Together they form:** Complete backlog ready for execution
704
+
705
+ ---
706
+
707
+ **EXECUTION:** Execute workflow based on detected mode (ALL | EPIC | STORY)