ai-flow-dev 1.0.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.
- package/LICENSE +21 -0
- package/README.md +408 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +791 -0
- package/dist/cli.js.map +1 -0
- package/dist/fs-utils.d.ts +2 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/fs-utils.js +46 -0
- package/dist/fs-utils.js.map +1 -0
- package/package.json +71 -0
- package/prompts/backend/flow-dev-feature.md +1318 -0
- package/prompts/backend/flow-dev-fix.md +903 -0
- package/prompts/backend/flow-dev-refactor.md +715 -0
- package/prompts/backend/flow-dev-review.md +401 -0
- package/prompts/backend/flow-dev-work.md +1129 -0
- package/prompts/backend/flow-docs-gen-phase-0.md +1840 -0
- package/prompts/backend/flow-docs-gen-phase-1.md +435 -0
- package/prompts/backend/flow-docs-gen-phase-2.md +460 -0
- package/prompts/backend/flow-docs-gen-phase-3.md +684 -0
- package/prompts/backend/flow-docs-gen-phase-4.md +516 -0
- package/prompts/backend/flow-docs-gen-phase-5.md +637 -0
- package/prompts/backend/flow-docs-gen-phase-6.md +465 -0
- package/prompts/backend/flow-docs-gen-phase-7.md +1207 -0
- package/prompts/backend/flow-docs-gen.md +820 -0
- package/prompts/backend/flow-docs-sync.md +526 -0
- package/prompts/backend/flow-project-init.md +248 -0
- package/prompts/backend/flow-project-roadmap.md +1159 -0
- package/prompts/frontend/flow-docs-gen-phase-0.md +494 -0
- package/prompts/frontend/flow-docs-gen-phase-1.md +449 -0
- package/prompts/frontend/flow-docs-gen-phase-2.md +983 -0
- package/prompts/frontend/flow-docs-gen-phase-3.md +685 -0
- package/prompts/frontend/flow-docs-gen-phase-4.md +480 -0
- package/prompts/frontend/flow-docs-gen-phase-5.md +483 -0
- package/prompts/frontend/flow-docs-gen-phase-6.md +570 -0
- package/prompts/frontend/flow-docs-gen-phase-7.md +582 -0
- package/prompts/frontend/flow-docs-gen.md +413 -0
- package/prompts/frontend/flow-docs-sync.md +561 -0
- package/prompts/mobile/flow-docs-gen-phase-0.md +387 -0
- package/prompts/mobile/flow-docs-gen-phase-1.md +530 -0
- package/prompts/mobile/flow-docs-gen-phase-2.md +584 -0
- package/prompts/mobile/flow-docs-gen-phase-3.md +659 -0
- package/prompts/mobile/flow-docs-gen-phase-4.md +363 -0
- package/prompts/mobile/flow-docs-gen-phase-5.md +369 -0
- package/prompts/mobile/flow-docs-gen-phase-6.md +490 -0
- package/prompts/mobile/flow-docs-gen-phase-7.md +407 -0
- package/prompts/mobile/flow-docs-gen.md +430 -0
- package/prompts/mobile/flow-docs-sync.md +634 -0
- package/templates/backend/.clauderules.template +111 -0
- package/templates/backend/.cursorrules.template +102 -0
- package/templates/backend/.env.example.template +122 -0
- package/templates/backend/README.template.md +200 -0
- package/templates/backend/ai-instructions.template.md +354 -0
- package/templates/backend/copilot-instructions.template.md +160 -0
- package/templates/backend/docs/api.template.md +251 -0
- package/templates/backend/docs/architecture.template.md +612 -0
- package/templates/backend/docs/business-flows.template.md +109 -0
- package/templates/backend/docs/code-standards.template.md +828 -0
- package/templates/backend/docs/contributing.template.md +163 -0
- package/templates/backend/docs/data-model.template.md +416 -0
- package/templates/backend/docs/operations.template.md +591 -0
- package/templates/backend/docs/testing.template.md +762 -0
- package/templates/backend/project-brief.template.md +176 -0
- package/templates/backend/specs/configuration.template.md +133 -0
- package/templates/backend/specs/security.template.md +422 -0
- package/templates/frontend/README.template.md +121 -0
- package/templates/frontend/ai-instructions.template.md +368 -0
- package/templates/frontend/docs/api-integration.template.md +390 -0
- package/templates/frontend/docs/components.template.md +567 -0
- package/templates/frontend/docs/error-handling.template.md +385 -0
- package/templates/frontend/docs/operations.template.md +123 -0
- package/templates/frontend/docs/performance.template.md +140 -0
- package/templates/frontend/docs/pwa.template.md +135 -0
- package/templates/frontend/docs/state-management.template.md +394 -0
- package/templates/frontend/docs/styling.template.md +779 -0
- package/templates/frontend/docs/testing.template.md +736 -0
- package/templates/frontend/project-brief.template.md +55 -0
- package/templates/frontend/specs/accessibility.template.md +111 -0
- package/templates/frontend/specs/configuration.template.md +520 -0
- package/templates/frontend/specs/security.template.md +197 -0
- package/templates/fullstack/README.template.md +282 -0
- package/templates/fullstack/ai-instructions.template.md +487 -0
- package/templates/fullstack/project-brief.template.md +197 -0
- package/templates/fullstack/specs/configuration.template.md +380 -0
- package/templates/mobile/AGENT.template.md +251 -0
- package/templates/mobile/README.template.md +195 -0
- package/templates/mobile/ai-instructions.template.md +221 -0
- package/templates/mobile/docs/app-store.template.md +163 -0
- package/templates/mobile/docs/architecture.template.md +100 -0
- package/templates/mobile/docs/native-features.template.md +137 -0
- package/templates/mobile/docs/navigation.template.md +81 -0
- package/templates/mobile/docs/offline-strategy.template.md +90 -0
- package/templates/mobile/docs/permissions.template.md +70 -0
- package/templates/mobile/docs/state-management.template.md +116 -0
- package/templates/mobile/docs/testing.template.md +146 -0
- package/templates/mobile/project-brief.template.md +97 -0
- package/templates/mobile/specs/build-configuration.template.md +116 -0
- package/templates/mobile/specs/deployment.template.md +114 -0
- package/templates/shared/AGENT.template.md +252 -0
|
@@ -0,0 +1,637 @@
|
|
|
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
|
|
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.11 (advanced practices)
|
|
8
|
+
> - **Production-Ready:** Ask all questions 5.1-5.11
|
|
9
|
+
> - **Enterprise:** Ask all questions 5.1-5.11 with emphasis on governance and documentation
|
|
10
|
+
|
|
11
|
+
### Objective
|
|
12
|
+
|
|
13
|
+
Establish code quality rules, naming conventions, and development practices.
|
|
14
|
+
|
|
15
|
+
**5.1 Code Style & Formatting**
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Formatting preferences:
|
|
19
|
+
|
|
20
|
+
Indentation:
|
|
21
|
+
A) ⭐ 2 spaces - Recommended for JavaScript/TypeScript
|
|
22
|
+
B) 4 spaces - Common for Python, Java
|
|
23
|
+
C) Tabs
|
|
24
|
+
|
|
25
|
+
Quotes:
|
|
26
|
+
A) ⭐ Single quotes - 'text' (JavaScript)
|
|
27
|
+
B) Double quotes - "text" (Python, Java)
|
|
28
|
+
|
|
29
|
+
Line length:
|
|
30
|
+
A) ⭐ 80 characters - Traditional
|
|
31
|
+
B) 100 characters - Modern balance
|
|
32
|
+
C) 120 characters - Wide screens
|
|
33
|
+
|
|
34
|
+
Semicolons (JavaScript/TypeScript):
|
|
35
|
+
A) ⭐ Required - Always use semicolons
|
|
36
|
+
B) Optional - ASI (Automatic Semicolon Insertion)
|
|
37
|
+
|
|
38
|
+
Trailing commas:
|
|
39
|
+
A) ⭐ Yes - ES5+ compatible, cleaner diffs
|
|
40
|
+
B) No
|
|
41
|
+
|
|
42
|
+
Formatter & Linter:
|
|
43
|
+
A) ⭐ Prettier + ESLint - Recommended combination
|
|
44
|
+
- Prettier: Auto-format on save (style/formatting)
|
|
45
|
+
- ESLint: Code quality and error detection
|
|
46
|
+
- Use eslint-config-prettier to avoid conflicts
|
|
47
|
+
|
|
48
|
+
B) ESLint only - With formatting rules
|
|
49
|
+
- Handles both linting and formatting
|
|
50
|
+
- More config overhead
|
|
51
|
+
|
|
52
|
+
C) Prettier only - Formatting without linting
|
|
53
|
+
- Fast, opinionated formatting
|
|
54
|
+
- No code quality checks
|
|
55
|
+
|
|
56
|
+
D) EditorConfig only - Basic cross-editor consistency
|
|
57
|
+
|
|
58
|
+
E) Manual formatting - Not recommended
|
|
59
|
+
|
|
60
|
+
Your choice: __
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**5.2 Naming Conventions**
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Naming style by type:
|
|
67
|
+
|
|
68
|
+
Files:
|
|
69
|
+
A) ⭐ kebab-case - user-service.ts, api-controller.ts
|
|
70
|
+
B) camelCase - userService.ts, apiController.ts
|
|
71
|
+
C) PascalCase - UserService.ts, ApiController.ts
|
|
72
|
+
|
|
73
|
+
Classes/Interfaces:
|
|
74
|
+
A) ✅ PascalCase - UserService, IUserRepository
|
|
75
|
+
|
|
76
|
+
Functions/Methods:
|
|
77
|
+
A) ✅ camelCase - getUserById, createOrder
|
|
78
|
+
|
|
79
|
+
Variables:
|
|
80
|
+
A) ✅ camelCase - userName, totalPrice
|
|
81
|
+
|
|
82
|
+
Constants:
|
|
83
|
+
A) ✅ UPPER_SNAKE_CASE - MAX_RETRIES, API_BASE_URL
|
|
84
|
+
|
|
85
|
+
Interfaces (TypeScript):
|
|
86
|
+
A) ⭐ I-prefix - IUserService, IRepository
|
|
87
|
+
B) No prefix - UserService, Repository
|
|
88
|
+
C) -Interface suffix - UserServiceInterface
|
|
89
|
+
|
|
90
|
+
Boolean variables:
|
|
91
|
+
A) ✅ is/has/can prefix - isActive, hasPermission, canEdit
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**5.3 File Organization**
|
|
95
|
+
|
|
96
|
+
> **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.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Project structure approach:
|
|
100
|
+
|
|
101
|
+
A) ⭐ Feature-based (Modular) - Recommended for most projects
|
|
102
|
+
|
|
103
|
+
Group by feature/module with subfolders for organization:
|
|
104
|
+
|
|
105
|
+
[DYNAMIC EXAMPLE - AI will adapt based on your stack]
|
|
106
|
+
|
|
107
|
+
TypeScript/NestJS example:
|
|
108
|
+
src/
|
|
109
|
+
modules/
|
|
110
|
+
users/
|
|
111
|
+
dto/
|
|
112
|
+
create-user.dto.ts
|
|
113
|
+
update-user.dto.ts
|
|
114
|
+
entities/
|
|
115
|
+
user.entity.ts
|
|
116
|
+
users.controller.ts
|
|
117
|
+
users.service.ts
|
|
118
|
+
users.repository.ts
|
|
119
|
+
users.module.ts
|
|
120
|
+
orders/
|
|
121
|
+
dto/
|
|
122
|
+
entities/
|
|
123
|
+
orders.controller.ts
|
|
124
|
+
common/
|
|
125
|
+
guards/
|
|
126
|
+
interceptors/
|
|
127
|
+
config/
|
|
128
|
+
|
|
129
|
+
Python/FastAPI example:
|
|
130
|
+
src/
|
|
131
|
+
modules/
|
|
132
|
+
users/
|
|
133
|
+
schemas/
|
|
134
|
+
user_create.py
|
|
135
|
+
user_update.py
|
|
136
|
+
models/
|
|
137
|
+
user.py
|
|
138
|
+
users_controller.py
|
|
139
|
+
users_service.py
|
|
140
|
+
users_repository.py
|
|
141
|
+
orders/
|
|
142
|
+
schemas/
|
|
143
|
+
models/
|
|
144
|
+
common/
|
|
145
|
+
dependencies/
|
|
146
|
+
middleware/
|
|
147
|
+
|
|
148
|
+
Java/Spring Boot example:
|
|
149
|
+
src/main/java/com/myapp/
|
|
150
|
+
modules/
|
|
151
|
+
users/
|
|
152
|
+
dto/
|
|
153
|
+
CreateUserDto.java
|
|
154
|
+
UpdateUserDto.java
|
|
155
|
+
domain/
|
|
156
|
+
User.java
|
|
157
|
+
UsersController.java
|
|
158
|
+
UsersService.java
|
|
159
|
+
UsersRepository.java
|
|
160
|
+
orders/
|
|
161
|
+
common/
|
|
162
|
+
config/
|
|
163
|
+
security/
|
|
164
|
+
|
|
165
|
+
Go example:
|
|
166
|
+
src/
|
|
167
|
+
modules/
|
|
168
|
+
users/
|
|
169
|
+
models/
|
|
170
|
+
user.go
|
|
171
|
+
handlers/
|
|
172
|
+
user_handler.go
|
|
173
|
+
services/
|
|
174
|
+
user_service.go
|
|
175
|
+
repositories/
|
|
176
|
+
user_repository.go
|
|
177
|
+
orders/
|
|
178
|
+
common/
|
|
179
|
+
middleware/
|
|
180
|
+
|
|
181
|
+
C#/.NET Core example:
|
|
182
|
+
src/
|
|
183
|
+
Modules/
|
|
184
|
+
Users/
|
|
185
|
+
DTOs/
|
|
186
|
+
CreateUserDto.cs
|
|
187
|
+
UpdateUserDto.cs
|
|
188
|
+
Entities/
|
|
189
|
+
User.cs
|
|
190
|
+
UsersController.cs
|
|
191
|
+
UsersService.cs
|
|
192
|
+
UsersRepository.cs
|
|
193
|
+
Orders/
|
|
194
|
+
DTOs/
|
|
195
|
+
Entities/
|
|
196
|
+
Common/
|
|
197
|
+
Middleware/
|
|
198
|
+
Extensions/
|
|
199
|
+
|
|
200
|
+
Benefits: Scalable, easy to find related code, clear module boundaries
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
B) 🏆 Feature-based (Flat) - Simple projects
|
|
205
|
+
|
|
206
|
+
Flat structure within each feature (AI will adapt naming):
|
|
207
|
+
|
|
208
|
+
src/
|
|
209
|
+
users/
|
|
210
|
+
user_controller
|
|
211
|
+
user_service
|
|
212
|
+
user_repository
|
|
213
|
+
user_dto
|
|
214
|
+
user_entity
|
|
215
|
+
orders/
|
|
216
|
+
order_controller
|
|
217
|
+
order_service
|
|
218
|
+
...
|
|
219
|
+
|
|
220
|
+
Benefits: Simpler, fewer folders, good for small projects
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
C) Layer-based (Traditional) - Legacy style
|
|
225
|
+
|
|
226
|
+
Group by technical layer/type (AI will adapt naming):
|
|
227
|
+
|
|
228
|
+
src/
|
|
229
|
+
controllers/
|
|
230
|
+
user_controller
|
|
231
|
+
order_controller
|
|
232
|
+
services/
|
|
233
|
+
user_service
|
|
234
|
+
order_service
|
|
235
|
+
repositories/
|
|
236
|
+
user_repository
|
|
237
|
+
order_repository
|
|
238
|
+
entities/
|
|
239
|
+
user_entity
|
|
240
|
+
order_entity
|
|
241
|
+
dto/
|
|
242
|
+
create_user_dto
|
|
243
|
+
create_order_dto
|
|
244
|
+
|
|
245
|
+
Benefits: Clear separation by type, familiar for MVC developers
|
|
246
|
+
Drawbacks: Hard to see feature boundaries, files scattered
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
D) Hybrid - Domain + Shared layers
|
|
251
|
+
|
|
252
|
+
Modules for features + shared technical folders (AI will adapt):
|
|
253
|
+
|
|
254
|
+
src/
|
|
255
|
+
modules/
|
|
256
|
+
users/
|
|
257
|
+
(feature code)
|
|
258
|
+
orders/
|
|
259
|
+
(feature code)
|
|
260
|
+
shared/
|
|
261
|
+
services/
|
|
262
|
+
utils/
|
|
263
|
+
infrastructure/
|
|
264
|
+
database/
|
|
265
|
+
cache/
|
|
266
|
+
|
|
267
|
+
Your choice: __
|
|
268
|
+
Why?
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
After you select, the AI will generate the exact folder structure with proper:
|
|
273
|
+
- File extensions (.ts, .py, .java, .go)
|
|
274
|
+
- Naming conventions (camelCase, snake_case, PascalCase)
|
|
275
|
+
- Framework-specific folders (dto vs schemas, entities vs models vs domain)
|
|
276
|
+
- Common patterns for your chosen stack
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**5.4 Import Organization**
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
Import ordering:
|
|
283
|
+
|
|
284
|
+
A) ⭐ Recommended order:
|
|
285
|
+
1. External libraries (react, express, etc.)
|
|
286
|
+
2. Internal modules (@/services, @/utils)
|
|
287
|
+
3. Relative imports (./user.dto, ../shared)
|
|
288
|
+
4. Types/Interfaces
|
|
289
|
+
5. Styles/Assets
|
|
290
|
+
|
|
291
|
+
B) Alphabetical
|
|
292
|
+
C) No specific order
|
|
293
|
+
|
|
294
|
+
Path aliases:
|
|
295
|
+
A) ✅ Yes - Use @ for src root
|
|
296
|
+
- import { UserService } from '@/services/user.service';
|
|
297
|
+
|
|
298
|
+
B) No - Use relative paths only
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**5.5 TypeScript/Type Rules**
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
(Skip if not using TypeScript)
|
|
305
|
+
|
|
306
|
+
A) ✅ Strict mode - Enable all strict checks ⭐
|
|
307
|
+
B) ❌ any allowed - Use any when needed (not recommended)
|
|
308
|
+
C) ⚠️ Gradual typing - Start loose, tighten over time
|
|
309
|
+
|
|
310
|
+
Rules:
|
|
311
|
+
- ✅ No implicit any
|
|
312
|
+
- ✅ Strict null checks
|
|
313
|
+
- ✅ No unused variables
|
|
314
|
+
- ✅ Explicit function return types
|
|
315
|
+
- ✅ Interface over type (when possible)
|
|
316
|
+
|
|
317
|
+
Type preference:
|
|
318
|
+
A) Interfaces for object shapes
|
|
319
|
+
B) Types for unions/intersections
|
|
320
|
+
C) Mix both as needed ⭐
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**5.6 Error Handling**
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
Error handling strategy:
|
|
327
|
+
|
|
328
|
+
A) ⭐ Try-catch with custom error classes
|
|
329
|
+
- Centralized error handler
|
|
330
|
+
- HTTP error mapping
|
|
331
|
+
- Detailed error messages
|
|
332
|
+
|
|
333
|
+
B) Error codes/enums
|
|
334
|
+
- Consistent error codes across app
|
|
335
|
+
|
|
336
|
+
C) Result pattern
|
|
337
|
+
- Never throw, return Result<T, Error>
|
|
338
|
+
|
|
339
|
+
Your approach: __
|
|
340
|
+
|
|
341
|
+
Error logging:
|
|
342
|
+
A) ⭐ All errors logged with context
|
|
343
|
+
B) Only server errors (5xx)
|
|
344
|
+
C) Errors + warnings
|
|
345
|
+
|
|
346
|
+
Error responses to client:
|
|
347
|
+
A) ⭐ Detailed in dev, generic in production
|
|
348
|
+
- Dev: Full stack trace
|
|
349
|
+
- Prod: Error code + user-friendly message
|
|
350
|
+
|
|
351
|
+
B) Always detailed
|
|
352
|
+
C) Always generic
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**5.7 Comments & Documentation**
|
|
356
|
+
|
|
357
|
+
````
|
|
358
|
+
When to comment:
|
|
359
|
+
|
|
360
|
+
A) ⭐ Recommended approach:
|
|
361
|
+
- Complex business logic
|
|
362
|
+
- Non-obvious solutions
|
|
363
|
+
- TODOs and FIXMEs
|
|
364
|
+
- Public APIs (JSDoc/Docstrings)
|
|
365
|
+
- Configuration decisions
|
|
366
|
+
|
|
367
|
+
B) Minimal comments - Self-documenting code only
|
|
368
|
+
C) Extensive comments - Every function
|
|
369
|
+
|
|
370
|
+
Doc comments:
|
|
371
|
+
A) ✅ JSDoc for TypeScript/JavaScript
|
|
372
|
+
B) ✅ Docstrings for Python
|
|
373
|
+
C) ✅ JavaDoc for Java
|
|
374
|
+
|
|
375
|
+
Example:
|
|
376
|
+
```typescript
|
|
377
|
+
/**
|
|
378
|
+
* Calculates user's total order value for the current month
|
|
379
|
+
* @param userId - The unique user identifier
|
|
380
|
+
* @param includeDiscounts - Whether to apply promotional discounts
|
|
381
|
+
* @returns Total value in cents
|
|
382
|
+
*/
|
|
383
|
+
async function calculateMonthlyTotal(
|
|
384
|
+
userId: string,
|
|
385
|
+
includeDiscounts: boolean
|
|
386
|
+
): Promise<number>;
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
````
|
|
390
|
+
|
|
391
|
+
**5.8 Testing Standards**
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Test coverage requirements:
|
|
396
|
+
|
|
397
|
+
Minimum coverage:
|
|
398
|
+
A) 🏆 80%+ - Enterprise standard
|
|
399
|
+
B) ⭐ 70%+ - Recommended for most projects
|
|
400
|
+
C) 50%+ - Minimum acceptable
|
|
401
|
+
D) No requirement
|
|
402
|
+
|
|
403
|
+
What to test:
|
|
404
|
+
|
|
405
|
+
- ✅ Services/Business logic - 80%+ coverage
|
|
406
|
+
- ✅ Controllers/Routes - 60%+ coverage
|
|
407
|
+
- ✅ Utilities/Helpers - 90%+ coverage
|
|
408
|
+
- ✅ Database repositories - 70%+ coverage
|
|
409
|
+
- ❓ DTOs/Entities - Usually no tests needed
|
|
410
|
+
|
|
411
|
+
Test file naming:
|
|
412
|
+
A) ⭐ .spec.ts / .test.ts - Next to source file
|
|
413
|
+
B) Separate tests/ folder
|
|
414
|
+
|
|
415
|
+
Mocking strategy:
|
|
416
|
+
A) ⭐ Mock external dependencies (DB, APIs)
|
|
417
|
+
B) Integration tests with real DB
|
|
418
|
+
C) Mix: Unit tests mock, integration tests don't
|
|
419
|
+
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**5.9 Code Complexity Limits**
|
|
423
|
+
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Code quality metrics:
|
|
427
|
+
|
|
428
|
+
Function length:
|
|
429
|
+
A) ⭐ Max 50 lines per function
|
|
430
|
+
B) Max 100 lines
|
|
431
|
+
C) No limit
|
|
432
|
+
|
|
433
|
+
Cyclomatic complexity:
|
|
434
|
+
A) ⭐ Max complexity 10
|
|
435
|
+
B) Max complexity 15
|
|
436
|
+
C) No limit
|
|
437
|
+
|
|
438
|
+
Parameters:
|
|
439
|
+
A) ⭐ Max 4 parameters (use object for more)
|
|
440
|
+
B) Max 6 parameters
|
|
441
|
+
C) No limit
|
|
442
|
+
|
|
443
|
+
Nesting depth:
|
|
444
|
+
A) ⭐ Max 3 levels
|
|
445
|
+
B) Max 4 levels
|
|
446
|
+
C) No limit
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**5.10 Git Commit Standards**
|
|
451
|
+
|
|
452
|
+
````
|
|
453
|
+
|
|
454
|
+
Commit message format:
|
|
455
|
+
|
|
456
|
+
A) ⭐ Conventional Commits
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
<type>(<scope>): <subject>
|
|
461
|
+
|
|
462
|
+
<body>
|
|
463
|
+
|
|
464
|
+
<footer>
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Types: feat, fix, docs, style, refactor, test, chore
|
|
468
|
+
|
|
469
|
+
Example:
|
|
470
|
+
|
|
471
|
+
```
|
|
472
|
+
feat(auth): add JWT refresh token rotation
|
|
473
|
+
|
|
474
|
+
- Implement token rotation on every refresh
|
|
475
|
+
- Store refresh tokens in Redis
|
|
476
|
+
- Add expiration cleanup job
|
|
477
|
+
|
|
478
|
+
Closes #123
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
B) Simple descriptive messages
|
|
482
|
+
C) No standard
|
|
483
|
+
|
|
484
|
+
Branch naming:
|
|
485
|
+
A) ⭐ feature/description, bugfix/description, hotfix/description
|
|
486
|
+
B) Your initials + description (e.g., jd/add-auth)
|
|
487
|
+
C) No standard
|
|
488
|
+
|
|
489
|
+
````
|
|
490
|
+
|
|
491
|
+
**5.11 Versioning & Changelog**
|
|
492
|
+
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Versioning policy:
|
|
496
|
+
|
|
497
|
+
What versioning scheme will you use?
|
|
498
|
+
A) ⭐ SemVer (Major.Minor.Patch) (recommended)
|
|
499
|
+
B) Date (YYYY.MM.DD)
|
|
500
|
+
C) Other: \_\_
|
|
501
|
+
|
|
502
|
+
Migration strategy:
|
|
503
|
+
How will you handle breaking changes and migrations?
|
|
504
|
+
A) ⭐ Document in the changelog and provide migration scripts (recommended)
|
|
505
|
+
B) Only document changes
|
|
506
|
+
C) Other: \_\_
|
|
507
|
+
|
|
508
|
+
Changelog:
|
|
509
|
+
How will you document and communicate changes?
|
|
510
|
+
A) ⭐ CHANGELOG.md in the repository (recommended)
|
|
511
|
+
B) Releases on GitHub/GitLab
|
|
512
|
+
C) Notes in documentation
|
|
513
|
+
D) Other: \_\_
|
|
514
|
+
|
|
515
|
+
Who will be responsible for updating the changelog?
|
|
516
|
+
A) ⭐ Tech Lead (recommended)
|
|
517
|
+
B) Author of the change (who does the PR)
|
|
518
|
+
C) Documentation team
|
|
519
|
+
D) Other: \_\_
|
|
520
|
+
Example roles: Tech Lead, release manager, PR author, documentation team, etc.
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
**5.12 Logging Standards**
|
|
525
|
+
|
|
526
|
+
```
|
|
527
|
+
What logging approach will you use?
|
|
528
|
+
|
|
529
|
+
Log format:
|
|
530
|
+
A) ⭐ Structured JSON - Machine-readable, easy to parse (recommended)
|
|
531
|
+
B) Plain text - Human-readable, traditional
|
|
532
|
+
C) Both - Different formats for different environments
|
|
533
|
+
|
|
534
|
+
Log levels:
|
|
535
|
+
- DEBUG: Detailed debugging info (development only)
|
|
536
|
+
- INFO: General information (request start, successful operations)
|
|
537
|
+
- WARN: Warnings (deprecated features, recoverable errors)
|
|
538
|
+
- ERROR: Errors (failed operations, exceptions)
|
|
539
|
+
- FATAL: Critical errors (system failures)
|
|
540
|
+
|
|
541
|
+
Default log level:
|
|
542
|
+
- Development: __
|
|
543
|
+
- Production: __
|
|
544
|
+
|
|
545
|
+
Log context to include:
|
|
546
|
+
□ Request ID (for tracing)
|
|
547
|
+
□ User ID (if authenticated)
|
|
548
|
+
□ IP address
|
|
549
|
+
□ User agent
|
|
550
|
+
□ Request path
|
|
551
|
+
□ Response status
|
|
552
|
+
□ Duration
|
|
553
|
+
□ Error stack traces
|
|
554
|
+
|
|
555
|
+
Log aggregation tool:
|
|
556
|
+
A) ⭐ CloudWatch (AWS)
|
|
557
|
+
B) Datadog
|
|
558
|
+
C) ELK Stack (Elasticsearch, Logstash, Kibana)
|
|
559
|
+
D) Splunk
|
|
560
|
+
E) Other: __
|
|
561
|
+
|
|
562
|
+
Log retention: __ days
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Phase 5 Output
|
|
566
|
+
|
|
567
|
+
```
|
|
568
|
+
📋 PHASE 5 SUMMARY:
|
|
569
|
+
|
|
570
|
+
Formatting: [indentation, quotes, line length, formatter + linter]
|
|
571
|
+
Naming: [files, classes, functions, variables, constants, interfaces style]
|
|
572
|
+
File Organization: [feature-based / layer-based / hybrid + rationale]
|
|
573
|
+
Imports: [ordering strategy, path aliases]
|
|
574
|
+
Type Rules: [strict mode, rules applied, type preferences]
|
|
575
|
+
Error Handling: [strategy, logging approach, client response format]
|
|
576
|
+
Comments: [when to comment, doc style (JSDoc/Docstrings/JavaDoc)]
|
|
577
|
+
Testing: [coverage % target, what to test, file naming, mocking strategy]
|
|
578
|
+
Complexity: [function length, cyclomatic complexity, parameters, nesting depth limits]
|
|
579
|
+
Git: [commit format (conventional/simple), branch naming convention]
|
|
580
|
+
Versioning: [scheme (SemVer/Date), migration strategy, changelog method, responsibility]
|
|
581
|
+
Logging Standards: [format (JSON/text), levels, context, aggregation tool, retention]
|
|
582
|
+
|
|
583
|
+
Is this correct? (Yes/No)
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
### 📄 Generate Phase 5 Documents
|
|
589
|
+
|
|
590
|
+
**Before starting generation:**
|
|
591
|
+
|
|
592
|
+
```
|
|
593
|
+
📖 Loading context from previous phases...
|
|
594
|
+
✅ Re-reading project-brief.md
|
|
595
|
+
✅ Re-reading docs/architecture.md
|
|
596
|
+
✅ Re-reading ai-instructions.md
|
|
597
|
+
✅ Re-reading specs/security.md
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
Once confirmed, generate:
|
|
601
|
+
|
|
602
|
+
**1. `docs/code-standards.md`**
|
|
603
|
+
|
|
604
|
+
- Use template: `.ai-flow/templates/docs/code-standards.template.md`
|
|
605
|
+
- Fill with all code quality rules, naming conventions, formatting
|
|
606
|
+
|
|
607
|
+
**2. Update `ai-instructions.md`**
|
|
608
|
+
|
|
609
|
+
- Add code style rules to formatting section
|
|
610
|
+
- Add complexity limits and testing requirements
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
✅ Generated: docs/code-standards.md
|
|
614
|
+
✅ Updated: ai-instructions.md (code standards added)
|
|
615
|
+
|
|
616
|
+
📝 Please review these documents. Do you need to make any corrections?
|
|
617
|
+
|
|
618
|
+
A) ✅ Look perfect, continue to Phase 6
|
|
619
|
+
B) 📝 I'll edit them now (I'll wait)
|
|
620
|
+
C) 🔄 Regenerate with changes (tell me what to modify)
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
**If user selects B:**
|
|
624
|
+
|
|
625
|
+
```
|
|
626
|
+
Perfect. Please edit the documents and type "ready" when you're done.
|
|
627
|
+
I'll re-read all files to update my context before continuing.
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
**Proceed to Phase 6 only after documents are validated.**
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
## PHASE 6: Testing Strategy (15-25 min)
|
|
637
|
+
|