ai-flow-dev 2.7.0 → 2.8.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.
Files changed (171) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -570
  3. package/package.json +74 -74
  4. package/prompts/backend/flow-build-phase-0.md +535 -535
  5. package/prompts/backend/flow-build-phase-1.md +626 -626
  6. package/prompts/backend/flow-build-phase-10.md +340 -340
  7. package/prompts/backend/flow-build-phase-2.md +573 -573
  8. package/prompts/backend/flow-build-phase-3.md +834 -834
  9. package/prompts/backend/flow-build-phase-4.md +554 -554
  10. package/prompts/backend/flow-build-phase-5.md +703 -703
  11. package/prompts/backend/flow-build-phase-6.md +524 -524
  12. package/prompts/backend/flow-build-phase-7.md +1001 -1001
  13. package/prompts/backend/flow-build-phase-8.md +1407 -1407
  14. package/prompts/backend/flow-build-phase-9.md +477 -477
  15. package/prompts/backend/flow-build.md +137 -137
  16. package/prompts/backend/flow-check-review.md +656 -20
  17. package/prompts/backend/flow-check-test.md +526 -14
  18. package/prompts/backend/flow-check.md +725 -67
  19. package/prompts/backend/flow-commit.md +88 -119
  20. package/prompts/backend/flow-docs-sync.md +354 -354
  21. package/prompts/backend/flow-finish.md +919 -0
  22. package/prompts/backend/flow-release.md +949 -0
  23. package/prompts/backend/flow-work-feature.md +61 -61
  24. package/prompts/backend/flow-work-fix.md +46 -46
  25. package/prompts/backend/flow-work-refactor.md +48 -48
  26. package/prompts/backend/flow-work-resume.md +34 -34
  27. package/prompts/backend/flow-work.md +1098 -1286
  28. package/prompts/desktop/flow-build-phase-0.md +359 -359
  29. package/prompts/desktop/flow-build-phase-1.md +295 -295
  30. package/prompts/desktop/flow-build-phase-10.md +357 -357
  31. package/prompts/desktop/flow-build-phase-2.md +282 -282
  32. package/prompts/desktop/flow-build-phase-3.md +291 -291
  33. package/prompts/desktop/flow-build-phase-4.md +308 -308
  34. package/prompts/desktop/flow-build-phase-5.md +269 -269
  35. package/prompts/desktop/flow-build-phase-6.md +350 -350
  36. package/prompts/desktop/flow-build-phase-7.md +297 -297
  37. package/prompts/desktop/flow-build-phase-8.md +541 -541
  38. package/prompts/desktop/flow-build-phase-9.md +439 -439
  39. package/prompts/desktop/flow-build.md +156 -156
  40. package/prompts/desktop/flow-check-review.md +656 -20
  41. package/prompts/desktop/flow-check-test.md +526 -14
  42. package/prompts/desktop/flow-check.md +725 -67
  43. package/prompts/desktop/flow-commit.md +88 -119
  44. package/prompts/desktop/flow-docs-sync.md +354 -354
  45. package/prompts/desktop/flow-finish.md +910 -0
  46. package/prompts/desktop/flow-release.md +662 -0
  47. package/prompts/desktop/flow-work-feature.md +61 -61
  48. package/prompts/desktop/flow-work-fix.md +46 -46
  49. package/prompts/desktop/flow-work-refactor.md +48 -48
  50. package/prompts/desktop/flow-work-resume.md +34 -34
  51. package/prompts/desktop/flow-work.md +1202 -1390
  52. package/prompts/frontend/flow-build-phase-0.md +425 -425
  53. package/prompts/frontend/flow-build-phase-1.md +626 -626
  54. package/prompts/frontend/flow-build-phase-10.md +33 -33
  55. package/prompts/frontend/flow-build-phase-2.md +573 -573
  56. package/prompts/frontend/flow-build-phase-3.md +782 -782
  57. package/prompts/frontend/flow-build-phase-4.md +554 -554
  58. package/prompts/frontend/flow-build-phase-5.md +703 -703
  59. package/prompts/frontend/flow-build-phase-6.md +524 -524
  60. package/prompts/frontend/flow-build-phase-7.md +1001 -1001
  61. package/prompts/frontend/flow-build-phase-8.md +872 -872
  62. package/prompts/frontend/flow-build-phase-9.md +94 -94
  63. package/prompts/frontend/flow-build.md +137 -137
  64. package/prompts/frontend/flow-check-review.md +656 -20
  65. package/prompts/frontend/flow-check-test.md +526 -14
  66. package/prompts/frontend/flow-check.md +725 -67
  67. package/prompts/frontend/flow-commit.md +88 -119
  68. package/prompts/frontend/flow-docs-sync.md +550 -550
  69. package/prompts/frontend/flow-finish.md +910 -0
  70. package/prompts/frontend/flow-release.md +519 -0
  71. package/prompts/frontend/flow-work-api.md +1540 -0
  72. package/prompts/frontend/flow-work-feature.md +61 -61
  73. package/prompts/frontend/flow-work-fix.md +38 -38
  74. package/prompts/frontend/flow-work-refactor.md +48 -48
  75. package/prompts/frontend/flow-work-resume.md +34 -34
  76. package/prompts/frontend/flow-work.md +1583 -1320
  77. package/prompts/mobile/flow-build-phase-0.md +425 -425
  78. package/prompts/mobile/flow-build-phase-1.md +626 -626
  79. package/prompts/mobile/flow-build-phase-10.md +32 -32
  80. package/prompts/mobile/flow-build-phase-2.md +573 -573
  81. package/prompts/mobile/flow-build-phase-3.md +782 -782
  82. package/prompts/mobile/flow-build-phase-4.md +554 -554
  83. package/prompts/mobile/flow-build-phase-5.md +703 -703
  84. package/prompts/mobile/flow-build-phase-6.md +524 -524
  85. package/prompts/mobile/flow-build-phase-7.md +1001 -1001
  86. package/prompts/mobile/flow-build-phase-8.md +888 -888
  87. package/prompts/mobile/flow-build-phase-9.md +90 -90
  88. package/prompts/mobile/flow-build.md +135 -135
  89. package/prompts/mobile/flow-check-review.md +656 -20
  90. package/prompts/mobile/flow-check-test.md +526 -14
  91. package/prompts/mobile/flow-check.md +725 -67
  92. package/prompts/mobile/flow-commit.md +88 -119
  93. package/prompts/mobile/flow-docs-sync.md +620 -620
  94. package/prompts/mobile/flow-finish.md +910 -0
  95. package/prompts/mobile/flow-release.md +751 -0
  96. package/prompts/mobile/flow-work-api.md +1493 -0
  97. package/prompts/mobile/flow-work-feature.md +61 -61
  98. package/prompts/mobile/flow-work-fix.md +46 -46
  99. package/prompts/mobile/flow-work-refactor.md +48 -48
  100. package/prompts/mobile/flow-work-resume.md +34 -34
  101. package/prompts/mobile/flow-work.md +1593 -1329
  102. package/prompts/shared/mermaid-guidelines.md +102 -102
  103. package/prompts/shared/scope-levels.md +114 -114
  104. package/prompts/shared/smart-skip-preflight.md +214 -214
  105. package/prompts/shared/story-points.md +55 -55
  106. package/prompts/shared/task-format.md +74 -74
  107. package/prompts/shared/task-summary-template.md +277 -277
  108. package/templates/AGENT.template.md +443 -443
  109. package/templates/backend/.clauderules.template +112 -112
  110. package/templates/backend/.cursorrules.template +102 -102
  111. package/templates/backend/README.template.md +2 -2
  112. package/templates/backend/ai-instructions.template.md +2 -2
  113. package/templates/backend/copilot-instructions.template.md +2 -2
  114. package/templates/backend/docs/api.template.md +320 -320
  115. package/templates/backend/docs/business-flows.template.md +97 -97
  116. package/templates/backend/docs/code-standards.template.md +2 -2
  117. package/templates/backend/docs/contributing.template.md +3 -3
  118. package/templates/backend/docs/data-model.template.md +520 -520
  119. package/templates/backend/docs/testing.template.md +2 -2
  120. package/templates/backend/project-brief.template.md +2 -2
  121. package/templates/backend/specs/configuration.template.md +2 -2
  122. package/templates/backend/specs/security.template.md +2 -2
  123. package/templates/desktop/.clauderules.template +112 -112
  124. package/templates/desktop/.cursorrules.template +102 -102
  125. package/templates/desktop/README.template.md +170 -170
  126. package/templates/desktop/ai-instructions.template.md +366 -366
  127. package/templates/desktop/copilot-instructions.template.md +140 -140
  128. package/templates/desktop/docs/docs/api.template.md +320 -320
  129. package/templates/desktop/docs/docs/architecture.template.md +724 -724
  130. package/templates/desktop/docs/docs/business-flows.template.md +102 -102
  131. package/templates/desktop/docs/docs/code-standards.template.md +792 -792
  132. package/templates/desktop/docs/docs/contributing.template.md +149 -149
  133. package/templates/desktop/docs/docs/data-model.template.md +520 -520
  134. package/templates/desktop/docs/docs/operations.template.md +720 -720
  135. package/templates/desktop/docs/docs/testing.template.md +722 -722
  136. package/templates/desktop/project-brief.template.md +150 -150
  137. package/templates/desktop/specs/specs/configuration.template.md +121 -121
  138. package/templates/desktop/specs/specs/security.template.md +392 -392
  139. package/templates/frontend/README.template.md +2 -2
  140. package/templates/frontend/ai-instructions.template.md +2 -2
  141. package/templates/frontend/docs/api-integration.template.md +362 -362
  142. package/templates/frontend/docs/components.template.md +2 -2
  143. package/templates/frontend/docs/error-handling.template.md +360 -360
  144. package/templates/frontend/docs/operations.template.md +107 -107
  145. package/templates/frontend/docs/performance.template.md +124 -124
  146. package/templates/frontend/docs/pwa.template.md +119 -119
  147. package/templates/frontend/docs/state-management.template.md +2 -2
  148. package/templates/frontend/docs/styling.template.md +2 -2
  149. package/templates/frontend/docs/testing.template.md +2 -2
  150. package/templates/frontend/project-brief.template.md +2 -2
  151. package/templates/frontend/specs/accessibility.template.md +95 -95
  152. package/templates/frontend/specs/configuration.template.md +2 -2
  153. package/templates/frontend/specs/security.template.md +175 -175
  154. package/templates/fullstack/README.template.md +252 -252
  155. package/templates/fullstack/ai-instructions.template.md +444 -444
  156. package/templates/fullstack/project-brief.template.md +157 -157
  157. package/templates/fullstack/specs/configuration.template.md +340 -340
  158. package/templates/mobile/README.template.md +167 -167
  159. package/templates/mobile/ai-instructions.template.md +196 -196
  160. package/templates/mobile/docs/app-store.template.md +135 -135
  161. package/templates/mobile/docs/architecture.template.md +63 -63
  162. package/templates/mobile/docs/native-features.template.md +94 -94
  163. package/templates/mobile/docs/navigation.template.md +59 -59
  164. package/templates/mobile/docs/offline-strategy.template.md +65 -65
  165. package/templates/mobile/docs/permissions.template.md +56 -56
  166. package/templates/mobile/docs/state-management.template.md +85 -85
  167. package/templates/mobile/docs/testing.template.md +109 -109
  168. package/templates/mobile/project-brief.template.md +69 -69
  169. package/templates/mobile/specs/build-configuration.template.md +91 -91
  170. package/templates/mobile/specs/deployment.template.md +92 -92
  171. package/templates/work.template.md +47 -47
@@ -1,703 +1,703 @@
1
- ## PHASE 5: Code Standards (15-20 min)
2
-
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
4
-
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
-
11
- ### Objective
12
-
13
- Establish code quality rules, naming conventions, and development practices.
14
-
15
- ---
16
-
17
- ## 🔍 Pre-Flight Check (Smart Skip Logic)
18
-
19
- > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../../.ai-flow/prompts/shared/smart-skip-preflight.md) for the complete smart skip logic.
20
-
21
- **Execute Pre-Flight Check for Phase 5:**
22
-
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
27
-
28
- **Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
29
-
30
- ---
31
-
32
- ## Phase 5 Questions (Full Mode)
33
-
34
- **5.1 Code Style & Formatting**
35
-
36
- ```
37
- Formatting preferences:
38
-
39
- Indentation:
40
- A) ⭐ 2 spaces - Recommended for JavaScript/TypeScript
41
- B) 4 spaces - Common for Python, Java
42
- C) Tabs
43
-
44
- Quotes:
45
- A) ⭐ Single quotes - 'text' (JavaScript)
46
- B) Double quotes - "text" (Python, Java)
47
-
48
- Line length:
49
- A) ⭐ 80 characters - Traditional
50
- B) 100 characters - Modern balance
51
- C) 120 characters - Wide screens
52
-
53
- Semicolons (JavaScript/TypeScript):
54
- A) ⭐ Required - Always use semicolons
55
- B) Optional - ASI (Automatic Semicolon Insertion)
56
-
57
- Trailing commas:
58
- A) ⭐ Yes - ES5+ compatible, cleaner diffs
59
- B) No
60
-
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
66
-
67
- B) ESLint only - With formatting rules
68
- - Handles both linting and formatting
69
- - More config overhead
70
-
71
- C) Prettier only - Formatting without linting
72
- - Fast, opinionated formatting
73
- - No code quality checks
74
-
75
- D) EditorConfig only - Basic cross-editor consistency
76
-
77
- E) Manual formatting - Not recommended
78
-
79
- Your choice: __
80
- ```
81
-
82
- **5.2 Naming Conventions**
83
-
84
- ```
85
- Naming style by type:
86
-
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
91
-
92
- Classes/Interfaces:
93
- A) ✅ PascalCase - UserService, IUserRepository
94
-
95
- Functions/Methods:
96
- A) ✅ camelCase - getUserById, createOrder
97
-
98
- Variables:
99
- A) ✅ camelCase - userName, totalPrice
100
-
101
- Constants:
102
- A) ✅ UPPER_SNAKE_CASE - MAX_RETRIES, API_BASE_URL
103
-
104
- Interfaces (TypeScript):
105
- A) ⭐ I-prefix - IUserService, IRepository
106
- B) No prefix - UserService, Repository
107
- C) -Interface suffix - UserServiceInterface
108
-
109
- Boolean variables:
110
- A) ✅ is/has/can prefix - isActive, hasPermission, canEdit
111
- ```
112
-
113
- **5.3 File Organization**
114
-
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.
116
-
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
- .ai-flow/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
- ```
289
-
290
- **5.4 Import Organization**
291
-
292
- ```
293
- Import ordering:
294
-
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
301
-
302
- B) Alphabetical
303
- C) No specific order
304
-
305
- Path aliases:
306
- A) ✅ Yes - Use @ for src root
307
- - import { UserService } from '@/services/user.service';
308
-
309
- B) No - Use relative paths only
310
- ```
311
-
312
- **5.5 TypeScript/Type Rules**
313
-
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
- ```
333
-
334
- **5.6 Error Handling**
335
-
336
- ```
337
- Error handling strategy:
338
-
339
- A) ⭐ Try-catch with custom error classes
340
- - Centralized error handler
341
- - HTTP error mapping
342
- - Detailed error messages
343
-
344
- B) Error codes/enums
345
- - Consistent error codes across app
346
-
347
- C) Result pattern
348
- - Never throw, return Result<T, Error>
349
-
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
364
- ```
365
-
366
- **5.7 Comments & Documentation**
367
-
368
- ````
369
- When to comment:
370
-
371
- A) ⭐ Recommended approach:
372
- - Complex business logic
373
- - Non-obvious solutions
374
- - TODOs and FIXMEs
375
- - Public APIs (JSDoc/Docstrings)
376
- - Configuration decisions
377
-
378
- B) Minimal comments - Self-documenting code only
379
- C) Extensive comments - Every function
380
-
381
- Doc comments:
382
- A) ✅ JSDoc for TypeScript/JavaScript
383
- B) ✅ Docstrings for Python
384
- C) ✅ JavaDoc for Java
385
-
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
- ```
399
-
400
- ````
401
-
402
- **5.8 Testing Standards**
403
-
404
- ```
405
-
406
- Test coverage requirements:
407
-
408
- Minimum coverage:
409
- A) 🏆 80%+ - Enterprise standard
410
- B) ⭐ 70%+ - Recommended for most projects
411
- C) 50%+ - Minimum acceptable
412
- D) No requirement
413
-
414
- What to test:
415
-
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
421
-
422
- Test file naming:
423
- A) ⭐ .spec.ts / .test.ts - Next to source file
424
- B) Separate tests/ folder
425
-
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
430
-
431
- ```
432
-
433
- **5.9 Code Complexity Limits**
434
-
435
- ```
436
-
437
- Code quality metrics:
438
-
439
- Function length:
440
- A) ⭐ Max 50 lines per function
441
- B) Max 100 lines
442
- C) No limit
443
-
444
- Cyclomatic complexity:
445
- A) ⭐ Max complexity 10
446
- B) Max complexity 15
447
- C) No limit
448
-
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
458
-
459
- ```
460
-
461
- **5.10 Git Commit Standards**
462
-
463
- ````
464
-
465
- Commit message format:
466
-
467
- A) ⭐ Conventional Commits
468
-
469
- ```
470
-
471
- <type>(<scope>): <subject>
472
-
473
- <body>
474
-
475
- <footer>
476
- ```
477
-
478
- Types: feat, fix, docs, style, refactor, test, chore
479
-
480
- Example:
481
-
482
- ```
483
- feat(auth): add JWT refresh token rotation
484
-
485
- - Implement token rotation on every refresh
486
- - Store refresh tokens in Redis
487
- - Add expiration cleanup job
488
-
489
- Closes #123
490
- ```
491
-
492
- B) Simple descriptive messages
493
- C) No standard
494
-
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
499
-
500
- ````
501
-
502
- **5.11 Versioning & Changelog**
503
-
504
- ```
505
-
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.
532
-
533
- ```
534
-
535
- **5.12 Logging Standards**
536
-
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
- ```
577
-
578
- **5.13 Custom Project Rules**
579
-
580
- ```
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
- ```
611
-
612
- ### Phase 5 Output
613
-
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:**
639
-
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
- ```
647
-
648
- **Generate documents automatically:**
649
-
650
- **1. `docs/code-standards.md`**
651
-
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`
655
-
656
- **2. Update `ai-instructions.md`**
657
-
658
- - Add code style rules to formatting section
659
- - Add complexity limits and testing requirements
660
-
661
- ```
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?
668
-
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.
671
- ```
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
-
684
- ## 📝 Generated Documents
685
-
686
- After Phase 5, generate/update:
687
- - `docs/code-standards.md` - Development practices and quality rules
688
-
689
- ---
690
-
691
- **Next Phase:** Phase 6 - Testing Strategy (15-20 min)
692
-
693
- Read: `.ai-flow/prompts/backend/flow-build-phase-6.md`
694
-
695
- ---
696
-
697
- **Last Updated:** 2025-12-20
698
- **Version:** 2.1.8
699
-
700
- ---
701
-
702
- ## PHASE 6: Testing Strategy (15-20 min)
703
-
1
+ ## PHASE 5: Code Standards (15-20 min)
2
+
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
4
+
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
+
11
+ ### Objective
12
+
13
+ Establish code quality rules, naming conventions, and development practices.
14
+
15
+ ---
16
+
17
+ ## 🔍 Pre-Flight Check (Smart Skip Logic)
18
+
19
+ > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../../.ai-flow/prompts/shared/smart-skip-preflight.md) for the complete smart skip logic.
20
+
21
+ **Execute Pre-Flight Check for Phase 5:**
22
+
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
27
+
28
+ **Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
29
+
30
+ ---
31
+
32
+ ## Phase 5 Questions (Full Mode)
33
+
34
+ **5.1 Code Style & Formatting**
35
+
36
+ ```
37
+ Formatting preferences:
38
+
39
+ Indentation:
40
+ A) ⭐ 2 spaces - Recommended for JavaScript/TypeScript
41
+ B) 4 spaces - Common for Python, Java
42
+ C) Tabs
43
+
44
+ Quotes:
45
+ A) ⭐ Single quotes - 'text' (JavaScript)
46
+ B) Double quotes - "text" (Python, Java)
47
+
48
+ Line length:
49
+ A) ⭐ 80 characters - Traditional
50
+ B) 100 characters - Modern balance
51
+ C) 120 characters - Wide screens
52
+
53
+ Semicolons (JavaScript/TypeScript):
54
+ A) ⭐ Required - Always use semicolons
55
+ B) Optional - ASI (Automatic Semicolon Insertion)
56
+
57
+ Trailing commas:
58
+ A) ⭐ Yes - ES5+ compatible, cleaner diffs
59
+ B) No
60
+
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
66
+
67
+ B) ESLint only - With formatting rules
68
+ - Handles both linting and formatting
69
+ - More config overhead
70
+
71
+ C) Prettier only - Formatting without linting
72
+ - Fast, opinionated formatting
73
+ - No code quality checks
74
+
75
+ D) EditorConfig only - Basic cross-editor consistency
76
+
77
+ E) Manual formatting - Not recommended
78
+
79
+ Your choice: __
80
+ ```
81
+
82
+ **5.2 Naming Conventions**
83
+
84
+ ```
85
+ Naming style by type:
86
+
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
91
+
92
+ Classes/Interfaces:
93
+ A) ✅ PascalCase - UserService, IUserRepository
94
+
95
+ Functions/Methods:
96
+ A) ✅ camelCase - getUserById, createOrder
97
+
98
+ Variables:
99
+ A) ✅ camelCase - userName, totalPrice
100
+
101
+ Constants:
102
+ A) ✅ UPPER_SNAKE_CASE - MAX_RETRIES, API_BASE_URL
103
+
104
+ Interfaces (TypeScript):
105
+ A) ⭐ I-prefix - IUserService, IRepository
106
+ B) No prefix - UserService, Repository
107
+ C) -Interface suffix - UserServiceInterface
108
+
109
+ Boolean variables:
110
+ A) ✅ is/has/can prefix - isActive, hasPermission, canEdit
111
+ ```
112
+
113
+ **5.3 File Organization**
114
+
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.
116
+
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
+ .ai-flow/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
+ ```
289
+
290
+ **5.4 Import Organization**
291
+
292
+ ```
293
+ Import ordering:
294
+
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
301
+
302
+ B) Alphabetical
303
+ C) No specific order
304
+
305
+ Path aliases:
306
+ A) ✅ Yes - Use @ for src root
307
+ - import { UserService } from '@/services/user.service';
308
+
309
+ B) No - Use relative paths only
310
+ ```
311
+
312
+ **5.5 TypeScript/Type Rules**
313
+
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
+ ```
333
+
334
+ **5.6 Error Handling**
335
+
336
+ ```
337
+ Error handling strategy:
338
+
339
+ A) ⭐ Try-catch with custom error classes
340
+ - Centralized error handler
341
+ - HTTP error mapping
342
+ - Detailed error messages
343
+
344
+ B) Error codes/enums
345
+ - Consistent error codes across app
346
+
347
+ C) Result pattern
348
+ - Never throw, return Result<T, Error>
349
+
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
364
+ ```
365
+
366
+ **5.7 Comments & Documentation**
367
+
368
+ ````
369
+ When to comment:
370
+
371
+ A) ⭐ Recommended approach:
372
+ - Complex business logic
373
+ - Non-obvious solutions
374
+ - TODOs and FIXMEs
375
+ - Public APIs (JSDoc/Docstrings)
376
+ - Configuration decisions
377
+
378
+ B) Minimal comments - Self-documenting code only
379
+ C) Extensive comments - Every function
380
+
381
+ Doc comments:
382
+ A) ✅ JSDoc for TypeScript/JavaScript
383
+ B) ✅ Docstrings for Python
384
+ C) ✅ JavaDoc for Java
385
+
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
+ ```
399
+
400
+ ````
401
+
402
+ **5.8 Testing Standards**
403
+
404
+ ```
405
+
406
+ Test coverage requirements:
407
+
408
+ Minimum coverage:
409
+ A) 🏆 80%+ - Enterprise standard
410
+ B) ⭐ 70%+ - Recommended for most projects
411
+ C) 50%+ - Minimum acceptable
412
+ D) No requirement
413
+
414
+ What to test:
415
+
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
421
+
422
+ Test file naming:
423
+ A) ⭐ .spec.ts / .test.ts - Next to source file
424
+ B) Separate tests/ folder
425
+
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
430
+
431
+ ```
432
+
433
+ **5.9 Code Complexity Limits**
434
+
435
+ ```
436
+
437
+ Code quality metrics:
438
+
439
+ Function length:
440
+ A) ⭐ Max 50 lines per function
441
+ B) Max 100 lines
442
+ C) No limit
443
+
444
+ Cyclomatic complexity:
445
+ A) ⭐ Max complexity 10
446
+ B) Max complexity 15
447
+ C) No limit
448
+
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
458
+
459
+ ```
460
+
461
+ **5.10 Git Commit Standards**
462
+
463
+ ````
464
+
465
+ Commit message format:
466
+
467
+ A) ⭐ Conventional Commits
468
+
469
+ ```
470
+
471
+ <type>(<scope>): <subject>
472
+
473
+ <body>
474
+
475
+ <footer>
476
+ ```
477
+
478
+ Types: feat, fix, docs, style, refactor, test, chore
479
+
480
+ Example:
481
+
482
+ ```
483
+ feat(auth): add JWT refresh token rotation
484
+
485
+ - Implement token rotation on every refresh
486
+ - Store refresh tokens in Redis
487
+ - Add expiration cleanup job
488
+
489
+ Closes #123
490
+ ```
491
+
492
+ B) Simple descriptive messages
493
+ C) No standard
494
+
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
499
+
500
+ ````
501
+
502
+ **5.11 Versioning & Changelog**
503
+
504
+ ```
505
+
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.
532
+
533
+ ```
534
+
535
+ **5.12 Logging Standards**
536
+
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
+ ```
577
+
578
+ **5.13 Custom Project Rules**
579
+
580
+ ```
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
+ ```
611
+
612
+ ### Phase 5 Output
613
+
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:**
639
+
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
+ ```
647
+
648
+ **Generate documents automatically:**
649
+
650
+ **1. `docs/code-standards.md`**
651
+
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`
655
+
656
+ **2. Update `ai-instructions.md`**
657
+
658
+ - Add code style rules to formatting section
659
+ - Add complexity limits and testing requirements
660
+
661
+ ```
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?
668
+
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.
671
+ ```
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
+
684
+ ## 📝 Generated Documents
685
+
686
+ After Phase 5, generate/update:
687
+ - `docs/code-standards.md` - Development practices and quality rules
688
+
689
+ ---
690
+
691
+ **Next Phase:** Phase 6 - Testing Strategy (15-20 min)
692
+
693
+ Read: `.ai-flow/prompts/backend/flow-build-phase-6.md`
694
+
695
+ ---
696
+
697
+ **Last Updated:** 2025-12-20
698
+ **Version:** 2.1.8
699
+
700
+ ---
701
+
702
+ ## PHASE 6: Testing Strategy (15-20 min)
703
+