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,570 @@
1
+ # Phase 6: Testing Strategy
2
+
3
+ **Duration:** 15-25 minutes
4
+ **Questions:** ~12 questions
5
+ **Output:** docs/testing.md, parts of ai-instructions.md
6
+
7
+ ---
8
+
9
+ ## 🎯 Objective
10
+
11
+ Define your testing strategy:
12
+
13
+ 1. What testing frameworks will you use?
14
+ 2. What types of tests will you write?
15
+ 3. What coverage targets?
16
+ 4. How will tests run in CI/CD?
17
+
18
+ ---
19
+
20
+ ## 📋 Questions
21
+
22
+ ### Question 6.1: Unit Testing Framework
23
+
24
+ **What unit test framework will you use?**
25
+
26
+ A) ⭐ **Vitest** (Recommended for most)
27
+ - Features: Fast, Vite-native, compatible with Jest API
28
+ - Best for: Vite projects, modern apps
29
+ - Speed: Very fast (ESM native)
30
+ - Bundle: N/A (dev dependency)
31
+
32
+ B) 🔥 **Jest**
33
+ - Features: Mature, widely used, snapshot testing
34
+ - Best for: React apps, large ecosystem
35
+ - Speed: Fast (with SWC/ESBuild)
36
+ - Bundle: N/A (dev dependency)
37
+
38
+ C) **Testing Library + Node Test Runner**
39
+ - Features: Node.js built-in test runner (Node 18+)
40
+ - Best for: Zero-dependency testing
41
+ - Speed: Fast
42
+
43
+ D) **Mocha + Chai**
44
+ - Features: Flexible, BDD-style
45
+ - Best for: Legacy projects
46
+
47
+ **Your answer:**
48
+
49
+ ---
50
+
51
+ ### Question 6.2: Component Testing Library
52
+
53
+ **How will you test components?**
54
+
55
+ #### React
56
+
57
+ A) ⭐ **React Testing Library** (Recommended)
58
+ - Philosophy: Test user behavior, not implementation
59
+ - Features: Accessible queries, user-centric
60
+ - Best for: All React apps
61
+
62
+ B) **Enzyme**
63
+ - Features: Shallow rendering, instance testing
64
+ - Best for: Legacy React apps
65
+ - Note: Not recommended for new projects
66
+
67
+ #### Vue
68
+
69
+ A) ⭐ **Vue Test Utils** (Official)
70
+ - Features: Vue-specific testing utilities
71
+ - Best for: All Vue apps
72
+
73
+ #### Angular
74
+
75
+ A) ⭐ **Angular Testing Utilities** (Built-in)
76
+ - Features: TestBed, ComponentFixture
77
+ - Best for: All Angular apps
78
+
79
+ #### Svelte
80
+
81
+ A) ⭐ **Svelte Testing Library**
82
+ - Features: User-centric testing
83
+ - Best for: All Svelte apps
84
+
85
+ #### Solid
86
+
87
+ A) ⭐ **Solid Testing Library**
88
+ - Features: Similar to React Testing Library
89
+ - Best for: All Solid apps
90
+
91
+ **Your answer:**
92
+
93
+ ---
94
+
95
+ ### Question 6.3: E2E Testing Framework
96
+
97
+ **What E2E testing tool will you use?**
98
+
99
+ A) ⭐ **Playwright** (Recommended)
100
+ - Features: Cross-browser, fast, modern API, auto-waiting
101
+ - Browsers: Chromium, Firefox, WebKit
102
+ - Best for: Most apps, CI/CD friendly
103
+ - Speed: Very fast
104
+
105
+ B) 🔥 **Cypress**
106
+ - Features: Great DX, time-travel debugging, visual testing
107
+ - Browsers: Chrome, Firefox, Edge, Electron
108
+ - Best for: Developer experience, visual regression
109
+ - Speed: Fast
110
+
111
+ C) **Puppeteer**
112
+ - Features: Chrome/Chromium only, powerful API
113
+ - Best for: Chrome-only testing, scraping
114
+
115
+ D) **WebDriverIO**
116
+ - Features: WebDriver protocol, cross-platform
117
+ - Best for: Mobile testing, Appium integration
118
+
119
+ E) **No E2E tests**
120
+ - Best for: MVPs, small apps
121
+
122
+ **Your answer:**
123
+
124
+ ---
125
+
126
+ ### Question 6.4: Testing Pyramid Distribution
127
+
128
+ **What test distribution will you target?**
129
+
130
+ A) ⭐ **Standard Pyramid** (Recommended)
131
+ - 70% Unit tests
132
+ - 20% Integration tests
133
+ - 10% E2E tests
134
+ - Best for: Most apps, balanced approach
135
+
136
+ B) **Heavy Unit**
137
+ - 85% Unit tests
138
+ - 10% Integration tests
139
+ - 5% E2E tests
140
+ - Best for: Logic-heavy apps, libraries
141
+
142
+ C) **Heavy Integration**
143
+ - 50% Unit tests
144
+ - 40% Integration tests
145
+ - 10% E2E tests
146
+ - Best for: UI-heavy apps, component libraries
147
+
148
+ D) **Testing Trophy** (Kent C. Dodds)
149
+ - 30% Unit tests
150
+ - 50% Integration tests
151
+ - 20% E2E tests
152
+ - Best for: User-centric apps
153
+
154
+ **Your answer:**
155
+
156
+ ---
157
+
158
+ #### 🎨 TESTING PYRAMID VISUALIZATION
159
+
160
+ **Use this diagram format** to visualize test distribution strategy:
161
+
162
+ ```mermaid
163
+ graph TB
164
+ subgraph "Testing Pyramid"
165
+ E2E["🌐 E2E Tests (10%)<br/>Slow, Expensive<br/>Full user flows"]
166
+ INT["🔗 Integration Tests (20%)<br/>Medium Speed<br/>Component interaction"]
167
+ UNIT["⚡ Unit Tests (70%)<br/>Fast, Cheap<br/>Individual functions/components"]
168
+ end
169
+
170
+ E2E --> INT
171
+ INT --> UNIT
172
+
173
+ style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
174
+ style INT fill:#fff4e6,stroke:#f57c00,stroke-width:2px
175
+ style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:3px
176
+
177
+ classDef note fill:#f5f5f5,stroke:#666,stroke-dasharray: 5 5
178
+
179
+ note1["Cost ↑<br/>Speed ↓<br/>Confidence ↑"]:::note
180
+ note2["Cost ↓<br/>Speed ↑<br/>Confidence varies"]:::note
181
+
182
+ E2E -.-> note1
183
+ UNIT -.-> note2
184
+ ```
185
+
186
+ **Alternative: Testing Trophy (Kent C. Dodds)**
187
+
188
+ For apps prioritizing integration tests over unit tests:
189
+
190
+ ```mermaid
191
+ graph TB
192
+ subgraph "Testing Trophy"
193
+ E2E["🌐 E2E Tests (20%)<br/>Critical user paths"]
194
+ INT["🔗 Integration Tests (50%)<br/>⭐ Focus here<br/>Component + API interaction"]
195
+ UNIT["⚡ Unit Tests (30%)<br/>Complex logic only"]
196
+ STATIC["📝 Static Analysis (Base)<br/>TypeScript + ESLint"]
197
+ end
198
+
199
+ E2E --> INT
200
+ INT --> UNIT
201
+ UNIT --> STATIC
202
+
203
+ style E2E fill:#fce4ec,stroke:#c2185b,stroke-width:2px
204
+ style INT fill:#fff4e6,stroke:#f57c00,stroke-width:4px
205
+ style UNIT fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
206
+ style STATIC fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
207
+ ```
208
+
209
+ **When to Use Each Visualization:**
210
+
211
+ - **Testing Pyramid**: Best for traditional apps, backend-heavy logic, libraries
212
+ - **Testing Trophy**: Best for React apps, user-centric products, component-driven UIs
213
+
214
+ **Diagram Guidelines:**
215
+ - Color code by test type (E2E=pink, Integration=orange, Unit=green)
216
+ - Show percentages clearly
217
+ - Include speed/cost trade-offs
218
+ - Update percentages based on selected strategy (A, B, C, or D)
219
+
220
+ ---
221
+
222
+ ---
223
+
224
+ ### Question 6.5: Code Coverage Targets
225
+
226
+ **What coverage percentage will you target?**
227
+
228
+ A) ⭐ **80% / 75% / 80% / 80%** (Recommended)
229
+ - Statements: 80%
230
+ - Branches: 75%
231
+ - Functions: 80%
232
+ - Lines: 80%
233
+ - Best for: Most production apps
234
+
235
+ B) **100% / 100% / 100% / 100%** (Strict)
236
+ - All coverage at 100%
237
+ - Best for: Critical apps (finance, healthcare)
238
+ - Note: May be impractical
239
+
240
+ C) **60% / 60% / 60% / 60%** (Lenient)
241
+ - Best for: MVPs, startups
242
+
243
+ D) **No coverage targets**
244
+ - Best for: Prototypes only
245
+
246
+ **Your answer:**
247
+
248
+ **Enforce coverage in CI?**
249
+ A) Yes - Fail CI if below threshold
250
+ B) No - Report only, no enforcement
251
+
252
+ ---
253
+
254
+ ### Question 6.6: Snapshot Testing
255
+
256
+ **Will you use snapshot testing?**
257
+
258
+ Snapshot testing = Capture component output, detect unexpected changes
259
+
260
+ A) ⭐ **Yes, for components**
261
+ - Test component output snapshots
262
+ - Best for: Preventing regressions
263
+ - Tools: Jest/Vitest snapshots
264
+
265
+ B) **Yes, for components + visual regression**
266
+ - Add visual snapshot testing (screenshot comparison)
267
+ - Best for: UI-critical apps
268
+ - Tools: Percy, Chromatic, Playwright screenshots
269
+
270
+ C) **No snapshot testing**
271
+ - Best for: Avoiding brittle tests
272
+
273
+ **Your answer:**
274
+
275
+ ---
276
+
277
+ ### Question 6.7: Test Data & Fixtures
278
+
279
+ **How will you manage test data?**
280
+
281
+ A) ⭐ **Factory functions** (Recommended)
282
+ ```typescript
283
+ const createUser = (overrides = {}) => ({
284
+ id: '1',
285
+ name: 'John Doe',
286
+ email: 'john@example.com',
287
+ ...overrides
288
+ });
289
+ ```
290
+ - Best for: Flexible, reusable test data
291
+
292
+ B) **Static fixtures**
293
+ ```typescript
294
+ // fixtures/users.json
295
+ {
296
+ "user1": { "id": "1", "name": "John Doe" }
297
+ }
298
+ ```
299
+ - Best for: Consistent test data
300
+
301
+ C) **Faker.js / @faker-js/faker**
302
+ - Generate random realistic data
303
+ - Best for: Large datasets, avoiding hardcoding
304
+
305
+ D) **Inline data**
306
+ - Define data directly in tests
307
+ - Best for: Simple tests
308
+
309
+ **Your answer:**
310
+
311
+ ---
312
+
313
+ ### Question 6.8: Mocking Strategy
314
+
315
+ **How will you mock dependencies?**
316
+
317
+ A) ⭐ **Mock Service Worker (MSW)** (Recommended for API mocking)
318
+ - Features: Intercept network requests, works in tests and browser
319
+ - Best for: API mocking, realistic tests
320
+ - Example:
321
+ ```typescript
322
+ rest.get('/api/users', (req, res, ctx) => {
323
+ return res(ctx.json({ users: [...] }));
324
+ });
325
+ ```
326
+
327
+ B) **Vitest/Jest mocks**
328
+ - Features: `vi.mock()` / `jest.mock()` for modules
329
+ - Best for: Module/function mocking
330
+ - Example:
331
+ ```typescript
332
+ vi.mock('./api', () => ({
333
+ fetchUser: vi.fn(() => Promise.resolve({ id: '1' }))
334
+ }));
335
+ ```
336
+
337
+ C) **Manual mocks**
338
+ - Features: Create mock implementations manually
339
+ - Best for: Full control
340
+
341
+ D) **No mocking**
342
+ - Test against real APIs
343
+ - Best for: Integration tests only
344
+
345
+ **Your answer:**
346
+
347
+ ---
348
+
349
+ ### Question 6.9: Test Organization
350
+
351
+ **How will you organize tests?**
352
+
353
+ A) ⭐ **Collocated with source** (Recommended)
354
+ ```
355
+ components/
356
+ ├── Button/
357
+ │ ├── Button.tsx
358
+ │ ├── Button.test.tsx
359
+ │ └── Button.stories.tsx
360
+ ```
361
+ - Best for: Modularity, easy to find tests
362
+
363
+ B) **Separate __tests__ folder**
364
+ ```
365
+ components/
366
+ ├── Button/
367
+ │ ├── Button.tsx
368
+ │ └── __tests__/
369
+ │ └── Button.test.tsx
370
+ ```
371
+ - Best for: Jest convention
372
+
373
+ C) **Mirrored test folder**
374
+ ```
375
+ src/
376
+ ├── components/Button.tsx
377
+ tests/
378
+ ├── components/Button.test.tsx
379
+ ```
380
+ - Best for: Separation of concerns
381
+
382
+ **Your answer:**
383
+
384
+ **E2E test location:**
385
+ - `e2e/` folder at root
386
+ - `tests/e2e/` folder
387
+ - `__e2e__/` folders throughout
388
+
389
+ ---
390
+
391
+ ### Question 6.10: CI/CD Test Execution
392
+
393
+ **How will tests run in CI?**
394
+
395
+ A) ⭐ **All tests on every PR** (Recommended)
396
+ - Unit + Integration + E2E
397
+ - Best for: Most apps, catch regressions early
398
+
399
+ B) **Unit/Integration on PR, E2E on merge to main**
400
+ - Faster PR feedback, comprehensive on main
401
+ - Best for: Slow E2E suites
402
+
403
+ C) **Unit on PR, full suite nightly**
404
+ - Best for: Very large test suites
405
+
406
+ D) **Manual test runs**
407
+ - Not recommended
408
+
409
+ **Your answer:**
410
+
411
+ **Parallel test execution:**
412
+ A) Yes - Run tests in parallel (faster)
413
+ B) No - Sequential execution
414
+
415
+ **Retry failed tests:**
416
+ A) Yes - Retry flaky tests (specify retries: ___)
417
+ B) No - Fail immediately
418
+
419
+ ---
420
+
421
+ ### Question 6.11: Visual Regression Testing
422
+
423
+ **Will you do visual regression testing?**
424
+
425
+ Visual regression = Screenshot comparison to detect unintended UI changes
426
+
427
+ A) ⭐ **Yes, with Percy / Chromatic**
428
+ - Features: Cloud-based, visual diffs, review UI
429
+ - Best for: Design-critical apps, component libraries
430
+
431
+ B) **Yes, with Playwright snapshots**
432
+ - Features: Local screenshot comparison
433
+ - Best for: Self-hosted, free option
434
+
435
+ C) **No visual regression**
436
+ - Best for: MVPs, non-visual apps
437
+
438
+ **Your answer:**
439
+
440
+ **If yes, what to test:**
441
+ - [ ] Critical user flows (checkout, signup)
442
+ - [ ] All components (Storybook)
443
+ - [ ] Responsive breakpoints
444
+ - [ ] Dark/light themes
445
+
446
+ ---
447
+
448
+ ### Question 6.12: Accessibility Testing
449
+
450
+ **How will you test accessibility?**
451
+
452
+ A) ⭐ **jest-axe / vitest-axe**
453
+ ```typescript
454
+ it('has no a11y violations', async () => {
455
+ const { container } = render(<Button>Click me</Button>);
456
+ const results = await axe(container);
457
+ expect(results).toHaveNoViolations();
458
+ });
459
+ ```
460
+ - Best for: Automated a11y checks in unit tests
461
+
462
+ B) **@axe-core/playwright / @axe-core/cypress**
463
+ - E2E accessibility testing
464
+ - Best for: Full-page a11y scans
465
+
466
+ C) **Manual testing**
467
+ - Screen reader testing, keyboard navigation
468
+ - Best for: Comprehensive a11y
469
+
470
+ D) **No automated a11y testing**
471
+ - Best for: MVPs only (not recommended)
472
+
473
+ E) **Combined (automated + manual)**
474
+ - Best for: WCAG compliance
475
+
476
+ **Your answer:**
477
+
478
+ ---
479
+
480
+ ## 📊 Phase 6 Summary
481
+
482
+ ```
483
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
484
+ 📋 PHASE 6 SUMMARY: TESTING STRATEGY
485
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
486
+
487
+ Unit Testing: [Answer from 6.1]
488
+ Component Testing: [Answer from 6.2]
489
+ E2E Testing: [Answer from 6.3]
490
+ Test Distribution: [Answer from 6.4]
491
+ Coverage Targets: [Answer from 6.5]
492
+ Snapshot Testing: [Answer from 6.6]
493
+ Test Data: [Answer from 6.7]
494
+ Mocking Strategy: [Answer from 6.8]
495
+ Test Organization: [Answer from 6.9]
496
+ CI/CD Execution: [Answer from 6.10]
497
+ Visual Regression: [Answer from 6.11]
498
+ A11y Testing: [Answer from 6.12]
499
+
500
+ Is this correct? (Y/n)
501
+ ```
502
+
503
+ ---
504
+
505
+ ## 📝 Document Generation
506
+
507
+ Generate `docs/testing.md` with these placeholders:
508
+
509
+ - `{{UNIT_TEST_FRAMEWORK}}` → Vitest / Jest / etc.
510
+ - `{{COMPONENT_TEST_LIBRARY}}` → React Testing Library / Vue Test Utils / etc.
511
+ - `{{E2E_FRAMEWORK}}` → Playwright / Cypress / etc.
512
+ - `{{TEST_DISTRIBUTION}}` → Testing pyramid percentages
513
+ - `{{COVERAGE_TARGETS}}` → Coverage thresholds
514
+ - `{{SNAPSHOT_TESTING}}` → Yes/No and strategy
515
+ - `{{TEST_DATA_STRATEGY}}` → Factory / Fixtures / Faker
516
+ - `{{MOCKING_LIBRARY}}` → MSW / Vitest mocks / etc.
517
+ - `{{TEST_ORGANIZATION}}` → Collocated / Separate / Mirrored
518
+ - `{{CI_STRATEGY}}` → How tests run in CI
519
+ - `{{VISUAL_REGRESSION_TOOL}}` → Percy / Playwright / None
520
+ - `{{A11Y_TESTING}}` → jest-axe / Manual / Combined
521
+
522
+ Update `ai-instructions.md`:
523
+
524
+ ```markdown
525
+ ## Testing
526
+
527
+ - **Unit Tests:** {{UNIT_TEST_FRAMEWORK}}
528
+ - **Component Tests:** {{COMPONENT_TEST_LIBRARY}}
529
+ - **E2E Tests:** {{E2E_FRAMEWORK}}
530
+ - **Coverage:** {{COVERAGE_TARGETS}}
531
+
532
+ ### Rules
533
+
534
+ - ✅ ALWAYS write tests for new features
535
+ - ✅ ALWAYS test user behavior, not implementation details
536
+ - ✅ ALWAYS use accessible queries (getByRole, getByLabelText)
537
+ - ❌ NEVER test implementation details (state, props directly)
538
+ - ❌ NEVER commit untested code
539
+ - ✅ ALWAYS mock external APIs with {{MOCKING_LIBRARY}}
540
+ {{#IF_SNAPSHOT_TESTING}}
541
+ - ✅ ALWAYS review snapshot changes carefully
542
+ {{/IF_SNAPSHOT_TESTING}}
543
+ {{#IF_A11Y_TESTING}}
544
+ - ✅ ALWAYS include axe accessibility checks in component tests
545
+ {{/IF_A11Y_TESTING}}
546
+ - ✅ ALWAYS maintain {{COVERAGE_TARGETS}}% code coverage
547
+ ```
548
+
549
+ ---
550
+
551
+ ## 🚀 Next Steps
552
+
553
+ ```
554
+ ✅ Phase 6 Complete!
555
+
556
+ Documents Generated:
557
+ - docs/testing.md
558
+ - ai-instructions.md (updated)
559
+
560
+ Next: Phase 7 - Performance & Deployment
561
+
562
+ Read: .ai-flow/prompts/frontend/flow-docs-gen-phase-7-deployment.md
563
+ ```
564
+
565
+ ---
566
+
567
+ **Last Updated:** 2025-01-XX
568
+
569
+ **Version:** 1.2.0
570
+