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,983 @@
1
+ # Phase 2: Component Architecture
2
+
3
+ > **Duration:** 15-20 minutes
4
+ > **Purpose:** Define UI framework, component patterns, and frontend architecture
5
+
6
+ ---
7
+
8
+ ## 📋 Context
9
+
10
+ You are in **Phase 2 of 7** of the frontend bootstrap process.
11
+
12
+ **What we're defining:**
13
+ - UI Framework selection (React/Vue/Angular/Svelte/Solid)
14
+ - Component architecture pattern
15
+ - Component library and tooling
16
+ - File organization strategy
17
+
18
+ **Documents to generate:**
19
+ - `docs/components.md` - Component architecture guide
20
+ - `docs/architecture.md` - Frontend system architecture
21
+ - Updates to `ai-instructions.md` - Tech stack section
22
+
23
+ ---
24
+
25
+ ## 🎯 Instructions
26
+
27
+ Ask questions **one at a time**, wait for user response before next question.
28
+
29
+ **Progress indicator:** Show "Question X/12" for each question.
30
+
31
+ **Recommendations:** Mark with ⭐ (recommended), 🔥 (popular), ⚡ (modern), 🏆 (enterprise)
32
+
33
+ ---
34
+
35
+ ## Question 2.1: UI Framework
36
+
37
+ **Question:** Which UI framework will you use?
38
+
39
+ **Context:** This is the foundation of your frontend. Choose based on team expertise, ecosystem, and project requirements.
40
+
41
+ **Options:**
42
+
43
+ A) ⭐ **React 18+** (Recommended - Largest ecosystem)
44
+ - Functional components + hooks
45
+ - Virtual DOM, component-based architecture
46
+ - Massive ecosystem (Next.js, Remix for SSR)
47
+ - Best for: Teams with React experience, large apps
48
+ - Meta-frameworks: Next.js 14+, Remix 2+, Vite
49
+
50
+ B) 🔥 **Vue 3** (Popular - Progressive framework)
51
+ - Composition API + reactivity system
52
+ - Single-file components (.vue)
53
+ - Excellent documentation
54
+ - Best for: Rapid development, gradual adoption
55
+ - Meta-framework: Nuxt 3
56
+
57
+ C) 🏆 **Angular 17+** (Enterprise - Batteries included)
58
+ - TypeScript-first, opinionated
59
+ - Dependency injection, RxJS
60
+ - Complete framework (router, HTTP, forms included)
61
+ - Best for: Large teams, enterprise apps
62
+ - Meta-framework: Analog (experimental)
63
+
64
+ D) ⚡ **Svelte 4 / SvelteKit** (Modern - Compiler-based)
65
+ - No virtual DOM, compiles to vanilla JS
66
+ - Less boilerplate, reactive by default
67
+ - Best for: Performance-critical apps
68
+ - Meta-framework: SvelteKit
69
+
70
+ E) 🚀 **Solid.js** (Modern - Fine-grained reactivity)
71
+ - JSX syntax, no virtual DOM
72
+ - Blazing fast performance
73
+ - Best for: Performance enthusiasts
74
+ - Meta-framework: SolidStart
75
+
76
+ **Your choice:** (A/B/C/D/E)
77
+
78
+ **Follow-up if A (React):**
79
+ - **Meta-framework:** Next.js 14+ / Remix 2 / Create React App / Vite?
80
+ - **Version:** React 18.2+ (latest stable)
81
+
82
+ **Follow-up if B (Vue):**
83
+ - **Meta-framework:** Nuxt 3 / Vite?
84
+ - **Version:** Vue 3.4+ (latest stable)
85
+
86
+ **Follow-up if C (Angular):**
87
+ - **Version:** Angular 17+ (latest stable with signals)
88
+
89
+ **Follow-up if D (Svelte):**
90
+ - **Meta-framework:** SvelteKit (recommended) / Vite?
91
+ - **Version:** Svelte 4+ (latest stable)
92
+
93
+ **Follow-up if E (Solid):**
94
+ - **Meta-framework:** SolidStart / Vite?
95
+ - **Version:** Solid 1.8+ (latest stable)
96
+
97
+ ---
98
+
99
+ ## Question 2.2: TypeScript
100
+
101
+ **Question:** Will you use TypeScript?
102
+
103
+ **Context:** TypeScript adds static typing, improving code quality and developer experience.
104
+
105
+ **Options:**
106
+
107
+ A) ⭐ **Yes, strict mode** (Recommended)
108
+ - `"strict": true` in tsconfig.json
109
+ - Maximum type safety
110
+ - Best for: Production apps, large codebases
111
+
112
+ B) **Yes, relaxed mode**
113
+ - Some strict options disabled
114
+ - Gradual typing adoption
115
+ - Best for: Migrating from JavaScript
116
+
117
+ C) **No, JavaScript only**
118
+ - Pure JavaScript
119
+ - Best for: Small projects, prototypes
120
+
121
+ **Your choice:** (A/B/C)
122
+
123
+ **If Yes:** TypeScript 5.3+ (latest stable)
124
+
125
+ ---
126
+
127
+ ## Question 2.3: Build Tool
128
+
129
+ **Question:** Which build tool will you use?
130
+
131
+ **Context:** Modern build tools provide fast development and optimized production builds.
132
+
133
+ **Options:**
134
+
135
+ A) ⭐ **Vite** (Recommended - Lightning fast)
136
+ - Instant HMR, ESM-based
137
+ - Optimized production builds
138
+ - Best for: Modern apps, all frameworks
139
+
140
+ B) **Webpack 5**
141
+ - Mature, highly configurable
142
+ - Large ecosystem of loaders/plugins
143
+ - Best for: Complex build requirements
144
+
145
+ C) **Turbopack** (Next.js only)
146
+ - Rust-based, ultra-fast
147
+ - Integrated with Next.js 13+
148
+ - Best for: Next.js projects
149
+
150
+ D) **esbuild**
151
+ - Extremely fast Go-based bundler
152
+ - Minimal configuration
153
+ - Best for: Simple builds
154
+
155
+ E) **Framework default**
156
+ - Use whatever the meta-framework provides
157
+ - (e.g., Next.js has built-in bundler)
158
+
159
+ **Your choice:** (A/B/C/D/E)
160
+
161
+ ---
162
+
163
+ ## Question 2.4: Component Architecture Pattern
164
+
165
+ **Question:** How will you organize components?
166
+
167
+ **Context:** Component organization impacts maintainability and scalability.
168
+
169
+ **Options:**
170
+
171
+ A) ⭐ **Atomic Design** (Recommended - Scalable)
172
+ - Atoms → Molecules → Organisms → Templates → Pages
173
+ - Clear hierarchy, highly reusable
174
+ - Best for: Design systems, large apps
175
+ - Example:
176
+ ```
177
+ components/
178
+ atoms/ (Button, Input, Label)
179
+ molecules/ (SearchBar, FormField)
180
+ organisms/ (Header, UserCard, DataTable)
181
+ templates/ (MainLayout, DashboardLayout)
182
+ pages/ (actual routes)
183
+ ```
184
+
185
+ B) **Feature-based** (Domain-driven)
186
+ - Components organized by feature/domain
187
+ - Co-located code (components + hooks + tests)
188
+ - Best for: Feature-rich apps, microfront ends
189
+ - Example:
190
+ ```
191
+ features/
192
+ auth/ (LoginForm, RegisterForm, hooks, services)
193
+ dashboard/ (DashboardView, widgets, hooks)
194
+ profile/ (ProfileForm, settings, hooks)
195
+ ```
196
+
197
+ C) **Flat structure** (Simple)
198
+ - All components in one folder
199
+ - Minimal hierarchy
200
+ - Best for: Small apps, prototypes
201
+ - Example:
202
+ ```
203
+ components/ (all components here)
204
+ ```
205
+
206
+ D) **Hybrid** (Mix of Atomic + Feature-based)
207
+ - Shared components in atomic structure
208
+ - Feature-specific in feature folders
209
+ - Best for: Large, complex apps
210
+ - Example:
211
+ ```
212
+ components/shared/ (atomic design)
213
+ features/ (feature-specific components)
214
+ ```
215
+
216
+ **Your choice:** (A/B/C/D)
217
+
218
+ ---
219
+
220
+ #### 🎨 MERMAID COMPONENT DIAGRAM FORMATS - CRITICAL
221
+
222
+ **Use these exact formats** for frontend component diagrams mentioned in documentation:
223
+
224
+ ---
225
+
226
+ ##### 1️⃣ Component Hierarchy (Atomic Design)
227
+
228
+ Use `graph TD` to show component organization from pages down to atoms:
229
+
230
+ ````markdown
231
+ ```mermaid
232
+ graph TD
233
+ subgraph "Pages"
234
+ P1[HomePage]
235
+ P2[ProductPage]
236
+ P3[CheckoutPage]
237
+ end
238
+
239
+ subgraph "Organisms"
240
+ H[Header]
241
+ HG[HeroSection]
242
+ PL[ProductList]
243
+ CF[CheckoutForm]
244
+ F[Footer]
245
+ end
246
+
247
+ subgraph "Molecules"
248
+ N[NavBar]
249
+ S[SearchBar]
250
+ PC[ProductCard]
251
+ FI[FormInput]
252
+ end
253
+
254
+ subgraph "Atoms"
255
+ B[Button]
256
+ I[Input]
257
+ L[Logo]
258
+ IC[Icon]
259
+ end
260
+
261
+ P1 --> H
262
+ P1 --> HG
263
+ P1 --> F
264
+ P2 --> H
265
+ P2 --> PL
266
+ P2 --> F
267
+ P3 --> H
268
+ P3 --> CF
269
+ P3 --> F
270
+
271
+ H --> N
272
+ H --> L
273
+ HG --> S
274
+ PL --> PC
275
+ CF --> FI
276
+
277
+ N --> B
278
+ S --> I
279
+ S --> B
280
+ PC --> B
281
+ PC --> IC
282
+ FI --> I
283
+ FI --> L
284
+
285
+ style P1 fill:#e1f5ff
286
+ style P2 fill:#e1f5ff
287
+ style P3 fill:#e1f5ff
288
+ style H fill:#fff4e6
289
+ style F fill:#fff4e6
290
+ style N fill:#e8f5e9
291
+ style B fill:#fce4ec
292
+ ```
293
+ ````
294
+
295
+ **Use for:** Showing component organization, Atomic Design hierarchy, composition patterns
296
+
297
+ ---
298
+
299
+ ##### 2️⃣ Component Tree with Props/Events
300
+
301
+ Use `graph LR` to show parent-child relationships and data flow:
302
+
303
+ ````markdown
304
+ ```mermaid
305
+ graph LR
306
+ subgraph "Parent Component"
307
+ P[UserDashboard]
308
+ end
309
+
310
+ subgraph "Child Components"
311
+ H[UserHeader]
312
+ PR[UserProfile]
313
+ AF[ActivityFeed]
314
+ S[Sidebar]
315
+ end
316
+
317
+ subgraph "Grandchild Components"
318
+ A[Avatar]
319
+ E[EditButton]
320
+ AI[ActivityItem]
321
+ end
322
+
323
+ P -->|user: User| H
324
+ P -->|user: User| PR
325
+ P -->|activities: Activity[]| AF
326
+ P -->|menuItems: MenuItem[]| S
327
+
328
+ H --> A
329
+ H --> E
330
+ AF --> AI
331
+
332
+ E -.->|onEdit(userId)| P
333
+ AI -.->|onLike(activityId)| AF
334
+ AF -.->|onUpdate()| P
335
+
336
+ style P fill:#e1f5ff
337
+ style H fill:#fff4e6
338
+ style PR fill:#fff4e6
339
+ style AF fill:#fff4e6
340
+ style S fill:#fff4e6
341
+ ```
342
+ ````
343
+
344
+ **Notation:**
345
+ - Solid arrow `-->|prop: Type|` = Props passed down
346
+ - Dotted arrow `-.->|event(args)|` = Events bubbled up
347
+ - Group related components in subgraphs
348
+
349
+ **Use for:** Documenting data flow, props drilling, event handling patterns
350
+
351
+ ---
352
+
353
+ ##### 3️⃣ Component File Organization
354
+
355
+ Use `graph TB` to show file/folder structure:
356
+
357
+ ````markdown
358
+ ```mermaid
359
+ graph TB
360
+ subgraph "src/components/"
361
+ subgraph "pages/"
362
+ HP[HomePage.tsx]
363
+ PP[ProductPage.tsx]
364
+ end
365
+
366
+ subgraph "organisms/"
367
+ H[Header/]
368
+ PL[ProductList/]
369
+ end
370
+
371
+ subgraph "molecules/"
372
+ N[NavBar/]
373
+ PC[ProductCard/]
374
+ end
375
+
376
+ subgraph "atoms/"
377
+ B[Button/]
378
+ I[Input/]
379
+ end
380
+ end
381
+
382
+ HP -.-> H
383
+ HP -.-> PL
384
+ H -.-> N
385
+ PL -.-> PC
386
+ PC -.-> B
387
+
388
+ style pages fill:#e1f5ff
389
+ style organisms fill:#fff4e6
390
+ style molecules fill:#e8f5e9
391
+ style atoms fill:#fce4ec
392
+ ```
393
+ ````
394
+
395
+ **Use for:** Showing folder structure, import relationships, file organization patterns
396
+
397
+ ---
398
+
399
+ ##### 4️⃣ Application Routing Structure
400
+
401
+ Use `graph TD` to show route hierarchy:
402
+
403
+ ````markdown
404
+ ```mermaid
405
+ graph TD
406
+ ROOT[/ Root Layout] --> PUBLIC[Public Routes]
407
+ ROOT --> AUTH[Protected Routes]
408
+
409
+ PUBLIC --> HOME[/]
410
+ PUBLIC --> LOGIN[/auth/login]
411
+ PUBLIC --> REGISTER[/auth/register]
412
+ PUBLIC --> RESET[/auth/reset-password]
413
+
414
+ AUTH --> DASH[/dashboard]
415
+ AUTH --> PROF[/profile]
416
+ AUTH --> SETTINGS[/settings]
417
+
418
+ DASH --> OVERVIEW[/dashboard/overview]
419
+ DASH --> ANALYTICS[/dashboard/analytics]
420
+ DASH --> REPORTS[/dashboard/reports]
421
+
422
+ PROF --> VIEW[/profile/:userId]
423
+ PROF --> EDIT[/profile/:userId/edit]
424
+
425
+ SETTINGS --> ACCOUNT[/settings/account]
426
+ SETTINGS --> PREFS[/settings/preferences]
427
+
428
+ style ROOT fill:#e1f5ff
429
+ style PUBLIC fill:#e8f5e9
430
+ style AUTH fill:#fff4e6
431
+ ```
432
+ ````
433
+
434
+ **Use for:** Documenting route structure, showing protected routes, nested routing patterns
435
+
436
+ ---
437
+
438
+ **Best Practices for Component Diagrams:**
439
+
440
+ 1. **Color Code by Abstraction Level:**
441
+ - Pages/Routes: `#e1f5ff` (light blue)
442
+ - Organisms: `#fff4e6` (light orange)
443
+ - Molecules: `#e8f5e9` (light green)
444
+ - Atoms: `#fce4ec` (light pink)
445
+
446
+ 2. **Use Subgraphs:** Group related components by type or feature
447
+ 3. **Show Relationships:** Use solid arrows for composition, dotted for communication
448
+ 4. **Label Props:** Include TypeScript types when helpful (`user: User`, `items: Product[]`)
449
+ 5. **Keep It Readable:** Avoid overcrowding, use clear naming
450
+
451
+ **Common Formatting Rules:**
452
+ - Code fence: ` ```mermaid ` (lowercase, no spaces, three backticks)
453
+ - Start Mermaid syntax at column 0 (no indentation before code block)
454
+ - Use consistent colors across diagrams
455
+ - Preview at https://mermaid.live/ before saving
456
+
457
+ ---
458
+
459
+ ## Question 2.5: Component Library
460
+
461
+ **Question:** Will you use a component library?
462
+
463
+ **Context:** Component libraries provide pre-built, accessible components.
464
+
465
+ **Options:**
466
+
467
+ **For React:**
468
+ A) ⭐ **Material UI (MUI)** - Comprehensive, Material Design
469
+ B) 🔥 **Chakra UI** - Accessible, themeable, modern
470
+ C) **shadcn/ui** - Copy-paste components, full control
471
+ D) **Ant Design** - Enterprise-focused, complete
472
+ E) **Headless UI** - Unstyled, accessible primitives
473
+ F) **None** - Build custom components
474
+
475
+ **For Vue:**
476
+ A) ⭐ **Vuetify** - Material Design, comprehensive
477
+ B) **Quasar** - Full framework, multiple platforms
478
+ C) **Element Plus** - Enterprise-focused
479
+ D) **PrimeVue** - Rich component set
480
+ E) **Headless UI Vue** - Unstyled primitives
481
+ F) **None** - Build custom components
482
+
483
+ **For Angular:**
484
+ A) ⭐ **Angular Material** - Official, Material Design
485
+ B) **PrimeNG** - Rich component set
486
+ C) **NG-ZORRO** - Ant Design for Angular
487
+ D) **None** - Build custom components
488
+
489
+ **For Svelte:**
490
+ A) **Skeleton** - Full-featured UI toolkit
491
+ B) **Carbon Components Svelte** - IBM Design
492
+ C) **Svelte Material UI** - Material Design
493
+ D) **None** - Build custom components
494
+
495
+ **For Solid:**
496
+ A) **Hope UI** - Chakra-inspired for Solid
497
+ B) **Solid UI** - Minimalist component library
498
+ C) **None** - Build custom components
499
+
500
+ **Your choice:** (specify library or None)
501
+
502
+ ---
503
+
504
+ ## Question 2.6: State Management
505
+
506
+ **Question:** How will you manage global state?
507
+
508
+ **Context:** Choose based on app complexity and team preference.
509
+
510
+ **Options:**
511
+
512
+ **For React:**
513
+ A) ⭐ **Zustand** (Recommended - Simple, modern)
514
+ - Minimal boilerplate, hooks-based
515
+ - Best for: Most apps
516
+ B) **Redux Toolkit** - Predictable, DevTools
517
+ - Best for: Complex state, time-travel debugging
518
+ C) **Jotai** - Atomic state management
519
+ - Best for: Fine-grained state control
520
+ D) **Context API** - Built-in React
521
+ - Best for: Simple global state (theme, auth)
522
+ E) **None** - Local state only (useState, useReducer)
523
+
524
+ **For Vue:**
525
+ A) ⭐ **Pinia** (Recommended - Official)
526
+ - TypeScript-first, simple API
527
+ - Best for: Most Vue 3 apps
528
+ B) **Vuex 4** - Classic Vue state management
529
+ - Best for: Existing Vuex apps
530
+ C) **Composition API + provide/inject**
531
+ - Built-in Vue, simple
532
+ - Best for: Small to medium apps
533
+
534
+ **For Angular:**
535
+ A) ⭐ **NgRx** (Recommended - Redux for Angular)
536
+ - Reactive, RxJS-based
537
+ - Best for: Enterprise Angular apps
538
+ B) **Akita** - Simple, object-oriented
539
+ - Best for: Easier learning curve
540
+ C) **Services + RxJS** - Angular built-in
541
+ - Best for: Simple state needs
542
+
543
+ **For Svelte:**
544
+ A) ⭐ **Svelte Stores** (Built-in, recommended)
545
+ - Reactive stores, simple API
546
+ - Best for: Most Svelte apps
547
+ B) **None** - Component state only
548
+
549
+ **For Solid:**
550
+ A) ⭐ **Solid Store** (Built-in, recommended)
551
+ - Fine-grained reactivity
552
+ - Best for: Most Solid apps
553
+ B) **None** - Signals only
554
+
555
+ **Your choice:** (specify option)
556
+
557
+ ---
558
+
559
+ ## Question 2.7: Data Fetching
560
+
561
+ **Question:** How will you fetch and cache server data?
562
+
563
+ **Context:** Modern data fetching libraries handle caching, revalidation, and loading states.
564
+
565
+ **Options:**
566
+
567
+ A) ⭐ **TanStack Query (React Query)** (Recommended)
568
+ - Works with React, Vue, Svelte, Solid
569
+ - Automatic caching, background updates
570
+ - Best for: REST APIs, GraphQL
571
+ - Features: Pagination, infinite scroll, optimistic updates
572
+
573
+ B) **SWR** (Stale-While-Revalidate)
574
+ - Lightweight, hooks-based (React)
575
+ - Best for: Simple data fetching
576
+
577
+ C) **Apollo Client** (GraphQL only)
578
+ - Complete GraphQL client
579
+ - Best for: GraphQL APIs
580
+
581
+ D) **RTK Query** (Redux Toolkit)
582
+ - Integrated with Redux
583
+ - Best for: Redux-based apps
584
+
585
+ E) **Axios + manual caching**
586
+ - Traditional approach
587
+ - Best for: Simple apps
588
+
589
+ F) **Native fetch + useState**
590
+ - No dependencies
591
+ - Best for: Minimal apps
592
+
593
+ **Your choice:** (A/B/C/D/E/F)
594
+
595
+ ---
596
+
597
+ ## Question 2.8: Routing
598
+
599
+ **Question:** How will you handle routing?
600
+
601
+ **Context:** Most meta-frameworks include routing. For SPAs, you need a routing library.
602
+
603
+ **Options:**
604
+
605
+ **If using meta-framework (Next.js, Nuxt, SvelteKit, etc.):**
606
+ - ⭐ **Use built-in file-based routing** (Recommended)
607
+ - pages/ directory = routes
608
+ - No configuration needed
609
+
610
+ **If building SPA:**
611
+
612
+ **For React:**
613
+ A) ⭐ **React Router 6+** (Recommended)
614
+ - Industry standard
615
+ - Data loading, nested routes
616
+ B) **TanStack Router**
617
+ - Type-safe, modern
618
+ - Best for: TypeScript-heavy apps
619
+ C) **Wouter**
620
+ - Tiny, minimalist
621
+ - Best for: Small apps
622
+
623
+ **For Vue:**
624
+ A) ⭐ **Vue Router 4** (Official, recommended)
625
+ - Composition API support
626
+ - Nested routes, guards
627
+
628
+ **For Angular:**
629
+ A) ⭐ **Angular Router** (Built-in, only option)
630
+
631
+ **For Svelte:**
632
+ A) ⭐ **SvelteKit routing** (Built-in)
633
+ B) **Page.js** (for non-SvelteKit SPAs)
634
+
635
+ **For Solid:**
636
+ A) ⭐ **Solid Router** (Official)
637
+ B) **@solidjs/router**
638
+
639
+ **Your choice:** (specify router or "meta-framework built-in")
640
+
641
+ ---
642
+
643
+ ## Question 2.9: Form Management
644
+
645
+ **Question:** How will you handle complex forms?
646
+
647
+ **Context:** Form libraries handle validation, errors, and submission state.
648
+
649
+ **Options:**
650
+
651
+ **For React:**
652
+ A) ⭐ **React Hook Form** (Recommended)
653
+ - Minimal re-renders, performance-focused
654
+ - Best for: Complex forms
655
+ B) **Formik**
656
+ - Popular, full-featured
657
+ - Best for: Traditional form handling
658
+ C) **Native HTML forms**
659
+ - No library
660
+ - Best for: Simple forms
661
+
662
+ **For Vue:**
663
+ A) ⭐ **VeeValidate 4**
664
+ - Composition API, flexible
665
+ - Best for: Complex forms
666
+ B) **Native v-model**
667
+ - Built-in Vue
668
+ - Best for: Simple forms
669
+
670
+ **For Angular:**
671
+ A) ⭐ **Reactive Forms** (Built-in, recommended)
672
+ - Strongly typed, testable
673
+ B) **Template-driven Forms**
674
+ - Simpler, less control
675
+
676
+ **For Svelte:**
677
+ A) **Svelte Native** (bind:value)
678
+ - Built-in two-way binding
679
+ - Best for: Most forms
680
+ B) **Felte** - Form library for Svelte
681
+
682
+ **For Solid:**
683
+ A) **Solid Forms**
684
+ - Form library for Solid
685
+ B) **Native** - Solid signals
686
+
687
+ **Your choice:** (specify library or native)
688
+
689
+ ---
690
+
691
+ ## Question 2.10: Styling Approach
692
+
693
+ **Question:** How will you style components?
694
+
695
+ **Context:** Choose based on team preference, design system needs, and performance requirements.
696
+
697
+ **Options:**
698
+
699
+ A) ⭐ **Tailwind CSS** (Recommended - Utility-first)
700
+ - Rapid development, consistent design
701
+ - JIT compiler, small bundle
702
+ - Best for: Most modern apps
703
+
704
+ B) **CSS Modules** (Scoped CSS)
705
+ - Standard CSS, locally scoped
706
+ - Best for: Traditional CSS developers
707
+
708
+ C) **Styled Components / Emotion** (CSS-in-JS)
709
+ - Dynamic styles, themed
710
+ - Best for: Component libraries
711
+
712
+ D) **Sass/SCSS** (CSS preprocessor)
713
+ - Variables, mixins, nesting
714
+ - Best for: Traditional workflow
715
+
716
+ E) **Vanilla CSS** (Plain CSS files)
717
+ - No dependencies
718
+ - Best for: Simple apps
719
+
720
+ F) **UnoCSS** (Instant atomic CSS)
721
+ - Faster than Tailwind
722
+ - Best for: Performance enthusiasts
723
+
724
+ **Your choice:** (A/B/C/D/E/F)
725
+
726
+ **If Tailwind:** Will you use any Tailwind plugins? (typography, forms, etc.)
727
+
728
+ ---
729
+
730
+ ## Question 2.11: Design Tokens / Theming
731
+
732
+ **Question:** Will you use design tokens for theming?
733
+
734
+ **Context:** Design tokens centralize colors, spacing, typography for consistency.
735
+
736
+ **Options:**
737
+
738
+ A) ⭐ **Yes, CSS Variables** (Recommended)
739
+ - Dynamic theming, runtime changes
740
+ - Example:
741
+ ```css
742
+ :root {
743
+ --color-primary: #3B82F6;
744
+ --spacing-md: 1rem;
745
+ }
746
+ ```
747
+
748
+ B) **Yes, JavaScript/TypeScript tokens**
749
+ - Exported constants
750
+ - Type-safe
751
+
752
+ C) **Yes, Component library tokens**
753
+ - Use library's theming system (MUI, Chakra, etc.)
754
+
755
+ D) **No, hardcoded values**
756
+ - Direct colors/sizes in styles
757
+ - Best for: Small apps
758
+
759
+ **Your choice:** (A/B/C/D)
760
+
761
+ **If Yes to tokens:**
762
+ - Will you support dark mode? (Yes/No)
763
+ - Will you support multiple themes? (Yes/No/Maybe later)
764
+
765
+ ---
766
+
767
+ ## Question 2.12: Testing Strategy
768
+
769
+ **Question:** What will you test in components?
770
+
771
+ **Context:** Testing ensures components work correctly and don't break.
772
+
773
+ **Options:**
774
+
775
+ A) ⭐ **Unit + Component + E2E** (Recommended - Comprehensive)
776
+ - Unit: Vitest / Jest
777
+ - Component: Testing Library (React/Vue/Svelte Testing Library)
778
+ - E2E: Playwright / Cypress
779
+ - Best for: Production apps
780
+
781
+ B) **Component + E2E** (Pragmatic)
782
+ - Skip pure unit tests
783
+ - Focus on user behavior
784
+ - Best for: Most apps
785
+
786
+ C) **E2E only** (High-level)
787
+ - Test critical user paths
788
+ - Best for: Small apps, MVPs
789
+
790
+ D) **Minimal** (Unit only)
791
+ - Test utilities and hooks only
792
+ - Best for: Prototypes
793
+
794
+ **Your choice:** (A/B/C/D)
795
+
796
+ **Component testing framework:**
797
+ - **React:** React Testing Library (recommended)
798
+ - **Vue:** Vue Test Utils
799
+ - **Angular:** Jasmine/Karma (built-in)
800
+ - **Svelte:** Svelte Testing Library
801
+ - **Solid:** Solid Testing Library
802
+
803
+ **E2E testing framework:**
804
+ - ⭐ **Playwright** (Recommended - Modern, fast)
805
+ - **Cypress** (Popular, DX-focused)
806
+ - **None** - Skip E2E for now
807
+
808
+ ---
809
+
810
+ ## Question 2.13: API Integration Pattern
811
+
812
+ **Question:** How will you integrate with backend APIs?
813
+
814
+ **Context:** Define how your frontend communicates with backend services.
815
+
816
+ **Options:**
817
+
818
+ A) ⭐ **REST API with Fetch/Axios**
819
+ - Standard REST endpoints
820
+ - Client: Axios, Fetch API, or custom wrapper
821
+ - Best for: Most apps, simple integration
822
+ - Example: `GET /api/users`, `POST /api/users`
823
+
824
+ B) **GraphQL with Apollo/urql**
825
+ - Single endpoint, flexible queries
826
+ - Client: Apollo Client, urql, or TanStack Query GraphQL
827
+ - Best for: Complex data requirements, mobile apps
828
+ - Example: `query { users { id name } }`
829
+
830
+ C) **tRPC (TypeScript RPC)**
831
+ - End-to-end type safety
832
+ - Best for: TypeScript monorepos, type-safe APIs
833
+ - Example: `trpc.users.getById.useQuery({ id: '1' })`
834
+
835
+ D) **gRPC-Web**
836
+ - Protocol buffers, efficient binary format
837
+ - Best for: High-performance, microservices
838
+ - Example: `client.getUser({ id: '1' })`
839
+
840
+ **Your choice:** (A/B/C/D)
841
+
842
+ **If REST selected:**
843
+ - **API Client:** Axios / Fetch API / Custom wrapper
844
+ - **Base URL:** __
845
+ - **Request interceptors:** [Auth headers, error handling, logging]
846
+ - **Response interceptors:** [Error transformation, token refresh]
847
+
848
+ **If GraphQL selected:**
849
+ - **Client:** Apollo Client / urql / TanStack Query GraphQL
850
+ - **Endpoint:** __
851
+ - **Subscriptions:** [Yes/No - Real-time updates]
852
+
853
+ **API Layer Pattern:**
854
+ A) ⭐ **Service Layer** - Separate API functions
855
+ ```
856
+ services/
857
+ api.ts (base client)
858
+ users.ts (user endpoints)
859
+ products.ts (product endpoints)
860
+ ```
861
+
862
+ B) **Hooks/Composables Layer** - API calls in hooks
863
+ ```
864
+ hooks/
865
+ useUsers.ts (API calls + state)
866
+ useProducts.ts
867
+ ```
868
+
869
+ C) **Both** - Services + Hooks
870
+ ```
871
+ services/ (API functions)
872
+ hooks/ (React hooks/Vue composables)
873
+ ```
874
+
875
+ **Your choice:** (A/B/C)
876
+
877
+ ---
878
+
879
+ ## Question 2.14: Error Boundaries / Global Error Handling
880
+
881
+ **Question:** How will you handle global errors?
882
+
883
+ **Context:** Catch and handle errors that occur during rendering, lifecycle methods, and constructors.
884
+
885
+ **Options:**
886
+
887
+ **For React:**
888
+ A) ⭐ **Error Boundaries** (Recommended)
889
+ - Catch component tree errors
890
+ - Show fallback UI
891
+ - Best for: React apps
892
+ - Example: `<ErrorBoundary><App /></ErrorBoundary>`
893
+
894
+ B) **Global Error Handler + Error Boundary**
895
+ - Window error handler + Error Boundaries
896
+ - Best for: Comprehensive error handling
897
+
898
+ **For Vue:**
899
+ A) ⭐ **errorHandler** (Built-in)
900
+ - Global error handler
901
+ - Best for: Vue apps
902
+ - Example: `app.config.errorHandler = (err, instance, info) => { ... }`
903
+
904
+ **For Angular:**
905
+ A) ⭐ **ErrorHandler** (Built-in)
906
+ - Global error handler service
907
+ - Best for: Angular apps
908
+
909
+ **Error Recovery Strategy:**
910
+ A) ⭐ **Show fallback UI** - Display error message, retry button
911
+ B) **Redirect to error page** - Navigate to `/error`
912
+ C) **Log and continue** - Log error, show minimal notification
913
+ D) **Combined** - Different strategies for different error types
914
+
915
+ **Error Logging:**
916
+ - **Tool:** Sentry / LogRocket / Console only
917
+ - **What to log:** [Error message, stack trace, user context, component tree]
918
+
919
+ **Your answer:**
920
+
921
+ ---
922
+
923
+ ## 📝 Phase 2 Summary
924
+
925
+ After all questions, show summary:
926
+
927
+ ```
928
+ =================================================
929
+ PHASE 2 SUMMARY: Component Architecture
930
+ =================================================
931
+
932
+ UI Framework: {{UI_FRAMEWORK}} {{VERSION}}
933
+ Meta-framework: {{META_FRAMEWORK}}
934
+ Build Tool: {{BUILD_TOOL}}
935
+ TypeScript: {{TYPESCRIPT}}
936
+
937
+ Component Pattern: {{COMPONENT_PATTERN}}
938
+ Component Library: {{COMPONENT_LIBRARY}}
939
+ State Management: {{STATE_MANAGEMENT}}
940
+ Data Fetching: {{DATA_FETCHING}}
941
+
942
+ Routing: {{ROUTING}}
943
+ Forms: {{FORM_LIBRARY}}
944
+ Styling: {{STYLING_APPROACH}}
945
+ Design Tokens: {{DESIGN_TOKENS}}
946
+ Dark Mode: {{DARK_MODE_SUPPORT}}
947
+
948
+ Testing:
949
+ - Component: {{COMPONENT_TEST_LIBRARY}}
950
+ - E2E: {{E2E_FRAMEWORK}}
951
+
952
+ API Integration: {{API_INTEGRATION_PATTERN}}
953
+ API Client: {{API_CLIENT}}
954
+ Error Handling: {{ERROR_HANDLING_STRATEGY}}
955
+
956
+ =================================================
957
+ ```
958
+
959
+ **Ask for confirmation:**
960
+ "Does this look correct? (Yes to continue, No to restart phase 2)"
961
+
962
+ **If Yes:**
963
+ "✅ Phase 2 complete! Moving to Phase 3: State Management & Data Flow..."
964
+
965
+ **If No:**
966
+ "Restarting Phase 2..."
967
+
968
+ ---
969
+
970
+ ## 🎯 Next Steps
971
+
972
+ After Phase 2 completion, you will:
973
+ 1. Update `ai-instructions.md` with tech stack
974
+ 2. Generate `docs/components.md` with component patterns
975
+ 3. Generate `docs/architecture.md` with system architecture
976
+ 4. Continue to Phase 3: State Management & Data Flow
977
+
978
+ ---
979
+
980
+ **Phase:** 2 of 7
981
+ **Estimated time:** 15-20 minutes
982
+ **Documents updated:** ai-instructions.md, docs/components.md, docs/architecture.md
983
+