agentic-qe 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/.claude/agents/qx-partner.md +17 -4
  2. package/.claude/skills/accessibility-testing/SKILL.md +144 -692
  3. package/.claude/skills/agentic-quality-engineering/SKILL.md +176 -529
  4. package/.claude/skills/api-testing-patterns/SKILL.md +180 -560
  5. package/.claude/skills/brutal-honesty-review/SKILL.md +113 -603
  6. package/.claude/skills/bug-reporting-excellence/SKILL.md +116 -517
  7. package/.claude/skills/chaos-engineering-resilience/SKILL.md +127 -72
  8. package/.claude/skills/cicd-pipeline-qe-orchestrator/SKILL.md +209 -404
  9. package/.claude/skills/code-review-quality/SKILL.md +158 -608
  10. package/.claude/skills/compatibility-testing/SKILL.md +148 -38
  11. package/.claude/skills/compliance-testing/SKILL.md +132 -63
  12. package/.claude/skills/consultancy-practices/SKILL.md +114 -446
  13. package/.claude/skills/context-driven-testing/SKILL.md +117 -381
  14. package/.claude/skills/contract-testing/SKILL.md +176 -141
  15. package/.claude/skills/database-testing/SKILL.md +137 -130
  16. package/.claude/skills/exploratory-testing-advanced/SKILL.md +160 -629
  17. package/.claude/skills/holistic-testing-pact/SKILL.md +140 -188
  18. package/.claude/skills/localization-testing/SKILL.md +145 -33
  19. package/.claude/skills/mobile-testing/SKILL.md +132 -448
  20. package/.claude/skills/mutation-testing/SKILL.md +147 -41
  21. package/.claude/skills/performance-testing/SKILL.md +200 -546
  22. package/.claude/skills/quality-metrics/SKILL.md +164 -519
  23. package/.claude/skills/refactoring-patterns/SKILL.md +132 -699
  24. package/.claude/skills/regression-testing/SKILL.md +120 -926
  25. package/.claude/skills/risk-based-testing/SKILL.md +157 -660
  26. package/.claude/skills/security-testing/SKILL.md +199 -538
  27. package/.claude/skills/sherlock-review/SKILL.md +163 -699
  28. package/.claude/skills/shift-left-testing/SKILL.md +161 -465
  29. package/.claude/skills/shift-right-testing/SKILL.md +161 -519
  30. package/.claude/skills/six-thinking-hats/SKILL.md +175 -1110
  31. package/.claude/skills/skills-manifest.json +71 -20
  32. package/.claude/skills/tdd-london-chicago/SKILL.md +131 -448
  33. package/.claude/skills/technical-writing/SKILL.md +103 -154
  34. package/.claude/skills/test-automation-strategy/SKILL.md +166 -772
  35. package/.claude/skills/test-data-management/SKILL.md +126 -910
  36. package/.claude/skills/test-design-techniques/SKILL.md +179 -89
  37. package/.claude/skills/test-environment-management/SKILL.md +136 -91
  38. package/.claude/skills/test-reporting-analytics/SKILL.md +169 -92
  39. package/.claude/skills/testability-scoring/SKILL.md +172 -538
  40. package/.claude/skills/testability-scoring/scripts/generate-html-report.js +0 -0
  41. package/.claude/skills/visual-testing-advanced/SKILL.md +155 -78
  42. package/.claude/skills/xp-practices/SKILL.md +151 -587
  43. package/CHANGELOG.md +48 -0
  44. package/README.md +23 -16
  45. package/dist/agents/QXPartnerAgent.d.ts +8 -1
  46. package/dist/agents/QXPartnerAgent.d.ts.map +1 -1
  47. package/dist/agents/QXPartnerAgent.js +1174 -112
  48. package/dist/agents/QXPartnerAgent.js.map +1 -1
  49. package/dist/agents/lifecycle/AgentLifecycleManager.d.ts.map +1 -1
  50. package/dist/agents/lifecycle/AgentLifecycleManager.js +34 -31
  51. package/dist/agents/lifecycle/AgentLifecycleManager.js.map +1 -1
  52. package/dist/cli/commands/init-claude-md-template.d.ts.map +1 -1
  53. package/dist/cli/commands/init-claude-md-template.js +14 -0
  54. package/dist/cli/commands/init-claude-md-template.js.map +1 -1
  55. package/dist/core/SwarmCoordinator.d.ts +180 -0
  56. package/dist/core/SwarmCoordinator.d.ts.map +1 -0
  57. package/dist/core/SwarmCoordinator.js +473 -0
  58. package/dist/core/SwarmCoordinator.js.map +1 -0
  59. package/dist/core/metrics/MetricsAggregator.d.ts +228 -0
  60. package/dist/core/metrics/MetricsAggregator.d.ts.map +1 -0
  61. package/dist/core/metrics/MetricsAggregator.js +482 -0
  62. package/dist/core/metrics/MetricsAggregator.js.map +1 -0
  63. package/dist/core/metrics/index.d.ts +5 -0
  64. package/dist/core/metrics/index.d.ts.map +1 -0
  65. package/dist/core/metrics/index.js +11 -0
  66. package/dist/core/metrics/index.js.map +1 -0
  67. package/dist/core/optimization/SwarmOptimizer.d.ts +5 -0
  68. package/dist/core/optimization/SwarmOptimizer.d.ts.map +1 -1
  69. package/dist/core/optimization/SwarmOptimizer.js +17 -0
  70. package/dist/core/optimization/SwarmOptimizer.js.map +1 -1
  71. package/dist/core/orchestration/AdaptiveScheduler.d.ts +190 -0
  72. package/dist/core/orchestration/AdaptiveScheduler.d.ts.map +1 -0
  73. package/dist/core/orchestration/AdaptiveScheduler.js +460 -0
  74. package/dist/core/orchestration/AdaptiveScheduler.js.map +1 -0
  75. package/dist/core/orchestration/WorkflowOrchestrator.d.ts +13 -0
  76. package/dist/core/orchestration/WorkflowOrchestrator.d.ts.map +1 -1
  77. package/dist/core/orchestration/WorkflowOrchestrator.js +32 -0
  78. package/dist/core/orchestration/WorkflowOrchestrator.js.map +1 -1
  79. package/dist/core/recovery/CircuitBreaker.d.ts +176 -0
  80. package/dist/core/recovery/CircuitBreaker.d.ts.map +1 -0
  81. package/dist/core/recovery/CircuitBreaker.js +382 -0
  82. package/dist/core/recovery/CircuitBreaker.js.map +1 -0
  83. package/dist/core/recovery/RecoveryOrchestrator.d.ts +186 -0
  84. package/dist/core/recovery/RecoveryOrchestrator.d.ts.map +1 -0
  85. package/dist/core/recovery/RecoveryOrchestrator.js +476 -0
  86. package/dist/core/recovery/RecoveryOrchestrator.js.map +1 -0
  87. package/dist/core/recovery/RetryStrategy.d.ts +127 -0
  88. package/dist/core/recovery/RetryStrategy.d.ts.map +1 -0
  89. package/dist/core/recovery/RetryStrategy.js +314 -0
  90. package/dist/core/recovery/RetryStrategy.js.map +1 -0
  91. package/dist/core/recovery/index.d.ts +8 -0
  92. package/dist/core/recovery/index.d.ts.map +1 -0
  93. package/dist/core/recovery/index.js +27 -0
  94. package/dist/core/recovery/index.js.map +1 -0
  95. package/dist/core/skills/DependencyResolver.d.ts +99 -0
  96. package/dist/core/skills/DependencyResolver.d.ts.map +1 -0
  97. package/dist/core/skills/DependencyResolver.js +260 -0
  98. package/dist/core/skills/DependencyResolver.js.map +1 -0
  99. package/dist/core/skills/ManifestGenerator.d.ts +114 -0
  100. package/dist/core/skills/ManifestGenerator.d.ts.map +1 -0
  101. package/dist/core/skills/ManifestGenerator.js +449 -0
  102. package/dist/core/skills/ManifestGenerator.js.map +1 -0
  103. package/dist/core/skills/index.d.ts +9 -0
  104. package/dist/core/skills/index.d.ts.map +1 -0
  105. package/dist/core/skills/index.js +24 -0
  106. package/dist/core/skills/index.js.map +1 -0
  107. package/dist/mcp/server.d.ts +9 -9
  108. package/dist/mcp/server.d.ts.map +1 -1
  109. package/dist/mcp/server.js +1 -2
  110. package/dist/mcp/server.js.map +1 -1
  111. package/dist/types/qx.d.ts +39 -7
  112. package/dist/types/qx.d.ts.map +1 -1
  113. package/dist/types/qx.js.map +1 -1
  114. package/dist/visualization/api/RestEndpoints.js +1 -1
  115. package/dist/visualization/api/RestEndpoints.js.map +1 -1
  116. package/package.json +13 -55
@@ -1,529 +1,225 @@
1
1
  ---
2
2
  name: shift-left-testing
3
- description: Move testing activities earlier (left) in software development lifecycle - unit tests, TDD, BDD, design for testability, and CI/CD integration. Use when reducing bug costs, implementing DevOps practices, or enabling continuous deployment.
3
+ description: "Move testing activities earlier in the development lifecycle to catch defects when they're cheapest to fix. Use when implementing TDD, CI/CD, or early quality practices."
4
+ category: testing-methodologies
5
+ priority: high
6
+ tokenEstimate: 900
7
+ agents: [qe-test-generator, qe-requirements-validator, qe-regression-risk-analyzer]
8
+ implementation_status: optimized
9
+ optimization_version: 1.0
10
+ last_optimized: 2025-12-02
11
+ dependencies: []
12
+ quick_reference_card: true
13
+ tags: [shift-left, early-testing, tdd, bdd, ci-cd, prevention]
4
14
  ---
5
15
 
6
16
  # Shift-Left Testing
7
17
 
8
- ## Core Principle
9
-
10
- **Finding bugs earlier reduces cost by 10x-100x.**
11
-
12
- Shift-left testing moves testing activities earlier (left on timeline) in software development lifecycle. The earlier you test, the cheaper bugs are to fix and the faster you can deploy.
13
-
14
- ## What is Shift-Left Testing?
15
-
16
- **Shift-Left:** Moving testing activities earlier (left on timeline) in software development lifecycle.
17
-
18
- **Traditional (Shift-Right):**
19
- ```
20
- Requirements Design Code Test Deploy
21
-
22
- Testing happens here (late, expensive)
23
- ```
24
-
25
- **Shift-Left:**
26
- ```
27
- Requirements → Design → Code → Deploy
28
- ↓ ↓ ↓
29
- Test Test Test (continuous, cheap)
30
- ```
31
-
32
- **Benefits:**
33
- - 10x-100x cost reduction (bugs found early)
34
- - Faster feedback (minutes vs days)
35
- - Better quality (built-in vs bolted-on)
36
- - Confident deployments (continuous validation)
37
-
38
- ## Shift-Left Strategies
39
-
40
- ### Level 1: Traditional Testing
41
-
42
- - Testing after development complete
43
- - Separate QA phase
44
- - Manual testing dominant
45
- - Waterfall approach
46
-
47
- **Cost of Bug:** $1,000-10,000
18
+ <default_to_action>
19
+ When implementing early testing practices:
20
+ 1. VALIDATE requirements before coding (testability, BDD scenarios)
21
+ 2. WRITE tests before implementation (TDD red-green-refactor)
22
+ 3. AUTOMATE in CI pipeline (every commit triggers tests)
23
+ 4. FOLLOW test pyramid: Many unit (70%), some integration (20%), few E2E (10%)
24
+ 5. FIX defects immediately - never let them accumulate
25
+
26
+ **Quick Shift-Left Levels:**
27
+ - Level 1: Unit tests with each PR (developer responsibility)
28
+ - Level 2: TDD practice (tests before code)
29
+ - Level 3: BDD/Example mapping in refinement (requirements testing)
30
+ - Level 4: Risk analysis in design (architecture testing)
31
+
32
+ **Critical Success Factors:**
33
+ - Defects found in requirements cost 1x; in production cost 100x
34
+ - Every commit must run automated tests
35
+ - Quality is built in, not tested in
36
+ </default_to_action>
37
+
38
+ ## Quick Reference Card
39
+
40
+ ### When to Use
41
+ - Reducing cost of defects
42
+ - Implementing CI/CD pipelines
43
+ - Starting TDD practice
44
+ - Improving requirements quality
45
+
46
+ ### Cost of Defects by Phase
47
+ | Phase | Relative Cost | Example |
48
+ |-------|--------------|---------|
49
+ | Requirements | 1x | Fix doc: 30 min |
50
+ | Design | 5x | Redesign: few hours |
51
+ | Development | 10x | Code fix: 1 day |
52
+ | Testing | 20x | Fix + retest: 2 days |
53
+ | Production | 100x | Hotfix + rollback + investigation |
54
+
55
+ ### Test Pyramid
56
+ ```
57
+ /\ E2E (10%) - Critical user journeys
58
+ / \
59
+ / \ Integration (20%) - Component interactions
60
+ / \
61
+ /________\ Unit (70%) - Fast, isolated, comprehensive
62
+ ```
63
+
64
+ ### Shift-Left Levels
65
+ | Level | Practice | When |
66
+ |-------|----------|------|
67
+ | 1 | Unit tests in PR | Before merge |
68
+ | 2 | TDD | Before implementation |
69
+ | 3 | BDD/Example Mapping | During refinement |
70
+ | 4 | Risk Analysis | During design |
48
71
 
49
72
  ---
50
73
 
51
- ### Level 2: Shift-Left (Unit Tests)
52
-
53
- - Developers write unit tests
54
- - TDD practices
55
- - Automated unit tests in CI
56
- - Test coverage metrics
57
-
58
- **Cost of Bug:** $100-1,000 (10x cheaper)
59
-
60
- ```javascript
61
- // Developer writes test BEFORE code (TDD)
62
- test('calculateTotal sums line items', () => {
63
- const items = [{ price: 10 }, { price: 20 }];
64
- expect(calculateTotal(items)).toBe(30);
65
- });
66
-
67
- // Then implements code
68
- function calculateTotal(items) {
69
- return items.reduce((sum, item) => sum + item.price, 0);
70
- }
71
- ```
72
-
73
- **TDD Cycle (Red-Green-Refactor):**
74
- 1. **Red**: Write failing test
75
- 2. **Green**: Write minimal code to pass
76
- 3. **Refactor**: Improve code quality
77
-
78
- ---
79
-
80
- ### Level 3: Shift-Further-Left (Requirements)
81
-
82
- - Testable acceptance criteria
83
- - BDD with Gherkin scenarios
84
- - Executable specifications
85
- - Test cases from requirements
86
-
87
- **Cost of Bug:** $10-100 (100x cheaper)
88
-
89
- ```gherkin
90
- # Specification IS test
91
- Feature: Shopping Cart
92
-
93
- Scenario: Calculate total with tax
94
- Given I have items worth $100
95
- When I apply 10% tax
96
- Then the total should be $110
97
- ```
98
-
99
- **BDD Benefits:**
100
- - Business stakeholders write tests
101
- - Living documentation
102
- - Automated acceptance testing
103
- - Shared understanding
104
-
105
- **Tools:** Cucumber, SpecFlow, Behave
106
-
107
- ---
108
-
109
- ### Level 4: Shift-All-The-Way-Left (Design)
110
-
111
- - Testability in architecture
112
- - Design for testability
113
- - API design reviewed for testing
114
- - Security/performance considered early
115
-
116
- **Cost of Bug:** $1-10 (1000x cheaper)
117
-
118
- ```typescript
119
- // Design decision: Dependency injection for testability
120
- class OrderService {
121
- constructor(
122
- private paymentGateway: PaymentGateway, // Injectable
123
- private emailService: EmailService // Mockable
124
- ) {}
125
-
126
- // Easy to test with mocks
127
- async placeOrder(order: Order) {
128
- await this.paymentGateway.charge(order.total);
129
- await this.emailService.sendConfirmation(order);
130
- }
131
- }
132
-
133
- // Test with mocks (no real payment gateway needed)
134
- test('places order successfully', async () => {
135
- const mockPayment = { charge: jest.fn() };
136
- const mockEmail = { sendConfirmation: jest.fn() };
137
-
138
- const service = new OrderService(mockPayment, mockEmail);
139
- await service.placeOrder({ total: 100 });
140
-
141
- expect(mockPayment.charge).toHaveBeenCalledWith(100);
142
- expect(mockEmail.sendConfirmation).toHaveBeenCalled();
143
- });
144
- ```
145
-
146
- **Design Patterns for Testability:**
147
- - Dependency Injection
148
- - Interface-based design
149
- - Single Responsibility Principle
150
- - Avoid global state
151
- - Pure functions (no side effects)
152
-
153
- ---
154
-
155
- ## Continuous Testing in CI/CD
156
-
157
- ### CI/CD Pipeline with Shift-Left Testing
158
-
159
- **Goal:** Test at every stage, fail fast, high confidence
74
+ ## Level 1: Tests in Every PR
160
75
 
161
76
  ```yaml
162
- # .github/workflows/ci.yml
163
- name: Shift-Left Testing Pipeline
164
-
77
+ # CI pipeline - tests run on every commit
78
+ name: CI
165
79
  on: [push, pull_request]
166
-
167
80
  jobs:
168
- # Stage 1: Fast Feedback (< 5 minutes)
169
- fast-feedback:
170
- runs-on: ubuntu-latest
171
- timeout-minutes: 5
172
- steps:
173
- - uses: actions/checkout@v3
174
-
175
- # Static Analysis (30 seconds)
176
- - name: Lint
177
- run: npm run lint
178
-
179
- - name: Type Check
180
- run: npm run type-check
181
-
182
- # Unit Tests (2 minutes)
183
- - name: Unit Tests
184
- run: npm run test:unit
185
-
186
- - name: Coverage Check
187
- run: npm run coverage -- --threshold 80
188
-
189
- # Stage 2: Integration Tests (< 10 minutes)
190
- integration-tests:
191
- needs: fast-feedback
81
+ test:
192
82
  runs-on: ubuntu-latest
193
- timeout-minutes: 10
194
83
  steps:
195
- - uses: actions/checkout@v3
196
-
197
- # Integration Tests (5 minutes)
198
- - name: Integration Tests
199
- run: npm run test:integration
200
-
201
- # Security Scanning (3 minutes)
202
- - name: Security Scan
203
- run: npm audit && npm run security:scan
204
-
205
- # Stage 3: E2E Tests (< 15 minutes)
206
- e2e-tests:
207
- needs: integration-tests
208
- runs-on: ubuntu-latest
209
- timeout-minutes: 15
210
- steps:
211
- - uses: actions/checkout@v3
212
-
213
- # E2E Tests (10 minutes)
214
- - name: E2E Tests with Playwright
215
- run: npm run test:e2e
216
-
217
- # Performance Tests (5 minutes)
218
- - name: Performance Tests
219
- run: npm run test:performance
220
-
221
- # Stage 4: Deploy to Staging
222
- deploy-staging:
223
- needs: e2e-tests
224
- if: github.ref == 'refs/heads/main'
84
+ - uses: actions/checkout@v4
85
+ - run: npm ci
86
+ - run: npm run test:unit
87
+ - run: npm run test:integration
88
+ - run: npm run lint
89
+
90
+ quality-gate:
91
+ needs: test
225
92
  steps:
226
- - name: Deploy to Staging
227
- run: ./deploy.sh staging
228
-
229
- # Smoke Tests on Staging
230
- - name: Smoke Tests
231
- run: npm run test:smoke -- --env=staging
93
+ - name: Coverage Check
94
+ run: npx coverage-check --min 80
95
+ - name: No New Warnings
96
+ run: npm run lint -- --max-warnings 0
232
97
  ```
233
98
 
234
- **Pipeline Best Practices:**
235
- 1. **Fail Fast**: Run fastest tests first (lint, unit)
236
- 2. **Parallel Execution**: Run independent tests concurrently
237
- 3. **Clear Feedback**: Immediate notification on failures
238
- 4. **Incremental Testing**: Only run affected tests when possible
239
- 5. **Quality Gates**: Block merges on test failures
240
-
241
99
  ---
242
100
 
243
- ## Test Pyramid (Shift-Left Strategy)
244
-
245
- ```
246
- /\
247
- /E2E\ Few (slow, expensive, brittle)
248
- /------\
249
- / Int. \ Some (moderate speed/cost)
250
- /----------\
251
- / Unit \ Many (fast, cheap, reliable)
252
- /--------------\
253
- ```
254
-
255
- **Unit Tests (Base):**
256
- - 70-80% of tests
257
- - Milliseconds execution
258
- - Test individual functions/classes
259
- - High coverage, low cost
260
-
261
- **Integration Tests (Middle):**
262
- - 15-20% of tests
263
- - Seconds execution
264
- - Test component interactions
265
- - Database, API, services
266
-
267
- **E2E Tests (Top):**
268
- - 5-10% of tests
269
- - Minutes execution
270
- - Test critical user journeys
271
- - Full stack, realistic scenarios
272
-
273
- **Shift-Left Impact:**
274
- Most testing happens at UNIT level (early, cheap, fast).
101
+ ## Level 2: TDD Practice
275
102
 
276
- ---
277
-
278
- ## Shift-Left Practices
279
-
280
- ### 1. Test-Driven Development (TDD)
281
-
282
- **Process:**
283
103
  ```javascript
284
- // 1. RED: Write failing test
285
- test('validates email format', () => {
286
- expect(isValidEmail('invalid')).toBe(false);
287
- expect(isValidEmail('user@example.com')).toBe(true);
104
+ // Red: Write failing test first
105
+ test('calculates discount for orders over $100', () => {
106
+ const order = new Order([{ price: 150 }]);
107
+ expect(order.discount).toBe(15); // 10% off
288
108
  });
289
109
 
290
- // 2. GREEN: Minimal implementation
291
- function isValidEmail(email) {
292
- return email.includes('@'); // Simple, passes test
110
+ // Green: Minimal implementation
111
+ class Order {
112
+ get discount() {
113
+ return this.total > 100 ? this.total * 0.1 : 0;
114
+ }
293
115
  }
294
116
 
295
- // 3. REFACTOR: Improve implementation
296
- function isValidEmail(email) {
297
- const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
298
- return regex.test(email);
299
- }
117
+ // Refactor: Improve while keeping green
300
118
  ```
301
119
 
302
- **Benefits:**
303
- - Better design (testable by default)
304
- - Complete test coverage
305
- - Confident refactoring
306
- - Living documentation
307
-
308
120
  ---
309
121
 
310
- ### 2. Behavior-Driven Development (BDD)
122
+ ## Level 3: BDD in Refinement
311
123
 
312
- **Process:**
313
124
  ```gherkin
314
- # Business writes this (executable spec)
315
- Feature: User Registration
316
-
317
- Scenario: New user signs up successfully
318
- Given I am on the registration page
319
- When I enter valid email "user@example.com"
320
- And I enter password "SecurePass123"
321
- And I click "Sign Up"
322
- Then I should see "Welcome"
323
- And I should receive a confirmation email
324
- ```
125
+ # Example mapping before coding
126
+ Feature: Loyalty Discount
127
+ Scenario: Gold member gets 15% discount
128
+ Given a customer with "gold" membership
129
+ When they checkout with $200 in cart
130
+ Then discount applied is $30
131
+ And order total is $170
325
132
 
326
- **Implementation:**
327
- ```typescript
328
- // Developer implements step definitions
329
- Given('I am on the registration page', async () => {
330
- await page.goto('/register');
331
- });
332
-
333
- When('I enter valid email {string}', async (email: string) => {
334
- await page.fill('[data-test=email]', email);
335
- });
336
-
337
- // ... more step definitions
133
+ Scenario: New customer gets no discount
134
+ Given a customer with no membership
135
+ When they checkout with $200 in cart
136
+ Then no discount is applied
338
137
  ```
339
138
 
340
- **Benefits:**
341
- - Shared language (business + dev)
342
- - Testable requirements
343
- - Automated acceptance tests
344
- - Reduced misunderstandings
345
-
346
139
  ---
347
140
 
348
- ### 3. Design for Testability
141
+ ## Level 4: Risk Analysis in Design
349
142
 
350
- **Principles:**
351
-
352
- **a) Dependency Injection**
353
143
  ```typescript
354
- // Hard to test (tight coupling)
355
- class UserService {
356
- async createUser(data) {
357
- const db = new Database(); // Hard-coded dependency
358
- return db.insert('users', data);
359
- }
360
- }
361
-
362
- // ✅ Easy to test (loose coupling)
363
- class UserService {
364
- constructor(private db: Database) {}
144
+ // During architecture review
145
+ await Task("Risk Analysis", {
146
+ phase: 'design',
147
+ component: 'payment-service',
148
+ questions: [
149
+ 'What happens when payment gateway times out?',
150
+ 'How do we handle duplicate submissions?',
151
+ 'What if inventory changed during checkout?'
152
+ ]
153
+ }, "qe-requirements-validator");
365
154
 
366
- async createUser(data) {
367
- return this.db.insert('users', data);
368
- }
369
- }
370
-
371
- // Test with mock
372
- const mockDb = { insert: jest.fn() };
373
- const service = new UserService(mockDb);
155
+ // Output: Testability requirements, failure mode tests
374
156
  ```
375
157
 
376
- **b) Pure Functions**
377
- ```typescript
378
- // ❌ Hard to test (side effects, global state)
379
- let total = 0;
380
- function addToTotal(amount) {
381
- total += amount; // Modifies global state
382
- return total;
383
- }
158
+ ---
384
159
 
385
- // Easy to test (pure, no side effects)
386
- function calculateTotal(current, amount) {
387
- return current + amount;
388
- }
160
+ ## Agent-Assisted Shift-Left
389
161
 
390
- test('adds amounts correctly', () => {
391
- expect(calculateTotal(100, 50)).toBe(150);
392
- expect(calculateTotal(0, 10)).toBe(10);
393
- });
394
- ```
395
-
396
- **c) Single Responsibility**
397
162
  ```typescript
398
- // Hard to test (multiple responsibilities)
399
- class OrderProcessor {
400
- processOrder(order) {
401
- this.validateOrder(order);
402
- this.chargePayment(order);
403
- this.sendEmail(order);
404
- this.updateInventory(order);
405
- // Too many responsibilities!
406
- }
407
- }
408
-
409
- // ✅ Easy to test (single responsibility)
410
- class OrderValidator {
411
- validate(order) { /* ... */ }
412
- }
413
-
414
- class PaymentService {
415
- charge(order) { /* ... */ }
416
- }
417
-
418
- class EmailService {
419
- sendConfirmation(order) { /* ... */ }
420
- }
421
-
422
- // Each class has one reason to change, one thing to test
163
+ // Validate requirements testability
164
+ await Task("Requirements Validation", {
165
+ requirements: userStories,
166
+ check: ['INVEST-criteria', 'testability', 'ambiguity'],
167
+ generateBDD: true
168
+ }, "qe-requirements-validator");
169
+
170
+ // Generate tests from requirements
171
+ await Task("Generate Tests", {
172
+ source: 'requirements',
173
+ types: ['unit', 'integration', 'e2e'],
174
+ coverage: 'comprehensive'
175
+ }, "qe-test-generator");
176
+
177
+ // Smart test selection for changes
178
+ await Task("Select Regression Tests", {
179
+ changedFiles: prFiles,
180
+ algorithm: 'risk-based',
181
+ targetReduction: 0.7 // 70% time savings
182
+ }, "qe-regression-risk-analyzer");
423
183
  ```
424
184
 
425
185
  ---
426
186
 
427
- ## Shift-Left Metrics
428
-
429
- **Track Effectiveness:**
430
-
431
- **1. Defect Detection Percentage (DDP)**
432
- ```
433
- DDP = (Defects found in phase / Total defects) × 100
434
-
435
- Target: 80%+ defects found before production
436
- ```
437
-
438
- **2. Test Coverage**
439
- ```
440
- Coverage = (Lines covered / Total lines) × 100
441
-
442
- Target: 80%+ for unit tests
443
- ```
187
+ ## Agent Coordination Hints
444
188
 
445
- **3. Time to Feedback**
189
+ ### Memory Namespace
446
190
  ```
447
- Feedback Time = Time from commit to test results
448
-
449
- Target: < 10 minutes for unit tests
450
- < 30 minutes for integration tests
451
- < 60 minutes for E2E tests
191
+ aqe/shift-left/
192
+ ├── requirements/* - Validated requirements
193
+ ├── generated-tests/* - Auto-generated tests
194
+ ├── coverage-targets/* - Coverage goals by component
195
+ └── pipeline-results/* - CI/CD test history
452
196
  ```
453
197
 
454
- **4. Cost of Defects**
455
- ```
456
- Track cost by phase discovered:
457
- - Requirements: $1-10
458
- - Development: $100-1,000
459
- - QA: $1,000-10,000
460
- - Production: $10,000-100,000+
198
+ ### Fleet Coordination
199
+ ```typescript
200
+ const shiftLeftFleet = await FleetManager.coordinate({
201
+ strategy: 'shift-left',
202
+ agents: [
203
+ 'qe-requirements-validator', // Level 3-4
204
+ 'qe-test-generator', // Level 2
205
+ 'qe-regression-risk-analyzer' // Smart selection
206
+ ],
207
+ topology: 'sequential'
208
+ });
461
209
  ```
462
210
 
463
211
  ---
464
212
 
465
- ## Tools for Shift-Left Testing
466
-
467
- **Unit Testing:**
468
- - Jest, Mocha, Vitest (JavaScript)
469
- - JUnit, TestNG (Java)
470
- - pytest (Python)
471
- - RSpec (Ruby)
472
-
473
- **BDD Frameworks:**
474
- - Cucumber, SpecFlow (Gherkin)
475
- - Behave (Python)
476
- - Jasmine (JavaScript)
477
-
478
- **CI/CD Platforms:**
479
- - GitHub Actions
480
- - GitLab CI
481
- - Jenkins
482
- - CircleCI
483
- - Travis CI
484
-
485
- **Code Quality:**
486
- - ESLint, SonarQube
487
- - Code coverage (Jest, Istanbul, c8)
488
- - Static analysis (TypeScript, Flow)
489
-
490
- ---
491
-
492
213
  ## Related Skills
493
-
494
- **Core Testing:**
495
- - [test-automation-strategy](../test-automation-strategy/)
496
- - [tdd-london-chicago](../tdd-london-chicago/)
497
- - [regression-testing](../regression-testing/)
498
-
499
- **DevOps:**
500
- - [shift-right-testing](../shift-right-testing/) - Testing IN production
501
- - [test-design-techniques](../test-design-techniques/)
502
- - [mutation-testing](../mutation-testing/)
503
-
504
- **Complementary:**
505
- - [shift-right-testing](../shift-right-testing/) - Production validation (the other half)
214
+ - [tdd-london-chicago](../tdd-london-chicago/) - TDD practices
215
+ - [holistic-testing-pact](../holistic-testing-pact/) - Proactive testing
216
+ - [cicd-pipeline-qe-orchestrator](../cicd-pipeline-qe-orchestrator/) - Pipeline integration
217
+ - [shift-right-testing](../shift-right-testing/) - Production feedback
506
218
 
507
219
  ---
508
220
 
509
221
  ## Remember
510
222
 
511
- **The earlier you find bugs, the cheaper they are to fix.**
512
-
513
- **Cost by Phase:**
514
- - Design/Requirements: $1-10
515
- - Development (unit tests): $100-1,000
516
- - QA/Integration: $1,000-10,000
517
- - Production: $10,000-100,000+
518
-
519
- **Shift-Left = 10x-100x cost reduction**
520
-
521
- **Best Practices:**
522
- 1. Write tests BEFORE code (TDD)
523
- 2. Make requirements testable (BDD)
524
- 3. Design for testability (DI, pure functions)
525
- 4. Automate everything (CI/CD)
526
- 5. Fail fast (run fastest tests first)
527
- 6. Test pyramid (many unit, few E2E)
223
+ **Earlier = Cheaper.** Requirements defects cost 1x; production defects cost 100x. Test pyramid: 70% unit, 20% integration, 10% E2E. Every commit runs tests. TDD builds quality in.
528
224
 
529
- **With Agents:** `qe-test-generator` automatically generates shift-left tests (unit, integration) during development. `qe-regression-risk-analyzer` selects which tests to run based on code changes. Together, they enable true shift-left automation with minimal developer effort.
225
+ **With Agents:** Agents validate requirements testability, generate tests from specs, and select optimal regression suites. Use agents to implement shift-left practices consistently.