ai-flow-dev 2.2.0 → 2.2.1

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 (68) hide show
  1. package/README.md +13 -17
  2. package/dist/cli.js +8 -2
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +1 -1
  5. package/prompts/backend/flow-build-phase-0.md +286 -4
  6. package/prompts/backend/flow-build-phase-1.md +19 -0
  7. package/prompts/backend/flow-build-phase-2.md +19 -0
  8. package/prompts/backend/flow-build-phase-3.md +19 -0
  9. package/prompts/backend/flow-build-phase-4.md +19 -0
  10. package/prompts/backend/flow-build-phase-5.md +19 -0
  11. package/prompts/backend/flow-build-phase-6.md +19 -0
  12. package/prompts/backend/flow-build-phase-7.md +19 -0
  13. package/prompts/backend/flow-build-phase-9.md +14 -0
  14. package/prompts/backend/flow-check-review.md +20 -0
  15. package/prompts/backend/flow-check-test.md +14 -0
  16. package/prompts/backend/flow-check.md +65 -0
  17. package/prompts/backend/flow-commit.md +51 -0
  18. package/prompts/backend/flow-docs-sync.md +53 -53
  19. package/prompts/backend/flow-work-feature.md +42 -0
  20. package/prompts/backend/flow-work-fix.md +33 -0
  21. package/prompts/backend/flow-work-refactor.md +32 -0
  22. package/prompts/backend/flow-work-resume.md +32 -0
  23. package/prompts/backend/flow-work.md +127 -0
  24. package/prompts/frontend/flow-build-phase-0.md +363 -35
  25. package/prompts/frontend/flow-build-phase-1.md +433 -404
  26. package/prompts/frontend/flow-build-phase-2.md +508 -872
  27. package/prompts/frontend/flow-build-phase-3.md +629 -562
  28. package/prompts/frontend/flow-build-phase-4.md +438 -382
  29. package/prompts/frontend/flow-build-phase-5.md +559 -362
  30. package/prompts/frontend/flow-build-phase-6.md +383 -452
  31. package/prompts/frontend/flow-build-phase-7.md +818 -392
  32. package/prompts/frontend/flow-build-phase-9.md +14 -0
  33. package/prompts/frontend/flow-check-review.md +20 -0
  34. package/prompts/frontend/flow-check-test.md +14 -0
  35. package/prompts/frontend/flow-check.md +65 -0
  36. package/prompts/frontend/flow-commit.md +51 -0
  37. package/prompts/frontend/flow-docs-sync.md +36 -34
  38. package/prompts/frontend/flow-work-feature.md +42 -0
  39. package/prompts/frontend/flow-work-fix.md +33 -0
  40. package/prompts/frontend/flow-work-refactor.md +32 -0
  41. package/prompts/frontend/flow-work-resume.md +32 -0
  42. package/prompts/frontend/flow-work.md +127 -0
  43. package/prompts/mobile/flow-build-phase-0.md +366 -37
  44. package/prompts/mobile/flow-build-phase-1.md +438 -493
  45. package/prompts/mobile/flow-build-phase-2.md +458 -464
  46. package/prompts/mobile/flow-build-phase-3.md +613 -487
  47. package/prompts/mobile/flow-build-phase-4.md +439 -258
  48. package/prompts/mobile/flow-build-phase-5.md +582 -250
  49. package/prompts/mobile/flow-build-phase-6.md +389 -359
  50. package/prompts/mobile/flow-build-phase-7.md +871 -285
  51. package/prompts/mobile/flow-build-phase-9.md +14 -0
  52. package/prompts/mobile/flow-check-review.md +20 -0
  53. package/prompts/mobile/flow-check-test.md +14 -0
  54. package/prompts/mobile/flow-check.md +65 -0
  55. package/prompts/mobile/flow-commit.md +51 -0
  56. package/prompts/mobile/flow-docs-sync.md +37 -40
  57. package/prompts/mobile/flow-work-feature.md +42 -0
  58. package/prompts/mobile/flow-work-fix.md +33 -0
  59. package/prompts/mobile/flow-work-refactor.md +32 -0
  60. package/prompts/mobile/flow-work-resume.md +32 -0
  61. package/prompts/mobile/flow-work.md +127 -0
  62. package/prompts/shared/smart-skip-preflight.md +214 -0
  63. package/prompts/backend/flow-dev-commit.md +0 -829
  64. package/prompts/backend/flow-dev-feature.md +0 -1948
  65. package/prompts/backend/flow-dev-fix.md +0 -952
  66. package/prompts/backend/flow-dev-refactor.md +0 -690
  67. package/prompts/backend/flow-dev-review.md +0 -372
  68. package/prompts/backend/flow-dev-work.md +0 -1081
@@ -1,371 +1,703 @@
1
- # Phase 5: Code Standards & Best Practices
1
+ ## PHASE 5: Code Standards (15-20 min)
2
2
 
3
- **Duration:** 15-20 minutes
4
- **Questions:** ~10 questions
5
- **Output:** docs/code-standards.md, parts of ai-instructions.md
6
- ---
7
- ## 🎯 Objective
3
+ > **Order for this phase:** 5.1 → 5.2 → 5.3 → 5.4 → 5.5 → 5.6 → 5.7 → 5.8 → 5.9 → 5.10 → 5.11 → 5.12 → 5.13
8
4
 
9
- Define coding conventions and standards for your mobile app:
5
+ > **📌 Scope-based behavior:**
6
+ >
7
+ > - **MVP:** Ask 5.1-5.5 only (formatting, naming, structure, coverage target, Git workflow), skip 5.6-5.13 (advanced practices)
8
+ > - **Production-Ready:** Ask all questions 5.1-5.13
9
+ > - **Enterprise:** Ask all questions 5.1-5.13 with emphasis on governance and documentation
10
10
 
11
- 1. File and component naming conventions
12
- 2. Code formatting and linting rules
13
- 3. Import organization
14
- 4. Commit message standards
15
- 5. Mobile-specific best practices
16
- ---
17
- ## 📋 Questions
11
+ ### Objective
18
12
 
19
- ### Question 5.1: File Naming Convention
13
+ Establish code quality rules, naming conventions, and development practices.
20
14
 
21
- **How will you name your files?**
15
+ ---
22
16
 
23
- **If React Native:**
17
+ ## 🔍 Pre-Flight Check (Smart Skip Logic)
24
18
 
25
- - A) **PascalCase for components** (Recommended)
26
- - Components: `UserProfile.tsx`, `Button.tsx`
27
- - Screens: `HomeScreen.tsx`, `ProfileScreen.tsx`
28
- - Hooks: `useAuth.ts`, `useLocalStorage.ts`
29
- - Utils: `formatDate.ts`, `apiClient.ts`
19
+ > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../shared/smart-skip-preflight.md) for the complete smart skip logic.
30
20
 
31
- - B) **kebab-case for all files**
32
- - Components: `user-profile.tsx`, `button.tsx`
21
+ **Execute Pre-Flight Check for Phase 5:**
33
22
 
34
- **If Flutter:**
23
+ - **Target File**: `docs/code-standards.md`
24
+ - **Phase Name**: "CODE STANDARDS"
25
+ - **Key Items**: Linters, formatters, naming conventions, code review process
26
+ - **Typical Gaps**: Team-specific conventions, code review workflow
35
27
 
36
- - A) **snake_case** (Dart convention)
37
- - Files: `user_profile.dart`, `home_screen.dart`
38
- - Classes: `UserProfile`, `HomeScreen`
28
+ **Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
39
29
 
40
- **If Native iOS:**
30
+ ---
41
31
 
42
- - A) **PascalCase** (Swift convention)
43
- - Files: `UserProfile.swift`, `HomeViewController.swift`
32
+ ## Phase 5 Questions (Full Mode)
44
33
 
45
- **If Native Android:**
34
+ **5.1 Code Style & Formatting**
46
35
 
47
- - A) ⭐ **PascalCase for classes, camelCase for files** (Kotlin convention)
48
- - Files: `UserProfile.kt`, `HomeActivity.kt`
49
-
50
- **Your answer:**
51
- ---
52
- ### Question 5.2: Component/Screen Naming Convention
36
+ ```
37
+ Formatting preferences:
53
38
 
54
- **How will you name components and screens?**
39
+ Indentation:
40
+ A) ⭐ 2 spaces - Recommended for JavaScript/TypeScript
41
+ B) 4 spaces - Common for Python, Java
42
+ C) Tabs
55
43
 
56
- **If React Native:**
44
+ Quotes:
45
+ A) ⭐ Single quotes - 'text' (JavaScript)
46
+ B) Double quotes - "text" (Python, Java)
57
47
 
58
- - A) ⭐ **PascalCase** (Recommended)
59
- - Components: `<UserProfile />`, `<Button />`
60
- - Screens: `<HomeScreen />`, `<ProfileScreen />`
48
+ Line length:
49
+ A) 80 characters - Traditional
50
+ B) 100 characters - Modern balance
51
+ C) 120 characters - Wide screens
61
52
 
62
- **If Flutter:**
53
+ Semicolons (JavaScript/TypeScript):
54
+ A) ⭐ Required - Always use semicolons
55
+ B) Optional - ASI (Automatic Semicolon Insertion)
63
56
 
64
- - A) ⭐ **PascalCase for widgets**
65
- - Widgets: `UserProfile`, `HomeScreen`
57
+ Trailing commas:
58
+ A) ⭐ Yes - ES5+ compatible, cleaner diffs
59
+ B) No
66
60
 
67
- **If Native:**
61
+ Formatter & Linter:
62
+ A) ⭐ Prettier + ESLint - Recommended combination
63
+ - Prettier: Auto-format on save (style/formatting)
64
+ - ESLint: Code quality and error detection
65
+ - Use eslint-config-prettier to avoid conflicts
68
66
 
69
- - A) **PascalCase for classes**
70
- - iOS: `UserProfileViewController`
71
- - Android: `UserProfileActivity`
67
+ B) ESLint only - With formatting rules
68
+ - Handles both linting and formatting
69
+ - More config overhead
72
70
 
73
- **Your answer:**
71
+ C) Prettier only - Formatting without linting
72
+ - Fast, opinionated formatting
73
+ - No code quality checks
74
74
 
75
- **Named exports vs default exports?**
75
+ D) EditorConfig only - Basic cross-editor consistency
76
76
 
77
- **If React Native:**
77
+ E) Manual formatting - Not recommended
78
78
 
79
- - A) ⭐ **Named exports** (Recommended)
79
+ Your choice: __
80
+ ```
80
81
 
81
- ```typescript
82
- export const Button = () => { ... }
83
- // Usage: import { Button } from './Button'
84
- ```
82
+ **5.2 Naming Conventions**
85
83
 
86
- - B) **Default exports**
87
- ```typescript
88
- export default function Button() { ... }
89
- ```
84
+ ```
85
+ Naming style by type:
90
86
 
91
- **Your answer:**
92
- ---
93
- ### Question 5.3: Linting & Formatting
87
+ Files:
88
+ A) ⭐ kebab-case - user-service.ts, api-controller.ts
89
+ B) camelCase - userService.ts, apiController.ts
90
+ C) PascalCase - UserService.ts, ApiController.ts
94
91
 
95
- **What linting/formatting tools will you use?**
92
+ Classes/Interfaces:
93
+ A) ✅ PascalCase - UserService, IUserRepository
96
94
 
97
- **If React Native:**
95
+ Functions/Methods:
96
+ A) ✅ camelCase - getUserById, createOrder
98
97
 
99
- - A) ⭐ **ESLint + Prettier** (Recommended)
100
- - ESLint: Code quality rules
101
- - Prettier: Code formatting
98
+ Variables:
99
+ A) camelCase - userName, totalPrice
102
100
 
103
- - B) **Biome** (All-in-one, faster)
101
+ Constants:
102
+ A) ✅ UPPER_SNAKE_CASE - MAX_RETRIES, API_BASE_URL
104
103
 
105
- **If Flutter:**
104
+ Interfaces (TypeScript):
105
+ A) ⭐ I-prefix - IUserService, IRepository
106
+ B) No prefix - UserService, Repository
107
+ C) -Interface suffix - UserServiceInterface
106
108
 
107
- - A) ⭐ **dart format** (Built-in)
108
- - B) **dart analyze** (Linting)
109
+ Boolean variables:
110
+ A) ✅ is/has/can prefix - isActive, hasPermission, canEdit
111
+ ```
109
112
 
110
- **If Native iOS:**
113
+ **5.3 File Organization**
111
114
 
112
- - A) **SwiftLint** (Recommended)
113
- - B) **SwiftFormat**
115
+ > **Note:** The AI will adapt the following examples to match your selected language/framework from Phase 3 (questions 3.1 and 3.2). File extensions, naming conventions, and folder names will be automatically adjusted.
114
116
 
115
- **If Native Android:**
117
+ ```
118
+ Project structure approach:
119
+
120
+ A) ⭐ Feature-based (Modular) - Recommended for most projects
121
+
122
+ Group by feature/module with subfolders for organization:
123
+
124
+ [DYNAMIC EXAMPLE - AI will adapt based on your stack]
125
+
126
+ TypeScript/NestJS example:
127
+ src/
128
+ modules/
129
+ users/
130
+ dto/
131
+ create-user.dto.ts
132
+ update-user.dto.ts
133
+ entities/
134
+ user.entity.ts
135
+ users.controller.ts
136
+ users.service.ts
137
+ users.repository.ts
138
+ users.module.ts
139
+ orders/
140
+ dto/
141
+ entities/
142
+ orders.controller.ts
143
+ common/
144
+ guards/
145
+ interceptors/
146
+ config/
147
+
148
+ Python/FastAPI example:
149
+ src/
150
+ modules/
151
+ users/
152
+ schemas/
153
+ user_create.py
154
+ user_update.py
155
+ models/
156
+ user.py
157
+ users_controller.py
158
+ users_service.py
159
+ users_repository.py
160
+ orders/
161
+ schemas/
162
+ models/
163
+ common/
164
+ dependencies/
165
+ middleware/
166
+
167
+ Java/Spring Boot example:
168
+ src/main/java/com/myapp/
169
+ modules/
170
+ users/
171
+ dto/
172
+ CreateUserDto.java
173
+ UpdateUserDto.java
174
+ domain/
175
+ User.java
176
+ UsersController.java
177
+ UsersService.java
178
+ UsersRepository.java
179
+ orders/
180
+ common/
181
+ config/
182
+ security/
183
+
184
+ Go example:
185
+ src/
186
+ modules/
187
+ users/
188
+ models/
189
+ user.go
190
+ handlers/
191
+ user_handler.go
192
+ services/
193
+ user_service.go
194
+ repositories/
195
+ user_repository.go
196
+ orders/
197
+ common/
198
+ middleware/
199
+
200
+ C#/.NET Core example:
201
+ src/
202
+ Modules/
203
+ Users/
204
+ DTOs/
205
+ CreateUserDto.cs
206
+ UpdateUserDto.cs
207
+ Entities/
208
+ User.cs
209
+ UsersController.cs
210
+ UsersService.cs
211
+ UsersRepository.cs
212
+ Orders/
213
+ DTOs/
214
+ Entities/
215
+ Common/
216
+ Middleware/
217
+ Extensions/
218
+
219
+ Benefits: Scalable, easy to find related code, clear module boundaries
220
+ ---
221
+ B) 🏆 Feature-based (Flat) - Simple projects
222
+
223
+ Flat structure within each feature (AI will adapt naming):
224
+
225
+ src/
226
+ users/
227
+ user_controller
228
+ user_service
229
+ user_repository
230
+ user_dto
231
+ user_entity
232
+ orders/
233
+ order_controller
234
+ order_service
235
+ ...
236
+
237
+ Benefits: Simpler, fewer folders, good for small projects
238
+ ---
239
+ C) Layer-based (Traditional) - Legacy style
240
+
241
+ Group by technical layer/type (AI will adapt naming):
242
+
243
+ src/
244
+ controllers/
245
+ user_controller
246
+ order_controller
247
+ services/
248
+ user_service
249
+ order_service
250
+ repositories/
251
+ user_repository
252
+ order_repository
253
+ entities/
254
+ user_entity
255
+ order_entity
256
+ dto/
257
+ create_user_dto
258
+ create_order_dto
259
+
260
+ Benefits: Clear separation by type, familiar for MVC developers
261
+ Drawbacks: Hard to see feature boundaries, files scattered
262
+ ---
263
+ D) Hybrid - Domain + Shared layers
264
+
265
+ Modules for features + shared technical folders (AI will adapt):
266
+
267
+ src/
268
+ modules/
269
+ users/
270
+ (feature code)
271
+ orders/
272
+ (feature code)
273
+ shared/
274
+ services/
275
+ utils/
276
+ infrastructure/
277
+ database/
278
+ cache/
279
+
280
+ Your choice: __
281
+ Why?
282
+ ---
283
+ After you select, the AI will generate the exact folder structure with proper:
284
+ - File extensions (.ts, .py, .java, .go)
285
+ - Naming conventions (camelCase, snake_case, PascalCase)
286
+ - Framework-specific folders (dto vs schemas, entities vs models vs domain)
287
+ - Common patterns for your chosen stack
288
+ ```
116
289
 
117
- - A) **ktlint** (Recommended)
118
- - B) **Detekt**
290
+ **5.4 Import Organization**
119
291
 
120
- **Your answer:**
292
+ ```
293
+ Import ordering:
121
294
 
122
- **ESLint config (if React Native):**
295
+ A) Recommended order:
296
+ 1. External libraries (react, express, etc.)
297
+ 2. Internal modules (@/services, @/utils)
298
+ 3. Relative imports (./user.dto, ../shared)
299
+ 4. Types/Interfaces
300
+ 5. Styles/Assets
123
301
 
124
- - A) ⭐ **@react-native-community/eslint-config**
125
- - B) **eslint-config-airbnb**
126
- - C) **Custom config**
127
- ---
128
- ### Question 5.4: Import Organization
302
+ B) Alphabetical
303
+ C) No specific order
129
304
 
130
- **How will you organize imports?**
305
+ Path aliases:
306
+ A) ✅ Yes - Use @ for src root
307
+ - import { UserService } from '@/services/user.service';
131
308
 
132
- **If React Native:**
309
+ B) No - Use relative paths only
310
+ ```
133
311
 
134
- ```typescript
135
- // 1. External libraries
136
- import React from 'react';
137
- import { useQuery } from '@tanstack/react-query';
312
+ **5.5 TypeScript/Type Rules**
138
313
 
139
- // 2. Internal modules
140
- import { Button } from '@/components/Button';
141
- import { useAuth } from '@/hooks/useAuth';
314
+ ```
315
+ (Skip if not using TypeScript)
316
+
317
+ A) ✅ Strict mode - Enable all strict checks ⭐
318
+ B) ❌ any allowed - Use any when needed (not recommended)
319
+ C) ⚠️ Gradual typing - Start loose, tighten over time
320
+
321
+ Rules:
322
+ - ✅ No implicit any
323
+ - ✅ Strict null checks
324
+ - ✅ No unused variables
325
+ - ✅ Explicit function return types
326
+ - ✅ Interface over type (when possible)
327
+
328
+ Type preference:
329
+ A) Interfaces for object shapes
330
+ B) Types for unions/intersections
331
+ C) Mix both as needed ⭐
332
+ ```
142
333
 
143
- // 3. Relative imports
144
- import { UserCard } from './UserCard';
334
+ **5.6 Error Handling**
145
335
 
146
- // 4. Types
147
- import type { User } from '@/types';
148
336
  ```
337
+ Error handling strategy:
149
338
 
150
- **If Flutter:**
339
+ A) ⭐ Try-catch with custom error classes
340
+ - Centralized error handler
341
+ - HTTP error mapping
342
+ - Detailed error messages
151
343
 
152
- ```dart
153
- // 1. Dart SDK
154
- import 'dart:async';
344
+ B) Error codes/enums
345
+ - Consistent error codes across app
155
346
 
156
- // 2. External packages
157
- import 'package:flutter/material.dart';
158
- import 'package:provider/provider.dart';
347
+ C) Result pattern
348
+ - Never throw, return Result<T, Error>
159
349
 
160
- // 3. Internal modules
161
- import 'package:myapp/models/user.dart';
162
- import 'package:myapp/services/auth_service.dart';
350
+ Your approach: __
351
+
352
+ Error logging:
353
+ A) ⭐ All errors logged with context
354
+ B) Only server errors (5xx)
355
+ C) Errors + warnings
356
+
357
+ Error responses to client:
358
+ A) ⭐ Detailed in dev, generic in production
359
+ - Dev: Full stack trace
360
+ - Prod: Error code + user-friendly message
361
+
362
+ B) Always detailed
363
+ C) Always generic
163
364
  ```
164
365
 
165
- **Your answer:**
366
+ **5.7 Comments & Documentation**
166
367
 
167
- **Import alias for src/?**
368
+ ````
369
+ When to comment:
168
370
 
169
- - `@/` (React Native)
170
- - `~/` (Alternative)
171
- - No alias (relative paths only)
172
- ---
173
- ### Question 5.5: TypeScript/Dart Strictness
371
+ A) Recommended approach:
372
+ - Complex business logic
373
+ - Non-obvious solutions
374
+ - TODOs and FIXMEs
375
+ - Public APIs (JSDoc/Docstrings)
376
+ - Configuration decisions
174
377
 
175
- **How strict should TypeScript/Dart be?**
378
+ B) Minimal comments - Self-documenting code only
379
+ C) Extensive comments - Every function
176
380
 
177
- **If React Native (TypeScript):**
381
+ Doc comments:
382
+ A) ✅ JSDoc for TypeScript/JavaScript
383
+ B) ✅ Docstrings for Python
384
+ C) ✅ JavaDoc for Java
178
385
 
179
- - A) ⭐ **Strict mode** (Recommended)
386
+ Example:
387
+ ```typescript
388
+ /**
389
+ * Calculates user's total order value for the current month
390
+ * @param userId - The unique user identifier
391
+ * @param includeDiscounts - Whether to apply promotional discounts
392
+ * @returns Total value in cents
393
+ */
394
+ async function calculateMonthlyTotal(
395
+ userId: string,
396
+ includeDiscounts: boolean
397
+ ): Promise<number>;
398
+ ```
180
399
 
181
- ```json
182
- {
183
- "strict": true,
184
- "noUncheckedIndexedAccess": true
185
- }
186
- ```
400
+ ````
187
401
 
188
- - B) **Moderate**
189
- - C) **Lenient**
402
+ **5.8 Testing Standards**
190
403
 
191
- **If Flutter (Dart):**
404
+ ```
192
405
 
193
- - A) ⭐ **Strict analysis** (Recommended)
194
- ```yaml
195
- analyzer:
196
- errors:
197
- invalid_annotation_target: error
198
- ```
406
+ Test coverage requirements:
199
407
 
200
- **Your answer:**
408
+ Minimum coverage:
409
+ A) 🏆 80%+ - Enterprise standard
410
+ B) ⭐ 70%+ - Recommended for most projects
411
+ C) 50%+ - Minimum acceptable
412
+ D) No requirement
201
413
 
202
- **`any` type policy (TypeScript):**
414
+ What to test:
203
415
 
204
- - A) Never allow `any`
205
- - B) ⚠️ Allow with warning
206
- - C) Allow freely (not recommended)
207
- ---
208
- ### Question 5.6: Code Comments
416
+ - Services/Business logic - 80%+ coverage
417
+ - Controllers/Routes - 60%+ coverage
418
+ - ✅ Utilities/Helpers - 90%+ coverage
419
+ - ✅ Database repositories - 70%+ coverage
420
+ - DTOs/Entities - Usually no tests needed
209
421
 
210
- **What's your commenting policy?**
422
+ Test file naming:
423
+ A) ⭐ .spec.ts / .test.ts - Next to source file
424
+ B) Separate tests/ folder
211
425
 
212
- A) ⭐ **JSDoc for public APIs, inline for complex logic** (Recommended)
426
+ Mocking strategy:
427
+ A) ⭐ Mock external dependencies (DB, APIs)
428
+ B) Integration tests with real DB
429
+ C) Mix: Unit tests mock, integration tests don't
213
430
 
214
- ```typescript
215
- /**
216
- * Fetches user data from the API
217
- * @param userId - The user's unique identifier
218
- * @returns User object or null if not found
219
- */
220
- export async function fetchUser(userId: string): Promise<User | null> {
221
- // Check cache first
222
- const cached = cache.get(userId);
223
- if (cached) return cached;
224
- return api.get(`/users/${userId}`);
225
- }
226
431
  ```
227
432
 
228
- B) **JSDoc everywhere**
229
- C) **Minimal comments**
230
- D) **No comment policy**
433
+ **5.9 Code Complexity Limits**
231
434
 
232
- **Your answer:**
233
- ---
234
- ### Question 5.7: Component/Screen Structure
435
+ ```
235
436
 
236
- **How will you structure components and screens?**
437
+ Code quality metrics:
237
438
 
238
- **If React Native:**
439
+ Function length:
440
+ A) ⭐ Max 50 lines per function
441
+ B) Max 100 lines
442
+ C) No limit
239
443
 
240
- ```
241
- screens/
242
- ├── HomeScreen/
243
- │ ├── HomeScreen.tsx
244
- │ ├── HomeScreen.test.tsx
245
- │ ├── HomeScreen.styles.ts
246
- │ └── index.ts
247
- ```
444
+ Cyclomatic complexity:
445
+ A) ⭐ Max complexity 10
446
+ B) Max complexity 15
447
+ C) No limit
248
448
 
249
- **If Flutter:**
449
+ Parameters:
450
+ A) ⭐ Max 4 parameters (use object for more)
451
+ B) Max 6 parameters
452
+ C) No limit
453
+
454
+ Nesting depth:
455
+ A) ⭐ Max 3 levels
456
+ B) Max 4 levels
457
+ C) No limit
250
458
 
251
459
  ```
252
- lib/
253
- ├── screens/
254
- │ ├── home_screen.dart
255
- │ └── home_screen_test.dart
460
+
461
+ **5.10 Git Commit Standards**
462
+
463
+ ````
464
+
465
+ Commit message format:
466
+
467
+ A) ⭐ Conventional Commits
468
+
256
469
  ```
257
470
 
258
- **Your answer:**
259
- ---
260
- ### Question 5.8: Error Handling Patterns
471
+ <type>(<scope>): <subject>
472
+
473
+ <body>
261
474
 
262
- **How will you handle errors?**
475
+ <footer>
476
+ ```
263
477
 
264
- **If React Native:**
478
+ Types: feat, fix, docs, style, refactor, test, chore
265
479
 
266
- - A) ⭐ **Error Boundaries + Try-Catch**
267
- - Error Boundaries for render errors
268
- - Try-Catch for async errors
480
+ Example:
269
481
 
270
- **If Flutter:**
482
+ ```
483
+ feat(auth): add JWT refresh token rotation
271
484
 
272
- - A) **Try-Catch + Global Error Handler**
273
- - FlutterError.onError for global errors
485
+ - Implement token rotation on every refresh
486
+ - Store refresh tokens in Redis
487
+ - Add expiration cleanup job
274
488
 
275
- **If Native:**
489
+ Closes #123
490
+ ```
276
491
 
277
- - A) **Try-Catch + Crash Reporting**
278
- - Sentry, Firebase Crashlytics
492
+ B) Simple descriptive messages
493
+ C) No standard
279
494
 
280
- **Your answer:**
495
+ Branch naming:
496
+ A) ⭐ feature/description, bugfix/description, hotfix/description
497
+ B) Your initials + description (e.g., jd/add-auth)
498
+ C) No standard
281
499
 
282
- **Error logging:**
500
+ ````
283
501
 
284
- - Firebase Crashlytics
285
- - Sentry
286
- - Console only (development)
287
- ---
288
- ### Question 5.9: Mobile-Specific Best Practices
502
+ **5.11 Versioning & Changelog**
289
503
 
290
- **What mobile-specific practices will you enforce?**
504
+ ```
291
505
 
292
- Select all that apply:
506
+ Versioning policy:
507
+
508
+ What versioning scheme will you use?
509
+ A) ⭐ SemVer (Major.Minor.Patch) (recommended)
510
+ B) Date (YYYY.MM.DD)
511
+ C) Other: \_\_
512
+
513
+ Migration strategy:
514
+ How will you handle breaking changes and migrations?
515
+ A) ⭐ Document in the changelog and provide migration scripts (recommended)
516
+ B) Only document changes
517
+ C) Other: \_\_
518
+
519
+ Changelog:
520
+ How will you document and communicate changes?
521
+ A) ⭐ CHANGELOG.md in the repository (recommended)
522
+ B) Releases on GitHub/GitLab
523
+ C) Notes in documentation
524
+ D) Other: \_\_
525
+
526
+ Who will be responsible for updating the changelog?
527
+ A) ⭐ Tech Lead (recommended)
528
+ B) Author of the change (who does the PR)
529
+ C) Documentation team
530
+ D) Other: \_\_
531
+ Example roles: Tech Lead, release manager, PR author, documentation team, etc.
293
532
 
294
- - [ ] **Performance:** Avoid unnecessary re-renders
295
- - [ ] **Memory:** Dispose resources properly (listeners, timers)
296
- - [ ] **Battery:** Optimize background tasks
297
- - [ ] **Network:** Handle offline scenarios gracefully
298
- - [ ] **Permissions:** Request permissions just-in-time
299
- - [ ] **Accessibility:** Support screen readers (TalkBack/VoiceOver)
300
- - [ ] **Platform Differences:** Handle iOS vs Android differences
301
- - [ ] **App State:** Handle app backgrounding/foregrounding
302
- - [ ] **Deep Links:** Support universal links/app links
303
- - [ ] **Push Notifications:** Handle notification taps
533
+ ```
304
534
 
305
- **Your answer:**
306
- ---
307
- ### Question 5.10: Commit Message Convention
535
+ **5.12 Logging Standards**
308
536
 
309
- **What commit message format will you use?**
537
+ ```
538
+ What logging approach will you use?
539
+
540
+ Log format:
541
+ A) ⭐ Structured JSON - Machine-readable, easy to parse (recommended)
542
+ B) Plain text - Human-readable, traditional
543
+ C) Both - Different formats for different environments
544
+
545
+ Log levels:
546
+ - DEBUG: Detailed debugging info (development only)
547
+ - INFO: General information (request start, successful operations)
548
+ - WARN: Warnings (deprecated features, recoverable errors)
549
+ - ERROR: Errors (failed operations, exceptions)
550
+ - FATAL: Critical errors (system failures)
551
+
552
+ Default log level:
553
+ - Development: __
554
+ - Production: __
555
+
556
+ Log context to include:
557
+ A) Request ID (for tracing)
558
+ B) User ID (if authenticated)
559
+ C) IP address
560
+ D) User agent
561
+ E) Request path
562
+ F) Response status
563
+ G) Duration
564
+ H) Error stack traces
565
+
566
+ → Your selection (e.g., A, B, E, F, G): __
567
+
568
+ Log aggregation tool:
569
+ A) ⭐ CloudWatch (AWS)
570
+ B) Datadog
571
+ C) ELK Stack (Elasticsearch, Logstash, Kibana)
572
+ D) Splunk
573
+ E) Other: __
574
+
575
+ Log retention: __ days
576
+ ```
310
577
 
311
- A) **Conventional Commits** (Recommended)
578
+ **5.13 Custom Project Rules**
312
579
 
313
580
  ```
314
- <type>(<scope>): <subject>
581
+ Do you have any project-specific rules for AI assistants?
582
+
583
+ ❌ NEVER Rules (things that should NEVER be done):
584
+
585
+ Examples of NEVER rules:
586
+ - Never use ORM X, always use ORM Y
587
+ - Never modify files in the /legacy folder
588
+ - Never use inline styles in components
589
+ - Never bypass the API gateway
590
+
591
+ Your custom NEVER rules:
592
+ 1. __
593
+ 2. __
594
+ 3. __
595
+ (Leave blank if none)
596
+
597
+ ✅ ALWAYS Rules (things that should ALWAYS be done):
598
+
599
+ Examples of ALWAYS rules:
600
+ - Always use the company's error handling wrapper
601
+ - Always include tenant_id in database queries
602
+ - Always use the shared logging utility
603
+ - Always run security scan before commit
604
+
605
+ Your custom ALWAYS rules:
606
+ 1. __
607
+ 2. __
608
+ 3. __
609
+ (Leave blank if none)
610
+ ```
315
611
 
316
- <body>
612
+ ### Phase 5 Output
317
613
 
318
- <footer>
319
614
  ```
615
+ 📋 PHASE 5 SUMMARY:
616
+
617
+ Formatting: [indentation, quotes, line length, formatter + linter]
618
+ Naming: [files, classes, functions, variables, constants, interfaces style]
619
+ File Organization: [feature-based / layer-based / hybrid + rationale]
620
+ Imports: [ordering strategy, path aliases]
621
+ Type Rules: [strict mode, rules applied, type preferences]
622
+ Error Handling: [strategy, logging approach, client response format]
623
+ Comments: [when to comment, doc style (JSDoc/Docstrings/JavaDoc)]
624
+ Testing: [coverage % target, what to test, file naming, mocking strategy]
625
+ Complexity: [function length, cyclomatic complexity, parameters, nesting depth limits]
626
+ Git: [commit format (conventional/simple), branch naming convention]
627
+ Versioning: [scheme (SemVer/Date), migration strategy, changelog method, responsibility]
628
+ Logging Standards: [format (JSON/text), levels, context, aggregation tool, retention]
629
+ Custom Rules: [NEVER rules count, ALWAYS rules count]
630
+
631
+ Is this correct? (Yes/No)
632
+ ```
633
+
634
+ ---
635
+
636
+ ### 📄 Generate Phase 5 Documents
637
+
638
+ **Before starting generation:**
320
639
 
321
- - Types: feat, fix, docs, style, refactor, test, chore
322
- - Example: `feat(auth): add biometric login`
640
+ ```
641
+ 📖 Loading context from previous phases...
642
+ ✅ Re-reading project-brief.md
643
+ ✅ Re-reading docs/architecture.md
644
+ ✅ Re-reading ai-instructions.md
645
+ ✅ Re-reading specs/security.md
646
+ ```
323
647
 
324
- B) **Simple descriptive**
325
- C) **No convention**
648
+ **Generate documents automatically:**
326
649
 
327
- **Your answer:**
650
+ **1. `docs/code-standards.md`**
328
651
 
329
- **Enforce with:**
652
+ - Use template: `.ai-flow/templates/docs/code-standards.template.md`
653
+ - Fill with all code quality rules, naming conventions, formatting
654
+ - Write to: `docs/code-standards.md`
330
655
 
331
- - commitlint (pre-commit hook)
332
- - Manual review
333
- - No enforcement
334
- ---
335
- ## ✅ Phase 5 Completion
656
+ **2. Update `ai-instructions.md`**
336
657
 
337
- After answering all questions, summarize:
658
+ - Add code style rules to formatting section
659
+ - Add complexity limits and testing requirements
338
660
 
339
661
  ```
340
- ---
341
- Phase 5 Complete: Code Standards
342
- ---
343
- Selected Standards:
344
- - File Naming: PascalCase for components
345
- - Linting: ESLint + Prettier
346
- - TypeScript: Strict mode
347
- - Import Organization: Grouped by type
348
- - Error Handling: Error Boundaries + Try-Catch
349
- - Commit Messages: Conventional Commits
662
+ ✅ Generated: docs/code-standards.md
663
+ Updated: ai-instructions.md (code standards added)
664
+
665
+ Documents have been created with all Phase 5 information.
666
+
667
+ 📝 Would you like to make any corrections before continuing?
350
668
 
351
- Proceed to Phase 6 (Testing Strategy)? (Y/n)
669
+ If yes: Edit the files and type "ready" when done. I'll re-read them.
670
+ → If no: Type "continue" to proceed to Phase 6.
352
671
  ```
353
- ---
672
+
673
+ **If user edits files:**
674
+ Re-read files to refresh context before continuing.
675
+
676
+ ---
677
+
678
+ **Proceed to Phase 6 only after documents are validated.**
679
+
680
+ > ⚠️ **CRITICAL:** DO NOT generate README.md in this phase. README.md is ONLY generated in Phase 8 (step 8.5) after framework initialization.
681
+
682
+ ---
683
+
354
684
  ## 📝 Generated Documents
355
685
 
356
686
  After Phase 5, generate/update:
687
+ - `docs/code-standards.md` - Development practices and quality rules
688
+
689
+ ---
357
690
 
358
- - `docs/code-standards.md` - Code standards and conventions
359
- - `ai-instructions.md` - Add code standards rules
360
- ---
361
- **Next Phase:** Phase 6 - Testing Strategy
691
+ **Next Phase:** Phase 6 - Testing Strategy (15-20 min)
362
692
 
363
- Read: `.ai-flow/prompts/mobile/flow-build-phase-6-testing.md`
364
- ---
365
- **Last Updated:** 2025-01-XX
693
+ Read: `.ai-flow/prompts/backend/flow-build-phase-6.md`
366
694
 
367
- **Version:** 1.4.0
695
+ ---
368
696
 
697
+ **Last Updated:** 2025-12-20
698
+ **Version:** 2.1.8
369
699
 
700
+ ---
370
701
 
702
+ ## PHASE 6: Testing Strategy (15-20 min)
371
703