ai-flow-dev 1.2.0 → 1.4.0

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.
@@ -32,7 +32,9 @@ Ask 3-5 key questions to understand requirements:
32
32
  3. **What database entities/models?**
33
33
  4. **Special requirements?** (real-time, authentication, etc.)
34
34
 
35
- **Generate:** `.ai-flow/work/feature-[name]/spec.md`
35
+ **Generate:** `.ai-flow/work/NNN-feature-name/spec.md`
36
+
37
+ **Example:** `.ai-flow/work/003-user-authentication/spec.md`
36
38
 
37
39
  **Example interaction:**
38
40
 
@@ -56,6 +58,35 @@ Special requirements? (real-time, auth, etc.)
56
58
 
57
59
  ### Phase 2: Technical Plan (1 minute - auto-generated)
58
60
 
61
+ #### Step 2.1: Auto-Assign Feature Number
62
+
63
+ **Generate sequential feature number for tracking and organization:**
64
+
65
+ ```
66
+ 🔢 Assigning feature number...
67
+
68
+ Scanning .ai-flow/work/ directory...
69
+ Last feature: 002-notifications
70
+ New feature: 003-[feature-name]
71
+
72
+ Creating: .ai-flow/work/003-[feature-name]/
73
+ ```
74
+
75
+ **Numbering Rules:**
76
+
77
+ - Auto-increment from existing features in `.ai-flow/work/`
78
+ - Format: `NNN-feature-name` (e.g., `001-auth`, `002-notifications`)
79
+ - Slug: Lowercase, hyphens, no special characters
80
+ - If no existing features → Start at `001`
81
+
82
+ **Example transformations:**
83
+
84
+ - "User Authentication" → `003-user-authentication`
85
+ - "Payment Processing" → `004-payment-processing`
86
+ - "Real-Time Notifications" → `005-real-time-notifications`
87
+
88
+ #### Step 2.2: Analyze Project Context
89
+
59
90
  Based on the project's detected stack and existing patterns, auto-generate a technical plan.
60
91
 
61
92
  **Analyze:**
@@ -94,10 +125,68 @@ Estimate complexity using industry-standard Fibonacci Story Points:
94
125
  | **8 SP** | Complex | 2-3 days | Auth flow, complex validation |
95
126
  | **13 SP** | Large | 1 week | Complete module with full tests |
96
127
  | **21 SP** | Very Large | 2 weeks | Major feature with integration |
128
+ | **34 SP** | Epic | 3 weeks | Multiple related features (Epic-level) |
97
129
 
98
130
  > **Note:** Times assume experienced developer with AI assistance.
99
131
  > Without AI: multiply by 2-3x.
100
132
 
133
+ ### Story Points to Time Conversion (Hybrid Estimation)
134
+
135
+ **Use this table to add precise time estimates to each task:**
136
+
137
+ | Story Points | Time Estimate (solo dev) | Time Range | Example Task |
138
+ |--------------|--------------------------|-----------------|---------------------------------------|
139
+ | **1 SP** | 1-2 hours | (~1-2h) | Add enum value, simple config change |
140
+ | **2 SP** | 3-4 hours | (~3-4h) | Write 5-8 unit tests, basic validation|
141
+ | **3 SP** | 4-8 hours | (~4-8h) | Simple CRUD endpoint, basic entity |
142
+ | **5 SP** | 1-2 days | (~1-2d) | Complex endpoint with business logic |
143
+ | **8 SP** | 2-3 days | (~2-3d) | Auth flow, complex validation |
144
+ | **13 SP** | 1 week | (~1w) | Complete module with full test coverage|
145
+ | **21 SP** | 2 weeks | (~2w) | Major feature with integration |
146
+ | **34 SP** | 3 weeks | (~3w) | Multiple related features (Epic-level)|
147
+
148
+ > **Note:** Time assumes AI-assisted development (Copilot/Claude). Without AI, multiply by 2-3x.
149
+ > For team velocity adjustment, track actual time vs estimates after 2-3 features.
150
+
151
+ ### Task Format Reference (Spec-Kit Inspired)
152
+
153
+ **Every task must follow this format:**
154
+
155
+ ```markdown
156
+ - [ ] [TaskID] [Optional:P] Description • SP (~time)
157
+ File: exact/path/to/file.ts
158
+ Dependencies: T001, T002 (or "None")
159
+ ```
160
+
161
+ **Components explained:**
162
+
163
+ - **[TaskID]**: Sequential ID in execution order (T001, T002, ..., T099, T100)
164
+ - **[P] marker**: ONLY for parallelizable tasks (different files, no blocking deps)
165
+ - **Description**: What to implement (specific, LLM-completable without additional context)
166
+ - **• SP (~time)**: Hybrid estimation - Story Points + time (e.g., "2 SP (~3-4h)", "5 SP (~1-2d)")
167
+ - **File path**: Exact file where work happens (REQUIRED)
168
+ - **Dependencies**: Which tasks must complete first (REQUIRED, even if "None")
169
+
170
+ **Task Sequencing Rules:**
171
+
172
+ 1. Tests BEFORE implementation (TDD approach) when applicable
173
+ 2. Models → Services → Controllers → Endpoints
174
+ 3. Core utilities BEFORE features that use them
175
+ 4. Database migrations BEFORE data access code
176
+ 5. Interfaces BEFORE implementations
177
+
178
+ **Parallelization Rules ([P] marker):**
179
+
180
+ ✅ **Use [P] when:**
181
+ - Tasks target different files
182
+ - No shared dependencies
183
+ - Can run simultaneously (e.g., independent entities, different test suites)
184
+
185
+ ❌ **Don't use [P] when:**
186
+ - Task depends on another incomplete task
187
+ - Same file is modified
188
+ - Shared resource (DB migration, config file)
189
+
101
190
  **Phase Structure (for MEDIUM/COMPLEX/LARGE):**
102
191
 
103
192
  Organize tasks into logical phases:
@@ -117,7 +206,9 @@ Organize tasks into logical phases:
117
206
  - Dependencies between phases
118
207
  - Estimated time per phase
119
208
 
120
- **Generate:** `.ai-flow/work/feature-[name]/plan.md`
209
+ **Generate:** `.ai-flow/work/NNN-feature-name/plan.md`
210
+
211
+ **Example:** `.ai-flow/work/003-user-authentication/plan.md`
121
212
 
122
213
  **Example output (SIMPLE):**
123
214
 
@@ -128,7 +219,7 @@ Organize tasks into logical phases:
128
219
 
129
220
  Based on your project (Node.js + Express + PostgreSQL):
130
221
 
131
- **Complexity:** SIMPLE (8 tasks) • 3 SP
222
+ **Complexity:** SIMPLE (8 tasks) • 3 SP (~15-20 min)
132
223
  ⏱️ **Est. Time:** 15-20 minutes
133
224
 
134
225
  **Stack decisions:**
@@ -139,15 +230,42 @@ Based on your project (Node.js + Express + PostgreSQL):
139
230
  - src/controllers/UserController.ts
140
231
  - tests/user.test.ts
141
232
 
142
- **Tasks:**
143
- - [ ] Add email field to User entity (1 SP)
144
- - [ ] Update UserController validation (0.5 SP)
145
- - [ ] Add migration for email column (0.5 SP)
146
- - [ ] Update existing tests (0.5 SP)
147
- - [ ] Add email validation tests (0.5 SP)
148
- - [ ] Update API documentation (trivial)
149
- - [ ] Update data model documentation (trivial)
150
- - [ ] Test endpoint manually (trivial)
233
+ **Tasks:** (execution order with hybrid estimation)
234
+
235
+ - [ ] [T001] Add email field to User entity • 1 SP (~1-2h)
236
+ File: src/entities/User.entity.ts
237
+ Dependencies: None
238
+
239
+ - [ ] [T002] Add migration for email column • 1 SP (~1h)
240
+ File: src/migrations/002_add_email_to_users.ts
241
+ Dependencies: T001 (needs entity schema)
242
+
243
+ - [ ] [T003] [P] Update UserController validation • 1 SP (~1h)
244
+ File: src/controllers/UserController.ts
245
+ Dependencies: T001 (needs entity field)
246
+
247
+ - [ ] [T004] [P] Update existing user tests • 1 SP (~1h)
248
+ File: tests/user.test.ts
249
+ Dependencies: T001 (can run parallel with T003)
250
+
251
+ - [ ] [T005] Add email validation tests • 1 SP (~1-2h)
252
+ File: tests/user.test.ts
253
+ Dependencies: T003 (needs controller validation)
254
+
255
+ - [ ] [T006] [P] Update API documentation • trivial (~15 min)
256
+ File: docs/api.md
257
+ Dependencies: None (can run parallel)
258
+
259
+ - [ ] [T007] [P] Update data model documentation • trivial (~15 min)
260
+ File: docs/data-model.md
261
+ Dependencies: None (can run parallel)
262
+
263
+ - [ ] [T008] Test endpoint manually • trivial (~10 min)
264
+ Dependencies: T005 (needs all code complete)
265
+
266
+ **Parallelization Notes:**
267
+ - T003 and T004 can run in parallel (different concerns)
268
+ - T006 and T007 can run in parallel (different docs)
151
269
 
152
270
  **Total:** 3 SP (~15-20 min with AI assistance)
153
271
 
@@ -163,68 +281,323 @@ Review plan? (Y/n)
163
281
 
164
282
  Based on your project (Node.js + Express + PostgreSQL):
165
283
 
166
- **Complexity:** COMPLEX (52 tasks across 5 phases) • 34 SP
167
- ⏱️ **Est. Time:** 2-3 hours
284
+ **Complexity:** COMPLEX (52 tasks across 5 phases) • 34 SP (~2-3 hours)
285
+ ⏱️ **Est. Time:** 2-3 hours (with AI assistance)
168
286
 
169
287
  **Stack decisions:**
170
288
  - Auth: JWT with jsonwebtoken ⭐
171
289
  - Validation: joi ⚡
172
290
  - Email: nodemailer 📧
173
291
 
174
- ## Phase 1: Data Layer • 8 SP
175
- ⏱️ **Est. Time:** 30-40 min
176
-
177
- - [ ] 1.1 Create User entity (2 SP)
178
- - [ ] 1.2 Create Session entity (1 SP)
179
- - [ ] 1.3 Create RefreshToken entity (1 SP)
180
- - [ ] 1.4 Create migrations (1 SP)
181
- - [ ] 1.5 Create UserRepository (1 SP)
182
- - [ ] 1.6 Create SessionRepository (1 SP)
183
- - [ ] 1.7 Create RefreshTokenRepository (1 SP)
184
- - [ ] ... (4 more tasks)
185
-
186
- ## Phase 2: Business Logic • 13 SP
187
- ⏱️ **Est. Time:** 50-60 min
188
-
189
- - [ ] 2.1 Create AuthService (3 SP)
190
- - [ ] 2.2 Create TokenService (2 SP)
191
- - [ ] 2.3 Create EmailService (2 SP)
192
- - [ ] 2.4 Implement password hashing (1 SP)
193
- - [ ] 2.5 Implement JWT generation (2 SP)
194
- - [ ] 2.6 Implement refresh token rotation (2 SP)
195
- - [ ] 2.7 Email verification flow (1 SP)
196
- - [ ] ... (8 more tasks)
197
-
198
- ## Phase 3: API Layer8 SP
199
- ⏱️ **Est. Time:** 30-40 min
200
-
201
- - [ ] 3.1 Create AuthController (3 SP)
202
- - [ ] 3.2 Create auth middleware (2 SP)
203
- - [ ] 3.3 Create validation schemas (1 SP)
204
- - [ ] 3.4 Create DTOs (1 SP)
205
- - [ ] 3.5 Setup routes (1 SP)
206
- - [ ] ... (7 more tasks)
207
-
208
- ## Phase 4: Integration3 SP
209
- ⏱️ **Est. Time:** 15-20 min
210
-
211
- - [ ] 4.1 Connect services to controllers (1 SP)
212
- - [ ] 4.2 Add error handling middleware (1 SP)
213
- - [ ] 4.3 Configure CORS and security headers (1 SP)
214
- - [ ] ... (5 more tasks)
215
-
216
- ## Phase 5: Testing & Docs 2 SP
217
- ⏱️ **Est. Time:** 10-15 min
218
-
219
- - [ ] 5.1 Unit tests for services (1 SP)
220
- - [ ] 5.2 Integration tests for API (1 SP)
221
- - [ ] 5.3 Update documentation (trivial)
222
- - [ ] ... (4 more tasks)
292
+ ## Phase 1: Data Layer • 8 SP (~30-40 min)
293
+
294
+ **Tasks:** (Test-First approach, execution order)
295
+
296
+ - [ ] [T001] [P] Write unit tests for User entity (8 tests) • 2 SP (~3-4h)
297
+ File: tests/unit/entities/User.entity.spec.ts
298
+ Tests: email format, password hashing, role validation, timestamps
299
+ Dependencies: None (can run parallel with T003, T005)
300
+
301
+ - [ ] [T002] Create User entity with validation • 2 SP (~3-4h)
302
+ File: src/entities/User.entity.ts
303
+ Implements: Email regex, password bcrypt, role enum, timestamps
304
+ Dependencies: None
305
+
306
+ - [ ] [T003] [P] Write unit tests for Session entity (4 tests) • 1 SP (~1-2h)
307
+ File: tests/unit/entities/Session.entity.spec.ts
308
+ Tests: session creation, expiration, invalidation
309
+ Dependencies: None (can run parallel with T001)
310
+
311
+ - [ ] [T004] Create Session entity 1 SP (~1-2h)
312
+ File: src/entities/Session.entity.ts
313
+ Implements: User FK, token, expiration, status
314
+ Dependencies: T002 (needs User entity)
315
+
316
+ - [ ] [T005] [P] Write unit tests for RefreshToken entity (4 tests) 1 SP (~1-2h)
317
+ File: tests/unit/entities/RefreshToken.entity.spec.ts
318
+ Tests: token generation, rotation, revocation
319
+ Dependencies: None (can run parallel with T001, T003)
320
+
321
+ - [ ] [T006] Create RefreshToken entity 1 SP (~1-2h)
322
+ File: src/entities/RefreshToken.entity.ts
323
+ Implements: User FK, token, expiration, rotation tracking
324
+ Dependencies: T002 (needs User entity)
325
+
326
+ - [ ] [T007] Create database migrations 1 SP (~1-2h)
327
+ File: src/migrations/001_create_auth_tables.ts
328
+ Creates: users, sessions, refresh_tokens tables with indexes
329
+ Dependencies: T002, T004, T006 (needs all entity schemas)
330
+
331
+ - [ ] [T008] Create IUserRepository interface 1 SP (~1h)
332
+ File: src/repositories/interfaces/IUserRepository.ts
333
+ Methods: create, findById, findByEmail, update, delete
334
+ Dependencies: T002 (needs User entity type)
335
+
336
+ - [ ] [T009] Implement UserRepository • 1 SP (~1-2h)
337
+ File: src/repositories/UserRepository.ts
338
+ Implements: All CRUD methods from IUserRepository
339
+ Dependencies: T002, T008
340
+
341
+ - [ ] [T010] Create SessionRepository • 1 SP (~1h)
342
+ File: src/repositories/SessionRepository.ts
343
+ Methods: create, findByToken, invalidate, findActiveByUser
344
+ Dependencies: T004 (needs Session entity)
345
+
346
+ - [ ] [T011] Create RefreshTokenRepository • 1 SP (~1h)
347
+ File: src/repositories/RefreshTokenRepository.ts
348
+ Methods: create, findByToken, revoke, rotateToken
349
+ Dependencies: T006 (needs RefreshToken entity)
350
+
351
+ **Task Execution Graph (Phase 1):**
352
+
353
+ ```
354
+ T001 [P] ──┐
355
+ T003 [P] ──┼──> (Tests can run parallel)
356
+ T005 [P] ──┘
357
+
358
+ T002 ──┬──> T004
359
+ ├──> T006
360
+ ├──> T007 (needs T002, T004, T006)
361
+ ├──> T008 ──> T009
362
+
363
+ └──> T010 (needs T004)
364
+ T011 (needs T006)
365
+ ```
366
+
367
+ **Parallelization Notes (Phase 1):**
368
+ - T001, T003, T005 can run in parallel (different test files)
369
+ - T002 is foundational (blocks T004, T006, T008, T009)
370
+ - T010 and T011 can run in parallel after T004/T006 complete
371
+
372
+ ## Phase 2: Business Logic • 13 SP (~50-60 min)
373
+
374
+ **Tasks:**
375
+
376
+ - [ ] [T012] [P] Write unit tests for AuthService (12 tests) • 3 SP (~4-8h)
377
+ File: tests/unit/services/AuthService.spec.ts
378
+ Tests: register, login, logout, refresh, email verification
379
+ Dependencies: None (can run parallel with T014, T016)
380
+
381
+ - [ ] [T013] Create AuthService • 3 SP (~4-8h)
382
+ File: src/services/AuthService.ts
383
+ Implements: register, login, logout, refresh, verify email
384
+ Dependencies: T009, T010, T011 (needs all repositories)
385
+
386
+ - [ ] [T014] [P] Write unit tests for TokenService (8 tests) • 2 SP (~3-4h)
387
+ File: tests/unit/services/TokenService.spec.ts
388
+ Tests: JWT generation, verification, refresh token rotation
389
+ Dependencies: None (can run parallel with T012)
390
+
391
+ - [ ] [T015] Create TokenService • 2 SP (~3-4h)
392
+ File: src/services/TokenService.ts
393
+ Implements: generateAccessToken, generateRefreshToken, verifyToken
394
+ Dependencies: None (utility service)
395
+
396
+ - [ ] [T016] [P] Write unit tests for EmailService (6 tests) • 2 SP (~3-4h)
397
+ File: tests/unit/services/EmailService.spec.ts
398
+ Tests: send verification email, send password reset
399
+ Dependencies: None (can run parallel with T012, T014)
400
+
401
+ - [ ] [T017] Create EmailService • 2 SP (~3-4h)
402
+ File: src/services/EmailService.ts
403
+ Implements: sendVerificationEmail, sendPasswordResetEmail
404
+ Dependencies: None (3rd party wrapper)
405
+
406
+ - [ ] [T018] Implement password hashing utility • 1 SP (~1-2h)
407
+ File: src/utils/password.util.ts
408
+ Implements: hashPassword, comparePassword using bcrypt
409
+ Dependencies: None
410
+
411
+ - [ ] [T019] Implement JWT generation logic • 2 SP (~3-4h)
412
+ File: src/utils/jwt.util.ts
413
+ Implements: sign, verify, decode JWT with RS256
414
+ Dependencies: None
415
+
416
+ - [ ] [T020] Implement refresh token rotation • 2 SP (~3-4h)
417
+ File: src/utils/token-rotation.util.ts
418
+ Implements: rotation detection, security checks
419
+ Dependencies: T015 (needs TokenService)
420
+
421
+ - [ ] [T021] Implement email verification flow • 1 SP (~1-2h)
422
+ File: src/services/EmailVerificationService.ts
423
+ Implements: generate verification token, verify token
424
+ Dependencies: T017 (needs EmailService)
425
+
426
+ **Task Execution Graph (Phase 2):**
427
+
428
+ ```
429
+ T012 [P] ──┐
430
+ T014 [P] ──┼──> (Test suites can run parallel)
431
+ T016 [P] ──┘
432
+
433
+ T009, T010, T011 (from Phase 1) ──> T013 (AuthService)
434
+
435
+ T015 (TokenService) ──> T020 (Token rotation)
436
+ T017 (EmailService) ──> T021 (Email verification)
437
+ T018 (Password utils) ──> T013 (used by AuthService)
438
+ T019 (JWT utils) ──> T013 (used by AuthService)
439
+ ```
440
+
441
+ **Parallelization Notes (Phase 2):**
442
+ - All test tasks (T012, T014, T016) can run in parallel
443
+ - T015, T017, T018, T019 can run in parallel (independent utilities)
444
+ - T013 blocks on T009, T010, T011 from Phase 1
445
+
446
+ ## Phase 3: API Layer • 8 SP (~30-40 min)
447
+
448
+ **Tasks:**
449
+
450
+ - [ ] [T022] [P] Write integration tests for AuthController (10 tests) • 3 SP (~4-8h)
451
+ File: tests/integration/controllers/AuthController.spec.ts
452
+ Tests: POST /register, POST /login, POST /refresh, POST /logout
453
+ Dependencies: None (can run parallel with T024)
454
+
455
+ - [ ] [T023] Create AuthController • 3 SP (~4-8h)
456
+ File: src/controllers/AuthController.ts
457
+ Implements: register, login, refresh, logout, verifyEmail endpoints
458
+ Dependencies: T013 (needs AuthService)
459
+
460
+ - [ ] [T024] [P] Write unit tests for auth middleware (6 tests) • 2 SP (~3-4h)
461
+ File: tests/unit/middleware/auth.middleware.spec.ts
462
+ Tests: JWT verification, token extraction, error handling
463
+ Dependencies: None (can run parallel with T022)
464
+
465
+ - [ ] [T025] Create auth middleware • 2 SP (~3-4h)
466
+ File: src/middleware/auth.middleware.ts
467
+ Implements: requireAuth, optionalAuth, requireRole
468
+ Dependencies: T015 (needs TokenService)
469
+
470
+ - [ ] [T026] Create validation schemas • 1 SP (~1-2h)
471
+ File: src/validators/auth.validators.ts
472
+ Implements: Joi schemas for register, login, refresh payloads
473
+ Dependencies: None
474
+
475
+ - [ ] [T027] Create DTOs • 1 SP (~1-2h)
476
+ File: src/dtos/auth.dto.ts
477
+ Implements: RegisterDTO, LoginDTO, AuthResponseDTO
478
+ Dependencies: None
479
+
480
+ - [ ] [T028] Setup auth routes • 1 SP (~1h)
481
+ File: src/routes/auth.routes.ts
482
+ Implements: Route registration with validation and middleware
483
+ Dependencies: T023, T025, T026 (needs controller, middleware, validators)
484
+
485
+ **Task Execution Graph (Phase 3):**
486
+
487
+ ```
488
+ T022 [P] ──┐
489
+ T024 [P] ──┘──> (Test suites can run parallel)
490
+
491
+ T013 (AuthService) ──> T023 (AuthController)
492
+ T015 (TokenService) ──> T025 (Auth middleware)
493
+
494
+ T026 (Validators) ──┐
495
+ T027 (DTOs) ├──> T028 (Routes)
496
+ T023 (Controller) ┘
497
+ T025 (Middleware) ─┘
498
+ ```
499
+
500
+ ## Phase 4: Integration • 3 SP (~15-20 min)
501
+
502
+ **Tasks:**
503
+
504
+ - [ ] [T029] Connect services to controllers • 1 SP (~1-2h)
505
+ File: src/app.ts
506
+ Implements: Dependency injection setup for controllers
507
+ Dependencies: T023 (needs AuthController)
508
+
509
+ - [ ] [T030] Add global error handling middleware • 1 SP (~1-2h)
510
+ File: src/middleware/error.middleware.ts
511
+ Implements: Catch all errors, format responses, log errors
512
+ Dependencies: None
513
+
514
+ - [ ] [T031] Configure CORS and security headers • 1 SP (~1h)
515
+ File: src/middleware/security.middleware.ts
516
+ Implements: CORS config, Helmet setup, rate limiting
517
+ Dependencies: None
518
+
519
+ - [ ] [T032] Register auth routes in main app • trivial (~30 min)
520
+ File: src/app.ts
521
+ Implements: app.use('/api/auth', authRoutes)
522
+ Dependencies: T028 (needs auth routes)
523
+
524
+ - [ ] [T033] Add environment variable validation • 1 SP (~1h)
525
+ File: src/config/env.validation.ts
526
+ Implements: Validate JWT_SECRET, DATABASE_URL, EMAIL config
527
+ Dependencies: None
528
+
529
+ **Task Execution Graph (Phase 4):**
530
+
531
+ ```
532
+ T030, T031, T033 [P] ──> (Can run parallel - different concerns)
533
+
534
+ T028 ──> T029 ──> T032 (Sequential: routes → DI → registration)
535
+ ```
536
+
537
+ ## Phase 5: Testing & Docs • 2 SP (~10-15 min)
538
+
539
+ **Tasks:**
540
+
541
+ - [ ] [T034] Run full test suite and fix issues • 1 SP (~1-2h)
542
+ File: N/A (command: npm test)
543
+ Validates: All 47 tests passing, coverage ≥ 80%
544
+ Dependencies: T001-T033 (needs all tests written)
545
+
546
+ - [ ] [T035] Integration test for complete auth flow • 1 SP (~1-2h)
547
+ File: tests/integration/auth-flow.spec.ts
548
+ Tests: Full flow from register → login → refresh → logout
549
+ Dependencies: T034 (needs all individual tests passing)
550
+
551
+ - [ ] [T036] [P] Update API documentation • trivial (~20 min)
552
+ File: docs/api.md
553
+ Updates: Add 5 auth endpoints with request/response examples
554
+ Dependencies: None (can run parallel with T037, T038)
555
+
556
+ - [ ] [T037] [P] Update data model documentation • trivial (~15 min)
557
+ File: docs/data-model.md
558
+ Updates: Add User, Session, RefreshToken entities with relationships
559
+ Dependencies: None (can run parallel with T036, T038)
560
+
561
+ - [ ] [T038] [P] Update security documentation • trivial (~15 min)
562
+ File: specs/security.md
563
+ Updates: Document JWT flow, refresh token rotation, password policy
564
+ Dependencies: None (can run parallel with T036, T037)
565
+
566
+ - [ ] [T039] Add environment variables to .env.example • trivial (~10 min)
567
+ File: .env.example
568
+ Updates: Add JWT_SECRET, JWT_EXPIRATION, REFRESH_TOKEN_EXPIRATION
569
+ Dependencies: None
570
+
571
+ **Task Execution Graph (Phase 5):**
572
+
573
+ ```
574
+ T001-T033 ──> T034 (Run all tests) ──> T035 (E2E flow test)
575
+
576
+ T036 [P] ──┐
577
+ T037 [P] ──┼──> (Documentation updates can run parallel)
578
+ T038 [P] ──┘
579
+
580
+ T039 (env example) ──> (Independent, can run anytime)
581
+ ```
582
+
583
+ **Parallelization Notes (Phase 5):**
584
+ - All documentation tasks (T036, T037, T038) can run in parallel
585
+ - T034 must complete before T035 (E2E depends on unit/integration tests)
586
+ - T039 is independent and can run anytime
223
587
 
224
588
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
225
- **Total:** 34 SP • 52 tasks • ~2-3 hours with AI assistance
589
+ **Total:** 34 SP • 39 tasks • ~2-3 hours with AI assistance
226
590
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
227
591
 
592
+ **Parallelization Summary:**
593
+ - ✅ Phase 1: 3 test tasks parallel (T001, T003, T005)
594
+ - ✅ Phase 2: 3 test tasks + 4 utility tasks parallel
595
+ - ✅ Phase 3: 2 test tasks parallel (T022, T024)
596
+ - ✅ Phase 4: 3 tasks parallel (T030, T031, T033)
597
+ - ✅ Phase 5: 3 documentation tasks parallel (T036, T037, T038)
598
+ - ⚡ With 2 devs: ~40% time savings via parallelization
599
+ - ⚡ With 3 devs: ~50% time savings via parallelization
600
+
228
601
  Review plan? (Y/n)
229
602
  ```
230
603
 
@@ -684,7 +1057,9 @@ To resume: /work resume feature-[name]
684
1057
 
685
1058
  ```
686
1059
 
687
- **Generate:** `.ai-flow/work/feature-[name]/tasks.md` (with ✅ checkmarks)
1060
+ **Generate:** `.ai-flow/work/NNN-feature-name/tasks.md` (with ✅ checkmarks)
1061
+
1062
+ **Example:** `.ai-flow/work/003-user-authentication/tasks.md`
688
1063
 
689
1064
  **Implementation rules:**
690
1065
 
@@ -863,22 +1238,26 @@ https://github.com/[user]/[repo]/compare/main...feature/auth-jwt-system
863
1238
  ### During workflow (work directory):
864
1239
 
865
1240
  ```
866
- .ai-flow/work/feature-[name]/
1241
+ .ai-flow/work/NNN-feature-name/
867
1242
  ├── spec.md # What is being built
868
1243
  ├── plan.md # How it will be built
869
1244
  ├── tasks.md # Checklist with ✅
870
1245
  ├── status.json # Metadata (progress, timestamps)
1246
+
1247
+ **Example:** `.ai-flow/work/003-user-authentication/`
871
1248
  └── implementation.md # Optional implementation notes
872
1249
  ```
873
1250
 
874
1251
  ### After completion (archive):
875
1252
 
876
1253
  ```
877
- .ai-flow/archive/YYYY-MM/feature-[name]/
1254
+ .ai-flow/archive/YYYY-MM/NNN-feature-name/
878
1255
  ├── spec.md
879
1256
  ├── plan.md
880
1257
  ├── tasks.md
881
1258
  └── summary.md # Final summary with stats
1259
+
1260
+ **Example:** `.ai-flow/archive/2025-01/003-user-authentication/`
882
1261
  ```
883
1262
 
884
1263
  ---
@@ -1315,4 +1694,4 @@ Next steps:
1315
1694
  ---
1316
1695
 
1317
1696
  **BEGIN EXECUTION when user runs `/feature`, `/feature new`, `/feature change`, or `/feature refactor`**
1318
-
1697
+