@champpaba/claude-agent-kit 1.0.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.
- package/LICENSE +21 -0
- package/README.md +561 -0
- package/bin/cli.js +61 -0
- package/lib/init.js +52 -0
- package/lib/update.js +73 -0
- package/package.json +47 -0
- package/template/.claude/CHANGELOG-v1.1.1.md +259 -0
- package/template/.claude/CLAUDE.md +329 -0
- package/template/.claude/agents/01-integration.md +797 -0
- package/template/.claude/agents/02-uxui-frontend.md +899 -0
- package/template/.claude/agents/03-test-debug.md +759 -0
- package/template/.claude/agents/04-frontend.md +1099 -0
- package/template/.claude/agents/05-backend.md +1217 -0
- package/template/.claude/agents/06-database.md +969 -0
- package/template/.claude/commands/agentsetup.md +1464 -0
- package/template/.claude/commands/cdev.md +327 -0
- package/template/.claude/commands/csetup.md +447 -0
- package/template/.claude/commands/cstatus.md +60 -0
- package/template/.claude/commands/cview.md +364 -0
- package/template/.claude/commands/psetup.md +101 -0
- package/template/.claude/contexts/design/accessibility.md +611 -0
- package/template/.claude/contexts/design/box-thinking.md +553 -0
- package/template/.claude/contexts/design/color-theory.md +498 -0
- package/template/.claude/contexts/design/index.md +247 -0
- package/template/.claude/contexts/design/layout.md +400 -0
- package/template/.claude/contexts/design/responsive.md +551 -0
- package/template/.claude/contexts/design/shadows.md +522 -0
- package/template/.claude/contexts/design/spacing.md +428 -0
- package/template/.claude/contexts/design/typography.md +465 -0
- package/template/.claude/contexts/domain/README.md +164 -0
- package/template/.claude/contexts/patterns/agent-coordination.md +388 -0
- package/template/.claude/contexts/patterns/agent-discovery.md +182 -0
- package/template/.claude/contexts/patterns/change-workflow.md +538 -0
- package/template/.claude/contexts/patterns/code-standards.md +515 -0
- package/template/.claude/contexts/patterns/development-principles.md +513 -0
- package/template/.claude/contexts/patterns/error-handling.md +478 -0
- package/template/.claude/contexts/patterns/error-recovery.md +365 -0
- package/template/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
- package/template/.claude/contexts/patterns/git-workflow.md +207 -0
- package/template/.claude/contexts/patterns/logging.md +424 -0
- package/template/.claude/contexts/patterns/task-breakdown.md +452 -0
- package/template/.claude/contexts/patterns/task-classification.md +523 -0
- package/template/.claude/contexts/patterns/tdd-classification.md +516 -0
- package/template/.claude/contexts/patterns/testing.md +413 -0
- package/template/.claude/contexts/patterns/ui-component-consistency.md +304 -0
- package/template/.claude/contexts/patterns/validation-framework.md +776 -0
- package/template/.claude/lib/README.md +39 -0
- package/template/.claude/lib/agent-executor.md +258 -0
- package/template/.claude/lib/agent-router.md +572 -0
- package/template/.claude/lib/flags-updater.md +469 -0
- package/template/.claude/lib/tdd-classifier.md +345 -0
- package/template/.claude/lib/validation-gates.md +484 -0
- package/template/.claude/settings.local.json +42 -0
- package/template/.claude/templates/context-template.md +45 -0
- package/template/.claude/templates/flags-template.json +42 -0
- package/template/.claude/templates/phase-templates.json +124 -0
- package/template/.claude/templates/phases-sections/accessibility-test.md +17 -0
- package/template/.claude/templates/phases-sections/api-design.md +37 -0
- package/template/.claude/templates/phases-sections/backend-tests.md +16 -0
- package/template/.claude/templates/phases-sections/backend.md +37 -0
- package/template/.claude/templates/phases-sections/business-logic-validation.md +16 -0
- package/template/.claude/templates/phases-sections/component-tests.md +17 -0
- package/template/.claude/templates/phases-sections/contract-backend.md +16 -0
- package/template/.claude/templates/phases-sections/contract-frontend.md +16 -0
- package/template/.claude/templates/phases-sections/database.md +35 -0
- package/template/.claude/templates/phases-sections/documentation.md +17 -0
- package/template/.claude/templates/phases-sections/e2e-tests.md +16 -0
- package/template/.claude/templates/phases-sections/fix-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/frontend-integration.md +18 -0
- package/template/.claude/templates/phases-sections/frontend-mockup.md +123 -0
- package/template/.claude/templates/phases-sections/manual-flow-test.md +15 -0
- package/template/.claude/templates/phases-sections/manual-ux-test.md +16 -0
- package/template/.claude/templates/phases-sections/refactor-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/refactor.md +16 -0
- package/template/.claude/templates/phases-sections/regression-tests.md +15 -0
- package/template/.claude/templates/phases-sections/report.md +16 -0
- package/template/.claude/templates/phases-sections/responsive-test.md +16 -0
- package/template/.claude/templates/phases-sections/script-implementation.md +43 -0
- package/template/.claude/templates/phases-sections/test-coverage.md +16 -0
- package/template/.claude/templates/phases-sections/user-approval.md +14 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
# Task Breakdown Methodology
|
|
2
|
+
|
|
3
|
+
**Core Principle:** Small → Test → Fix → Scale → Deploy (Incremental Development)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 4-Phase Methodology
|
|
8
|
+
|
|
9
|
+
**NEVER jump straight to full-scale implementation.**
|
|
10
|
+
|
|
11
|
+
**Always follow this progression:**
|
|
12
|
+
|
|
13
|
+
1. **Phase 1: MVT (Minimum Viable Test)** - Start small (1 item)
|
|
14
|
+
2. **Phase 2: Complexity** - Add validation and edge cases (2-3 items)
|
|
15
|
+
3. **Phase 3: Scale** - Full implementation (5-15 items)
|
|
16
|
+
4. **Phase 4: Deploy** - Production readiness and monitoring
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Phase 1: MVT (Minimum Viable Test)
|
|
21
|
+
|
|
22
|
+
**Goal:** Prove the concept works with **1 simple case** before scaling
|
|
23
|
+
|
|
24
|
+
### Characteristics
|
|
25
|
+
|
|
26
|
+
- ✅ **Single item/entity** (1 question, 1 user, 1 product)
|
|
27
|
+
- ✅ **Happy path only** (no edge cases yet)
|
|
28
|
+
- ✅ **Minimal validation** (basic checks only)
|
|
29
|
+
- ✅ **Quick iteration** (< 1 hour to complete)
|
|
30
|
+
- ✅ **Logged** (basic observability)
|
|
31
|
+
|
|
32
|
+
### Example: E-commerce Product Creation
|
|
33
|
+
|
|
34
|
+
**❌ Wrong Approach (jumping to scale):**
|
|
35
|
+
```
|
|
36
|
+
Task: Implement product creation with:
|
|
37
|
+
- 5 categories
|
|
38
|
+
- 10 fields per product
|
|
39
|
+
- Image uploads
|
|
40
|
+
- Price validation
|
|
41
|
+
- Inventory management
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**✅ Correct MVT (Phase 1):**
|
|
45
|
+
```
|
|
46
|
+
Task 1.1: Create single product with 2 fields (name, price)
|
|
47
|
+
Task 1.2: Test with 1 product → Verify database insert
|
|
48
|
+
Task 1.3: Log operation (product_created event)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example: IELTS Audio Recording
|
|
52
|
+
|
|
53
|
+
**❌ Wrong:**
|
|
54
|
+
```
|
|
55
|
+
Implement Part 1, 2, 3 with all questions
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**✅ Correct MVT:**
|
|
59
|
+
```
|
|
60
|
+
Task 1.1: Record 1 question (Part 1, Question 1)
|
|
61
|
+
Task 1.2: Submit audio to API
|
|
62
|
+
Task 1.3: Get score and display
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Phase 2: Complexity
|
|
68
|
+
|
|
69
|
+
**Goal:** Add validation, error handling, and edge cases with **2-3 items**
|
|
70
|
+
|
|
71
|
+
### Characteristics
|
|
72
|
+
|
|
73
|
+
- ✅ **2-3 items/entities** (2-3 questions, 2-3 products)
|
|
74
|
+
- ✅ **Input validation** (Zod/Pydantic schemas)
|
|
75
|
+
- ✅ **Error handling** (try-catch with specific errors)
|
|
76
|
+
- ✅ **Edge cases** (empty input, duplicates, invalid data)
|
|
77
|
+
- ✅ **Comprehensive logging** (errors + success paths)
|
|
78
|
+
|
|
79
|
+
### Example: E-commerce Product Creation
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Phase 2: Complexity (2-3 products)
|
|
83
|
+
|
|
84
|
+
Task 2.1: Add Zod validation schema
|
|
85
|
+
- name: min 3 chars, max 100 chars
|
|
86
|
+
- price: positive number, max 2 decimals
|
|
87
|
+
- Test with invalid inputs (empty name, negative price)
|
|
88
|
+
|
|
89
|
+
Task 2.2: Add error handling
|
|
90
|
+
- Duplicate product name → 409 Conflict
|
|
91
|
+
- Invalid input → 400 Bad Request
|
|
92
|
+
- Database error → 500 Internal Server Error
|
|
93
|
+
|
|
94
|
+
Task 2.3: Test with 2-3 products
|
|
95
|
+
- Valid products
|
|
96
|
+
- Duplicate names
|
|
97
|
+
- Invalid prices
|
|
98
|
+
|
|
99
|
+
Task 2.4: Add logging
|
|
100
|
+
- product_validation_error
|
|
101
|
+
- product_duplicate_error
|
|
102
|
+
- product_created_success
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Example: IELTS Audio Recording
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
Phase 2: Complexity (2-3 questions)
|
|
109
|
+
|
|
110
|
+
Task 2.1: Add audio validation
|
|
111
|
+
- Duration: 30-45s for Part 1
|
|
112
|
+
- File size: < 1.5 MB
|
|
113
|
+
- MIME type: audio/webm, audio/mp3
|
|
114
|
+
|
|
115
|
+
Task 2.2: Add error handling
|
|
116
|
+
- Permission denied → Show clear message
|
|
117
|
+
- File too large → Show size limit
|
|
118
|
+
- Network error → Retry logic
|
|
119
|
+
|
|
120
|
+
Task 2.3: Test with 2-3 questions
|
|
121
|
+
- Valid recordings
|
|
122
|
+
- Too short (<30s)
|
|
123
|
+
- Too long (>45s)
|
|
124
|
+
- Permission denied
|
|
125
|
+
|
|
126
|
+
Task 2.4: Add comprehensive logging
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Phase 3: Scale
|
|
132
|
+
|
|
133
|
+
**Goal:** Full implementation with **5-15 items** and complete workflows
|
|
134
|
+
|
|
135
|
+
### Characteristics
|
|
136
|
+
|
|
137
|
+
- ✅ **Full scale** (all questions, all products, all features)
|
|
138
|
+
- ✅ **Complete workflows** (entire user journey)
|
|
139
|
+
- ✅ **Performance optimization** (pagination, caching)
|
|
140
|
+
- ✅ **Integration tests** (end-to-end flows)
|
|
141
|
+
- ✅ **Production-like data** (realistic volumes)
|
|
142
|
+
|
|
143
|
+
### Example: E-commerce Product Catalog
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
Phase 3: Scale (Full catalog)
|
|
147
|
+
|
|
148
|
+
Task 3.1: Implement all product categories (5-10 categories)
|
|
149
|
+
Task 3.2: Add all product fields (name, price, description, images, inventory)
|
|
150
|
+
Task 3.3: Add image upload to cloud storage
|
|
151
|
+
Task 3.4: Add pagination (20 products per page)
|
|
152
|
+
Task 3.5: Add filtering (by category, price range)
|
|
153
|
+
Task 3.6: Add sorting (by price, date, name)
|
|
154
|
+
Task 3.7: Integration tests (create → list → filter → update → delete)
|
|
155
|
+
Task 3.8: Performance testing (100+ products)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Example: IELTS Complete Test
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Phase 3: Scale (All 3 parts)
|
|
162
|
+
|
|
163
|
+
Task 3.1: Implement Part 1 (5 questions)
|
|
164
|
+
Task 3.2: Implement Part 2 (1 long turn with cue card)
|
|
165
|
+
Task 3.3: Implement Part 3 (5-6 discussion questions)
|
|
166
|
+
Task 3.4: Add progress tracking (current part, question number)
|
|
167
|
+
Task 3.5: Add timer per part
|
|
168
|
+
Task 3.6: Add session state management
|
|
169
|
+
Task 3.7: Integration tests (Part 1 → Part 2 → Part 3 → Complete)
|
|
170
|
+
Task 3.8: Performance testing (audio processing latency)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Phase 4: Deploy (Production Readiness)
|
|
176
|
+
|
|
177
|
+
**Goal:** Monitoring, documentation, cleanup, and deployment
|
|
178
|
+
|
|
179
|
+
### Characteristics
|
|
180
|
+
|
|
181
|
+
- ✅ **E2E tests** (complete user flows in real browser)
|
|
182
|
+
- ✅ **Performance benchmarks** (latency, throughput)
|
|
183
|
+
- ✅ **Documentation** (README, API docs, JSDoc)
|
|
184
|
+
- ✅ **Code review checklist** (standards, best practices)
|
|
185
|
+
- ✅ **Error monitoring** (Sentry, LogRocket)
|
|
186
|
+
- ✅ **Deployment checklist** (env vars, migrations)
|
|
187
|
+
- ✅ **Cleanup** (remove temp files, commented code)
|
|
188
|
+
|
|
189
|
+
### Standard Phase 4 Tasks
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
Phase 4: Production Readiness
|
|
193
|
+
|
|
194
|
+
Task 4.1: E2E Tests (Playwright)
|
|
195
|
+
- Complete user journey (signup → login → use feature → logout)
|
|
196
|
+
- Edge cases (network errors, timeouts)
|
|
197
|
+
- Cross-browser (Chrome, Firefox, Safari)
|
|
198
|
+
|
|
199
|
+
Task 4.2: Performance Testing
|
|
200
|
+
- API response time < 200ms (p95)
|
|
201
|
+
- Page load time < 2s
|
|
202
|
+
- Database query optimization (N+1 prevention)
|
|
203
|
+
|
|
204
|
+
Task 4.3: Browser Compatibility
|
|
205
|
+
- Chrome (latest)
|
|
206
|
+
- Firefox (latest)
|
|
207
|
+
- Safari (latest)
|
|
208
|
+
- Mobile browsers (iOS Safari, Chrome Mobile)
|
|
209
|
+
|
|
210
|
+
Task 4.4: Error Monitoring Setup
|
|
211
|
+
- Sentry integration (frontend + backend)
|
|
212
|
+
- Error tracking dashboard
|
|
213
|
+
- Alert thresholds (>10 errors/minute)
|
|
214
|
+
|
|
215
|
+
Task 4.5: Documentation
|
|
216
|
+
- README.md (setup, usage, deployment)
|
|
217
|
+
- API documentation (OpenAPI/Swagger)
|
|
218
|
+
- JSDoc comments on public APIs
|
|
219
|
+
|
|
220
|
+
Task 4.6: Code Review Checklist
|
|
221
|
+
- ✅ All tests passing (unit + integration + E2E)
|
|
222
|
+
- ✅ Test coverage > 85%
|
|
223
|
+
- ✅ All operations logged
|
|
224
|
+
- ✅ Type safety (no 'any' types)
|
|
225
|
+
- ✅ No console.log statements (use logger)
|
|
226
|
+
- ✅ Error handling for all async operations
|
|
227
|
+
|
|
228
|
+
Task 4.7: OpenSpec Validation (if applicable)
|
|
229
|
+
- Run: openspec validate --strict
|
|
230
|
+
- Fix all validation errors
|
|
231
|
+
- Archive change proposal
|
|
232
|
+
|
|
233
|
+
Task 4.8: Deployment Checklist
|
|
234
|
+
- Environment variables configured
|
|
235
|
+
- Database migrations applied
|
|
236
|
+
- CI/CD pipeline configured
|
|
237
|
+
- Rollback plan documented
|
|
238
|
+
|
|
239
|
+
Task 4.9: Cleanup
|
|
240
|
+
- Remove temporary files (test-*.ts, debug-*.js)
|
|
241
|
+
- Remove commented code
|
|
242
|
+
- Remove unused imports
|
|
243
|
+
- Run lint and fix all errors
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## TDD Strategy
|
|
249
|
+
|
|
250
|
+
### When to Use TDD (REQUIRED)
|
|
251
|
+
|
|
252
|
+
✅ **Use TDD Test-First for critical code:**
|
|
253
|
+
- Business logic (calculations, transformations)
|
|
254
|
+
- API endpoints (validation, error handling)
|
|
255
|
+
- External service integrations
|
|
256
|
+
- Data transformations
|
|
257
|
+
- Complex algorithms
|
|
258
|
+
|
|
259
|
+
⚠️ **Test-Alongside OK for:**
|
|
260
|
+
- Simple CRUD operations
|
|
261
|
+
- UI components (presentational)
|
|
262
|
+
- Configuration files
|
|
263
|
+
- Trivial utilities
|
|
264
|
+
|
|
265
|
+
### TDD Workflow (Red-Green-Refactor)
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
1. RED Phase - Write the test first
|
|
269
|
+
→ Define expected behavior before implementation
|
|
270
|
+
→ Run test → Verify it FAILS
|
|
271
|
+
|
|
272
|
+
2. GREEN Phase - Write minimal code
|
|
273
|
+
→ Just enough to make the test pass
|
|
274
|
+
→ Run test → Verify it PASSES
|
|
275
|
+
|
|
276
|
+
3. REFACTOR Phase - Improve the code
|
|
277
|
+
→ Add logging
|
|
278
|
+
→ Add error handling
|
|
279
|
+
→ Optimize performance
|
|
280
|
+
→ Run test → Verify still PASSES
|
|
281
|
+
|
|
282
|
+
4. REPEAT - One test at a time
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### TDD Example: Calculate Band Score
|
|
286
|
+
|
|
287
|
+
**Red Phase:**
|
|
288
|
+
```typescript
|
|
289
|
+
// tests/unit/scoring.test.ts
|
|
290
|
+
import { describe, it, expect } from 'vitest'
|
|
291
|
+
import { calculateBandScore } from '@/lib/scoring'
|
|
292
|
+
|
|
293
|
+
describe('calculateBandScore', () => {
|
|
294
|
+
it('should convert 85% to IELTS 7.5', () => {
|
|
295
|
+
const result = calculateBandScore(85)
|
|
296
|
+
expect(result).toBe(7.5)
|
|
297
|
+
})
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
// Run test → FAILS (function doesn't exist yet)
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Green Phase:**
|
|
304
|
+
```typescript
|
|
305
|
+
// lib/scoring.ts
|
|
306
|
+
export function calculateBandScore(speechaceScore: number): number {
|
|
307
|
+
// Minimal implementation (hardcoded for now)
|
|
308
|
+
return 7.5
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Run test → PASSES
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Refactor Phase:**
|
|
315
|
+
```typescript
|
|
316
|
+
// lib/scoring.ts
|
|
317
|
+
import { logger } from '@/lib/logger'
|
|
318
|
+
|
|
319
|
+
export function calculateBandScore(speechaceScore: number): number {
|
|
320
|
+
// Proper implementation
|
|
321
|
+
const bandScore = Math.round((speechaceScore / 100) * 9 * 2) / 2
|
|
322
|
+
|
|
323
|
+
// Add logging
|
|
324
|
+
logger.info('band_score_calculated', {
|
|
325
|
+
speechaceScore,
|
|
326
|
+
bandScore
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
return bandScore
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Run test → PASSES
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Add More Tests:**
|
|
336
|
+
```typescript
|
|
337
|
+
it('should convert 60% to IELTS 5.5', () => {
|
|
338
|
+
expect(calculateBandScore(60)).toBe(5.5)
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
it('should throw on invalid input', () => {
|
|
342
|
+
expect(() => calculateBandScore(-1)).toThrow('Invalid score')
|
|
343
|
+
expect(() => calculateBandScore(101)).toThrow('Invalid score')
|
|
344
|
+
})
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Task Breakdown Examples
|
|
350
|
+
|
|
351
|
+
### Example 1: User Authentication
|
|
352
|
+
|
|
353
|
+
**❌ Wrong (monolithic):**
|
|
354
|
+
```
|
|
355
|
+
Task: Implement complete authentication system
|
|
356
|
+
- Login, signup, forgot password, email verification
|
|
357
|
+
- OAuth (Google, GitHub)
|
|
358
|
+
- 2FA
|
|
359
|
+
- Session management
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
**✅ Correct (4-phase):**
|
|
363
|
+
```
|
|
364
|
+
Phase 1: MVT (1 user)
|
|
365
|
+
- Task 1.1: Login with email/password (1 user)
|
|
366
|
+
- Task 1.2: Session creation
|
|
367
|
+
- Task 1.3: Protected route check
|
|
368
|
+
|
|
369
|
+
Phase 2: Complexity (2-3 users)
|
|
370
|
+
- Task 2.1: Add validation (email format, password strength)
|
|
371
|
+
- Task 2.2: Error handling (invalid credentials, expired session)
|
|
372
|
+
- Task 2.3: Test with 2-3 users (valid, invalid, edge cases)
|
|
373
|
+
|
|
374
|
+
Phase 3: Scale (Full features)
|
|
375
|
+
- Task 3.1: Signup flow
|
|
376
|
+
- Task 3.2: Forgot password
|
|
377
|
+
- Task 3.3: Email verification
|
|
378
|
+
- Task 3.4: Session persistence (cookies, localStorage)
|
|
379
|
+
|
|
380
|
+
Phase 4: Deploy
|
|
381
|
+
- Task 4.1: E2E tests (signup → login → protected route)
|
|
382
|
+
- Task 4.2: Security audit (SQL injection, XSS)
|
|
383
|
+
- Task 4.3: Documentation (API endpoints, error codes)
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
### Example 2: Search Functionality
|
|
389
|
+
|
|
390
|
+
**❌ Wrong:**
|
|
391
|
+
```
|
|
392
|
+
Task: Implement search with filters, sorting, pagination
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**✅ Correct:**
|
|
396
|
+
```
|
|
397
|
+
Phase 1: MVT (1 result)
|
|
398
|
+
- Task 1.1: Basic search (exact match, 1 result)
|
|
399
|
+
- Task 1.2: Display result
|
|
400
|
+
|
|
401
|
+
Phase 2: Complexity (2-3 results)
|
|
402
|
+
- Task 2.1: Fuzzy matching
|
|
403
|
+
- Task 2.2: Highlighting search terms
|
|
404
|
+
- Task 2.3: Empty state handling
|
|
405
|
+
|
|
406
|
+
Phase 3: Scale (100+ results)
|
|
407
|
+
- Task 3.1: Pagination (20 per page)
|
|
408
|
+
- Task 3.2: Filters (category, price, date)
|
|
409
|
+
- Task 3.3: Sorting (relevance, price, date)
|
|
410
|
+
- Task 3.4: Performance optimization (debounce, caching)
|
|
411
|
+
|
|
412
|
+
Phase 4: Deploy
|
|
413
|
+
- Task 4.1: E2E tests (search → filter → sort → paginate)
|
|
414
|
+
- Task 4.2: Performance testing (1000+ results)
|
|
415
|
+
- Task 4.3: Analytics (search queries, click-through rates)
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Quick Reference
|
|
421
|
+
|
|
422
|
+
| Phase | Items | Focus | Duration |
|
|
423
|
+
|-------|-------|-------|----------|
|
|
424
|
+
| **Phase 1: MVT** | 1 | Prove concept | < 1 hour |
|
|
425
|
+
| **Phase 2: Complexity** | 2-3 | Validation + errors | 1-2 hours |
|
|
426
|
+
| **Phase 3: Scale** | 5-15 | Full implementation | 3-5 hours |
|
|
427
|
+
| **Phase 4: Deploy** | N/A | Production readiness | 2-3 hours |
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## Best Practices
|
|
432
|
+
|
|
433
|
+
### DO:
|
|
434
|
+
- ✅ Start with 1 item (MVT)
|
|
435
|
+
- ✅ Test after each phase
|
|
436
|
+
- ✅ Log every significant action
|
|
437
|
+
- ✅ Use TDD for critical paths
|
|
438
|
+
- ✅ Add validation in Phase 2
|
|
439
|
+
- ✅ Scale to full implementation in Phase 3
|
|
440
|
+
- ✅ Complete all Phase 4 tasks before deploying
|
|
441
|
+
|
|
442
|
+
### DON'T:
|
|
443
|
+
- ❌ Jump straight to full scale
|
|
444
|
+
- ❌ Skip validation
|
|
445
|
+
- ❌ Skip error handling
|
|
446
|
+
- ❌ Skip logging
|
|
447
|
+
- ❌ Skip tests
|
|
448
|
+
- ❌ Deploy without Phase 4 checklist
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
**💡 Remember:** If you can't test it with 1 item, you can't scale it to 100!
|