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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +408 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +791 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/fs-utils.d.ts +2 -0
  8. package/dist/fs-utils.d.ts.map +1 -0
  9. package/dist/fs-utils.js +46 -0
  10. package/dist/fs-utils.js.map +1 -0
  11. package/package.json +71 -0
  12. package/prompts/backend/flow-dev-feature.md +1318 -0
  13. package/prompts/backend/flow-dev-fix.md +903 -0
  14. package/prompts/backend/flow-dev-refactor.md +715 -0
  15. package/prompts/backend/flow-dev-review.md +401 -0
  16. package/prompts/backend/flow-dev-work.md +1129 -0
  17. package/prompts/backend/flow-docs-gen-phase-0.md +1840 -0
  18. package/prompts/backend/flow-docs-gen-phase-1.md +435 -0
  19. package/prompts/backend/flow-docs-gen-phase-2.md +460 -0
  20. package/prompts/backend/flow-docs-gen-phase-3.md +684 -0
  21. package/prompts/backend/flow-docs-gen-phase-4.md +516 -0
  22. package/prompts/backend/flow-docs-gen-phase-5.md +637 -0
  23. package/prompts/backend/flow-docs-gen-phase-6.md +465 -0
  24. package/prompts/backend/flow-docs-gen-phase-7.md +1207 -0
  25. package/prompts/backend/flow-docs-gen.md +820 -0
  26. package/prompts/backend/flow-docs-sync.md +526 -0
  27. package/prompts/backend/flow-project-init.md +248 -0
  28. package/prompts/backend/flow-project-roadmap.md +1159 -0
  29. package/prompts/frontend/flow-docs-gen-phase-0.md +494 -0
  30. package/prompts/frontend/flow-docs-gen-phase-1.md +449 -0
  31. package/prompts/frontend/flow-docs-gen-phase-2.md +983 -0
  32. package/prompts/frontend/flow-docs-gen-phase-3.md +685 -0
  33. package/prompts/frontend/flow-docs-gen-phase-4.md +480 -0
  34. package/prompts/frontend/flow-docs-gen-phase-5.md +483 -0
  35. package/prompts/frontend/flow-docs-gen-phase-6.md +570 -0
  36. package/prompts/frontend/flow-docs-gen-phase-7.md +582 -0
  37. package/prompts/frontend/flow-docs-gen.md +413 -0
  38. package/prompts/frontend/flow-docs-sync.md +561 -0
  39. package/prompts/mobile/flow-docs-gen-phase-0.md +387 -0
  40. package/prompts/mobile/flow-docs-gen-phase-1.md +530 -0
  41. package/prompts/mobile/flow-docs-gen-phase-2.md +584 -0
  42. package/prompts/mobile/flow-docs-gen-phase-3.md +659 -0
  43. package/prompts/mobile/flow-docs-gen-phase-4.md +363 -0
  44. package/prompts/mobile/flow-docs-gen-phase-5.md +369 -0
  45. package/prompts/mobile/flow-docs-gen-phase-6.md +490 -0
  46. package/prompts/mobile/flow-docs-gen-phase-7.md +407 -0
  47. package/prompts/mobile/flow-docs-gen.md +430 -0
  48. package/prompts/mobile/flow-docs-sync.md +634 -0
  49. package/templates/backend/.clauderules.template +111 -0
  50. package/templates/backend/.cursorrules.template +102 -0
  51. package/templates/backend/.env.example.template +122 -0
  52. package/templates/backend/README.template.md +200 -0
  53. package/templates/backend/ai-instructions.template.md +354 -0
  54. package/templates/backend/copilot-instructions.template.md +160 -0
  55. package/templates/backend/docs/api.template.md +251 -0
  56. package/templates/backend/docs/architecture.template.md +612 -0
  57. package/templates/backend/docs/business-flows.template.md +109 -0
  58. package/templates/backend/docs/code-standards.template.md +828 -0
  59. package/templates/backend/docs/contributing.template.md +163 -0
  60. package/templates/backend/docs/data-model.template.md +416 -0
  61. package/templates/backend/docs/operations.template.md +591 -0
  62. package/templates/backend/docs/testing.template.md +762 -0
  63. package/templates/backend/project-brief.template.md +176 -0
  64. package/templates/backend/specs/configuration.template.md +133 -0
  65. package/templates/backend/specs/security.template.md +422 -0
  66. package/templates/frontend/README.template.md +121 -0
  67. package/templates/frontend/ai-instructions.template.md +368 -0
  68. package/templates/frontend/docs/api-integration.template.md +390 -0
  69. package/templates/frontend/docs/components.template.md +567 -0
  70. package/templates/frontend/docs/error-handling.template.md +385 -0
  71. package/templates/frontend/docs/operations.template.md +123 -0
  72. package/templates/frontend/docs/performance.template.md +140 -0
  73. package/templates/frontend/docs/pwa.template.md +135 -0
  74. package/templates/frontend/docs/state-management.template.md +394 -0
  75. package/templates/frontend/docs/styling.template.md +779 -0
  76. package/templates/frontend/docs/testing.template.md +736 -0
  77. package/templates/frontend/project-brief.template.md +55 -0
  78. package/templates/frontend/specs/accessibility.template.md +111 -0
  79. package/templates/frontend/specs/configuration.template.md +520 -0
  80. package/templates/frontend/specs/security.template.md +197 -0
  81. package/templates/fullstack/README.template.md +282 -0
  82. package/templates/fullstack/ai-instructions.template.md +487 -0
  83. package/templates/fullstack/project-brief.template.md +197 -0
  84. package/templates/fullstack/specs/configuration.template.md +380 -0
  85. package/templates/mobile/AGENT.template.md +251 -0
  86. package/templates/mobile/README.template.md +195 -0
  87. package/templates/mobile/ai-instructions.template.md +221 -0
  88. package/templates/mobile/docs/app-store.template.md +163 -0
  89. package/templates/mobile/docs/architecture.template.md +100 -0
  90. package/templates/mobile/docs/native-features.template.md +137 -0
  91. package/templates/mobile/docs/navigation.template.md +81 -0
  92. package/templates/mobile/docs/offline-strategy.template.md +90 -0
  93. package/templates/mobile/docs/permissions.template.md +70 -0
  94. package/templates/mobile/docs/state-management.template.md +116 -0
  95. package/templates/mobile/docs/testing.template.md +146 -0
  96. package/templates/mobile/project-brief.template.md +97 -0
  97. package/templates/mobile/specs/build-configuration.template.md +116 -0
  98. package/templates/mobile/specs/deployment.template.md +114 -0
  99. package/templates/shared/AGENT.template.md +252 -0
@@ -0,0 +1,483 @@
1
+ # Phase 5: Code Standards & Best Practices
2
+
3
+ **Duration:** 15-20 minutes
4
+ **Questions:** ~10 questions
5
+ **Output:** docs/code-standards.md, parts of ai-instructions.md
6
+
7
+ ---
8
+
9
+ ## 🎯 Objective
10
+
11
+ Define coding conventions and standards:
12
+
13
+ 1. File and component naming conventions
14
+ 2. Code formatting and linting rules
15
+ 3. Import organization
16
+ 4. Commit message standards
17
+ 5. Code review practices
18
+
19
+ ---
20
+
21
+ ## 📋 Questions
22
+
23
+ ### Question 5.1: File Naming Convention
24
+
25
+ **How will you name your files?**
26
+
27
+ #### React/Solid
28
+
29
+ A) ⭐ **PascalCase for components** (Recommended)
30
+ - Components: `UserProfile.tsx`, `Button.tsx`
31
+ - Hooks: `useAuth.ts`, `useLocalStorage.ts`
32
+ - Utils: `formatDate.ts`, `apiClient.ts`
33
+ - Best for: React ecosystem standard
34
+
35
+ B) **kebab-case for all files**
36
+ - Components: `user-profile.tsx`, `button.tsx`
37
+ - Best for: Consistency with Vue/Angular
38
+
39
+ C) **camelCase for all files**
40
+ - Components: `userProfile.tsx`, `button.tsx`
41
+ - Best for: JavaScript naming conventions
42
+
43
+ #### Vue
44
+
45
+ A) ⭐ **PascalCase for components** (Vue 3 recommended)
46
+ - Components: `UserProfile.vue`, `BaseButton.vue`
47
+ - Composables: `useAuth.ts`, `useLocalStorage.ts`
48
+ - Utils: `formatDate.ts`
49
+
50
+ B) **kebab-case (Vue 2 style)**
51
+ - Components: `user-profile.vue`, `base-button.vue`
52
+
53
+ #### Angular
54
+
55
+ A) ⭐ **kebab-case with suffixes** (Angular standard)
56
+ - Components: `user-profile.component.ts`
57
+ - Services: `auth.service.ts`
58
+ - Modules: `user.module.ts`
59
+ - Guards: `auth.guard.ts`
60
+
61
+ #### Svelte
62
+
63
+ A) ⭐ **PascalCase for components**
64
+ - Components: `UserProfile.svelte`, `Button.svelte`
65
+
66
+ **Your answer:**
67
+
68
+ ---
69
+
70
+ ### Question 5.2: Component Naming Convention
71
+
72
+ **How will you name components in code?**
73
+
74
+ A) ⭐ **PascalCase** (All frameworks recommend)
75
+ - Example: `<UserProfile />`, `<Button />`
76
+ - Best for: Standard practice
77
+
78
+ B) **Named exports vs default exports?**
79
+
80
+ #### React/Vue/Solid
81
+
82
+ A) ⭐ **Named exports** (Recommended)
83
+ ```typescript
84
+ export const Button = () => { ... }
85
+ // Usage: import { Button } from './Button'
86
+ ```
87
+ - Pros: Better IDE support, easier refactoring, explicit names
88
+ - Cons: Slightly more verbose
89
+
90
+ B) **Default exports**
91
+ ```typescript
92
+ export default function Button() { ... }
93
+ // Usage: import Button from './Button'
94
+ ```
95
+ - Pros: Shorter imports
96
+ - Cons: Can rename on import, harder to refactor
97
+
98
+ **Your answer:**
99
+
100
+ ---
101
+
102
+ ### Question 5.3: Linting & Formatting
103
+
104
+ **What linting/formatting tools will you use?**
105
+
106
+ A) ⭐ **ESLint + Prettier** (Recommended)
107
+ - ESLint: Code quality rules
108
+ - Prettier: Code formatting
109
+ - Best for: Most JavaScript/TypeScript projects
110
+
111
+ B) **ESLint only**
112
+ - Configure ESLint for both linting and formatting
113
+ - Best for: Simpler setup
114
+
115
+ C) **Biome**
116
+ - All-in-one linter and formatter (faster than ESLint+Prettier)
117
+ - Best for: Monorepos, performance-critical projects
118
+
119
+ D) **No linting/formatting**
120
+ - Manual code review only
121
+ - Not recommended
122
+
123
+ **Your answer:**
124
+
125
+ **If ESLint, which config?**
126
+
127
+ #### React
128
+
129
+ A) ⭐ **eslint-config-airbnb** (Strict, popular)
130
+ B) **@typescript-eslint/recommended** (TypeScript-focused)
131
+ C) **eslint-config-react-app** (Create React App default)
132
+ D) **Custom config**
133
+
134
+ #### Vue
135
+
136
+ A) ⭐ **eslint-plugin-vue** (Official Vue rules)
137
+ B) **@vue/eslint-config-typescript** (Vue + TypeScript)
138
+
139
+ #### Angular
140
+
141
+ A) ⭐ **@angular-eslint** (Official Angular ESLint)
142
+
143
+ **Prettier config:**
144
+ - Print width: _____ (default: 80)
145
+ - Tabs or spaces: _____ (default: 2 spaces)
146
+ - Semicolons: Yes / No (default: Yes)
147
+ - Single quotes: Yes / No (default: No)
148
+ - Trailing commas: es5 / all / none (default: es5)
149
+
150
+ ---
151
+
152
+ ### Question 5.4: Import Organization
153
+
154
+ **How will you organize imports?**
155
+
156
+ A) ⭐ **Grouped by type** (Recommended)
157
+ ```typescript
158
+ // 1. External libraries
159
+ import React from 'react';
160
+ import { useQuery } from '@tanstack/react-query';
161
+
162
+ // 2. Internal modules
163
+ import { Button } from '@/components/Button';
164
+ import { useAuth } from '@/hooks/useAuth';
165
+
166
+ // 3. Relative imports
167
+ import { UserCard } from './UserCard';
168
+
169
+ // 4. Types
170
+ import type { User } from '@/types';
171
+
172
+ // 5. Styles
173
+ import styles from './styles.module.css';
174
+ ```
175
+
176
+ B) **Alphabetical only**
177
+ - All imports alphabetically sorted
178
+ - Best for: Simpler rule
179
+
180
+ C) **No specific order**
181
+ - Not recommended
182
+
183
+ **Your answer:**
184
+
185
+ **Import alias for src/?**
186
+ - `@/` (e.g., `import { Button } from '@/components/Button'`)
187
+ - `~/` (e.g., `import { Button } from '~/components/Button'`)
188
+ - No alias (relative paths only)
189
+
190
+ **Auto-import sorting tool:**
191
+ - `eslint-plugin-import` + `import/order` rule
192
+ - `prettier-plugin-organize-imports`
193
+ - Manual
194
+
195
+ ---
196
+
197
+ ### Question 5.5: TypeScript Strictness
198
+
199
+ **How strict should TypeScript be?**
200
+
201
+ A) ⭐ **Strict mode** (Recommended)
202
+ ```json
203
+ {
204
+ "strict": true,
205
+ "noUncheckedIndexedAccess": true,
206
+ "noImplicitOverride": true
207
+ }
208
+ ```
209
+ - Catches most type errors
210
+ - Best for: New projects, type safety
211
+
212
+ B) **Moderate**
213
+ ```json
214
+ {
215
+ "strict": true,
216
+ "noUncheckedIndexedAccess": false
217
+ }
218
+ ```
219
+ - Strict but allows some flexibility
220
+
221
+ C) **Lenient**
222
+ - Minimal type checking
223
+ - Best for: Migration from JavaScript
224
+
225
+ **Your answer:**
226
+
227
+ **`any` type policy:**
228
+ A) ❌ Never allow `any` (use `unknown` instead)
229
+ B) ⚠️ Allow `any` with eslint warning
230
+ C) ✅ Allow `any` freely (not recommended)
231
+
232
+ ---
233
+
234
+ ### Question 5.6: Code Comments
235
+
236
+ **What's your commenting policy?**
237
+
238
+ A) ⭐ **JSDoc for public APIs, inline for complex logic**
239
+ ```typescript
240
+ /**
241
+ * Fetches user data from the API
242
+ * @param userId - The user's unique identifier
243
+ * @returns User object or null if not found
244
+ */
245
+ export async function fetchUser(userId: string): Promise<User | null> {
246
+ // Check cache first to avoid unnecessary API call
247
+ const cached = cache.get(userId);
248
+ if (cached) return cached;
249
+
250
+ return api.get(`/users/${userId}`);
251
+ }
252
+ ```
253
+ - Best for: Most projects
254
+
255
+ B) **JSDoc everywhere**
256
+ - Comment all functions, even private ones
257
+ - Best for: Libraries, public APIs
258
+
259
+ C) **Minimal comments**
260
+ - Self-documenting code only
261
+ - Comments only for "why", not "what"
262
+
263
+ D) **No comment policy**
264
+ - Up to developers
265
+
266
+ **Your answer:**
267
+
268
+ ---
269
+
270
+ ### Question 5.7: Component Structure
271
+
272
+ **How will you structure components?**
273
+
274
+ A) ⭐ **Collocated files** (Recommended)
275
+ ```
276
+ Button/
277
+ ├── Button.tsx
278
+ ├── Button.test.tsx
279
+ ├── Button.stories.tsx
280
+ ├── Button.module.css
281
+ └── index.ts (re-export)
282
+ ```
283
+ - Best for: Modularity, easy to move/delete
284
+
285
+ B) **Separate folders**
286
+ ```
287
+ components/Button.tsx
288
+ styles/Button.module.css
289
+ tests/Button.test.tsx
290
+ ```
291
+ - Best for: Simpler structure, smaller projects
292
+
293
+ C) **Single file components** (Vue SFC style)
294
+ ```vue
295
+ <template>...</template>
296
+ <script>...</script>
297
+ <style>...</style>
298
+ ```
299
+ - Best for: Vue, Svelte
300
+
301
+ **Your answer:**
302
+
303
+ ---
304
+
305
+ ### Question 5.8: Error Handling Patterns
306
+
307
+ **How will you handle errors in components?**
308
+
309
+ A) ⭐ **Error Boundaries + Try-Catch**
310
+ - Error Boundaries: Catch render errors
311
+ - Try-Catch: Catch async errors
312
+ - Best for: React, robust error handling
313
+
314
+ B) **Global error handler**
315
+ - Vue: `app.config.errorHandler`
316
+ - Angular: `ErrorHandler`
317
+ - Best for: Centralized error logging
318
+
319
+ C) **Try-Catch everywhere**
320
+ - Manual error handling in each function
321
+ - Best for: Fine-grained control
322
+
323
+ **Your answer:**
324
+
325
+ **Error logging:**
326
+ - Sentry
327
+ - LogRocket
328
+ - DataDog
329
+ - Console only (development)
330
+ - No logging
331
+
332
+ ---
333
+
334
+ ### Question 5.9: Code Review Standards
335
+
336
+ **What's required for code review approval?**
337
+
338
+ Select all that apply:
339
+
340
+ - [ ] Linting passes (no ESLint errors)
341
+ - [ ] Tests pass (unit + integration)
342
+ - [ ] Code coverage meets threshold (specify: ___%)
343
+ - [ ] No TypeScript errors
344
+ - [ ] At least 1 approval from team member
345
+ - [ ] Self-review (author reviews their own PR)
346
+ - [ ] Documentation updated (if public API changed)
347
+ - [ ] No console.log statements
348
+ - [ ] Accessibility review (for UI changes)
349
+
350
+ **Minimum approvals required:** _____
351
+
352
+ **Approval required from:**
353
+ A) Any team member
354
+ B) Senior/Lead developer
355
+ C) Code owner (GitHub CODEOWNERS)
356
+
357
+ **Your answer:**
358
+
359
+ ---
360
+
361
+ ### Question 5.10: Commit Message Convention
362
+
363
+ **What commit message format will you use?**
364
+
365
+ A) ⭐ **Conventional Commits** (Recommended)
366
+ ```
367
+ <type>(<scope>): <subject>
368
+
369
+ <body>
370
+
371
+ <footer>
372
+ ```
373
+ - Types: feat, fix, docs, style, refactor, test, chore
374
+ - Example: `feat(auth): add Google OAuth login`
375
+ - Best for: Automated changelogs, semantic versioning
376
+
377
+ B) **Simple descriptive**
378
+ - Example: "Add Google OAuth login"
379
+ - Best for: Small teams, simple projects
380
+
381
+ C) **No convention**
382
+ - Free-form commit messages
383
+
384
+ **Your answer:**
385
+
386
+ **If Conventional Commits, enforce with:**
387
+ - commitlint (pre-commit hook)
388
+ - Manual review
389
+ - No enforcement
390
+
391
+ **Require commit body for:**
392
+ A) All commits
393
+ B) Only breaking changes
394
+ C) Never required
395
+
396
+ ---
397
+
398
+ ## 📊 Phase 5 Summary
399
+
400
+ ```
401
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
402
+ 📋 PHASE 5 SUMMARY: CODE STANDARDS
403
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
404
+
405
+ File Naming: [Answer from 5.1]
406
+ Component Naming: [Answer from 5.2]
407
+ Linting/Formatting: [Answer from 5.3]
408
+ Import Organization: [Answer from 5.4]
409
+ TypeScript Strictness: [Answer from 5.5]
410
+ Code Comments: [Answer from 5.6]
411
+ Component Structure: [Answer from 5.7]
412
+ Error Handling: [Answer from 5.8]
413
+ Code Review: [Answer from 5.9]
414
+ Commit Messages: [Answer from 5.10]
415
+ Logging Standards: [Answer from 5.11]
416
+ Documentation Tools: [Answer from 5.12]
417
+
418
+ Is this correct? (Y/n)
419
+ ```
420
+
421
+ ---
422
+
423
+ ## 📝 Document Generation
424
+
425
+ Generate `docs/code-standards.md` with these placeholders:
426
+
427
+ - `{{FILE_NAMING_CONVENTION}}` → File naming pattern
428
+ - `{{COMPONENT_NAMING}}` → Component naming pattern
429
+ - `{{LINTING_TOOLS}}` → ESLint + Prettier / Biome / etc.
430
+ - `{{IMPORT_ORGANIZATION}}` → Import order rules
431
+ - `{{TYPESCRIPT_STRICTNESS}}` → Strict / Moderate / Lenient
432
+ - `{{COMMENT_POLICY}}` → Commenting guidelines
433
+ - `{{COMPONENT_STRUCTURE}}` → File structure pattern
434
+ - `{{ERROR_HANDLING}}` → Error handling approach
435
+ - `{{CODE_REVIEW_RULES}}` → Review requirements
436
+ - `{{COMMIT_CONVENTION}}` → Commit message format
437
+
438
+ Update `ai-instructions.md`:
439
+
440
+ ```markdown
441
+ ## Code Standards
442
+
443
+ - **File Naming:** {{FILE_NAMING_CONVENTION}}
444
+ - **Component Naming:** {{COMPONENT_NAMING}}
445
+ - **Linting:** {{LINTING_TOOLS}}
446
+ - **TypeScript:** {{TYPESCRIPT_STRICTNESS}}
447
+
448
+ ### Rules
449
+
450
+ - ✅ ALWAYS use {{FILE_NAMING_CONVENTION}} for file names
451
+ - ✅ ALWAYS use {{COMPONENT_NAMING}} for component names
452
+ - ✅ ALWAYS run linter before committing
453
+ - ❌ NEVER commit code with ESLint errors
454
+ - ❌ NEVER use `any` type (use `unknown` instead)
455
+ - ✅ ALWAYS write JSDoc for exported functions
456
+ - ✅ ALWAYS use {{IMPORT_ORGANIZATION}} for imports
457
+ {{#IF_CONVENTIONAL_COMMITS}}
458
+ - ✅ ALWAYS use Conventional Commits format
459
+ {{/IF_CONVENTIONAL_COMMITS}}
460
+ ```
461
+
462
+ ---
463
+
464
+ ## 🚀 Next Steps
465
+
466
+ ```
467
+ ✅ Phase 5 Complete!
468
+
469
+ Documents Generated:
470
+ - docs/code-standards.md
471
+ - ai-instructions.md (updated)
472
+
473
+ Next: Phase 6 - Testing Strategy
474
+
475
+ Read: .ai-flow/prompts/frontend/flow-docs-gen-phase-6-testing.md
476
+ ```
477
+
478
+ ---
479
+
480
+ **Last Updated:** 2025-01-XX
481
+
482
+ **Version:** 1.2.0
483
+