@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,776 @@
|
|
|
1
|
+
# Comprehensive Validation Framework
|
|
2
|
+
|
|
3
|
+
> **Enforce ALL mandatory patterns across ALL agents**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 Overview
|
|
8
|
+
|
|
9
|
+
Every agent has MANDATORY pre-work steps. This framework ensures agents CANNOT skip required patterns.
|
|
10
|
+
|
|
11
|
+
**Principles:**
|
|
12
|
+
1. **Report Before Code** - Agent must report completion BEFORE implementation
|
|
13
|
+
2. **Validation Gates** - Orchestrator validates BEFORE allowing next step
|
|
14
|
+
3. **Rejection with Guidance** - Clear feedback if validation fails
|
|
15
|
+
4. **Pattern-Specific** - Each agent has unique validation requirements
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📋 Validation Checklists by Agent
|
|
20
|
+
|
|
21
|
+
### 1️⃣ **uxui-frontend Agent**
|
|
22
|
+
|
|
23
|
+
**Required Pre-Work:**
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
## ✅ Pre-Implementation Validation Report
|
|
27
|
+
|
|
28
|
+
### A. Design Foundation ✓
|
|
29
|
+
- [x] Read: design/index.md
|
|
30
|
+
- [x] Read: design/box-thinking.md
|
|
31
|
+
- [x] Read: design/color-theory.md
|
|
32
|
+
- [x] Read: design/spacing.md
|
|
33
|
+
- [x] Read: design/shadows.md
|
|
34
|
+
- [x] Read: patterns/ui-component-consistency.md
|
|
35
|
+
- [x] Read: patterns/frontend-component-strategy.md
|
|
36
|
+
|
|
37
|
+
**Summary:** Loaded design system, spacing scale (8/16/24/32/40/48px), color tokens, shadow patterns.
|
|
38
|
+
|
|
39
|
+
### B. Box Thinking Analysis ✓
|
|
40
|
+
**Component:** [Landing Page]
|
|
41
|
+
|
|
42
|
+
**Structure:**
|
|
43
|
+
```
|
|
44
|
+
Landing Page
|
|
45
|
+
├─ Hero (container) - padding: 48px
|
|
46
|
+
│ ├─ Headline (h1)
|
|
47
|
+
│ ├─ Subtitle (p)
|
|
48
|
+
│ └─ CTA Button
|
|
49
|
+
└─ Features (container) - gap: 24px
|
|
50
|
+
└─ FeatureCard x3 (grid)
|
|
51
|
+
├─ Icon
|
|
52
|
+
├─ Title
|
|
53
|
+
└─ Description
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Spacing Plan:**
|
|
57
|
+
- Hero: padding-12 (48px)
|
|
58
|
+
- Card gap: gap-6 (24px)
|
|
59
|
+
- Card padding: padding-6 (24px)
|
|
60
|
+
|
|
61
|
+
**Responsive:**
|
|
62
|
+
- Mobile (<640px): Stack vertically
|
|
63
|
+
- Tablet (640-1024px): 2-column grid
|
|
64
|
+
- Desktop (>1024px): 3-column grid
|
|
65
|
+
|
|
66
|
+
### C. Component Search ✓
|
|
67
|
+
**Search Performed:**
|
|
68
|
+
```bash
|
|
69
|
+
Glob: "**/*{Hero,Feature,Card,Button,Icon}*.{tsx,jsx}"
|
|
70
|
+
Grep: "export.*function.*(Button|Card)"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Results:**
|
|
74
|
+
- ✅ Found: components/ui/Button.tsx
|
|
75
|
+
- ✅ Found: components/ui/Card.tsx
|
|
76
|
+
- ❌ Not found: Hero, FeatureCard
|
|
77
|
+
|
|
78
|
+
**Decision:**
|
|
79
|
+
- **Reuse:** Button (variant="primary", size="lg")
|
|
80
|
+
- **Reuse:** Card (for FeatureCard base)
|
|
81
|
+
- **Create New:** HeroSection, FeatureCard (no alternatives exist)
|
|
82
|
+
|
|
83
|
+
**Justification:** Hero and FeatureCard are domain-specific, cannot reuse generic components.
|
|
84
|
+
|
|
85
|
+
### D. Design Tokens Extracted ✓
|
|
86
|
+
**Reference:** components/ui/Button.tsx
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const DESIGN_TOKENS = {
|
|
90
|
+
spacing: {
|
|
91
|
+
padding: 'px-4 py-2', // Button default
|
|
92
|
+
gap: 'gap-4' // Between elements
|
|
93
|
+
},
|
|
94
|
+
colors: {
|
|
95
|
+
primary: 'bg-blue-600',
|
|
96
|
+
primaryHover: 'hover:bg-blue-700',
|
|
97
|
+
text: 'text-white',
|
|
98
|
+
muted: 'text-foreground/70'
|
|
99
|
+
},
|
|
100
|
+
shadows: 'shadow-sm',
|
|
101
|
+
radius: 'rounded-md',
|
|
102
|
+
transitions: 'transition-colors duration-200'
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Consistency Check:**
|
|
107
|
+
- ✅ All buttons use bg-blue-600/700
|
|
108
|
+
- ✅ All rounded corners use rounded-md
|
|
109
|
+
- ✅ All shadows use shadow-sm
|
|
110
|
+
- ✅ Will follow these patterns
|
|
111
|
+
|
|
112
|
+
### E. Mock Data Strategy ✓
|
|
113
|
+
```typescript
|
|
114
|
+
const MOCK_DATA = {
|
|
115
|
+
hero: {
|
|
116
|
+
headline: "Welcome to Our Platform",
|
|
117
|
+
subtitle: "Build amazing things",
|
|
118
|
+
ctaText: "Get Started"
|
|
119
|
+
},
|
|
120
|
+
features: [
|
|
121
|
+
{ id: 1, title: "Fast", description: "Lightning speed", icon: "⚡" },
|
|
122
|
+
{ id: 2, title: "Secure", description: "Bank-level security", icon: "🔒" },
|
|
123
|
+
{ id: 3, title: "Scalable", description: "Grows with you", icon: "📈" }
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
// TODO: Replace with API call in Phase 3
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### F. Ready to Implement ✓
|
|
130
|
+
✅ All design contexts loaded
|
|
131
|
+
✅ Box thinking complete
|
|
132
|
+
✅ Existing components searched
|
|
133
|
+
✅ Design tokens extracted
|
|
134
|
+
✅ Mock data prepared
|
|
135
|
+
|
|
136
|
+
**Proceeding with implementation...**
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Validation Keywords:**
|
|
140
|
+
- MUST contain: "Design Foundation ✓"
|
|
141
|
+
- MUST contain: "Box Thinking Analysis ✓"
|
|
142
|
+
- MUST contain: "Component Search ✓"
|
|
143
|
+
- MUST contain: "Design Tokens Extracted ✓"
|
|
144
|
+
- MUST contain: "Ready to Implement ✓"
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### 2️⃣ **backend Agent**
|
|
149
|
+
|
|
150
|
+
**Required Pre-Work:**
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
## ✅ Pre-Implementation Validation Report
|
|
154
|
+
|
|
155
|
+
### A. Patterns Loaded ✓
|
|
156
|
+
- [x] Read: patterns/error-handling.md
|
|
157
|
+
- [x] Read: patterns/logging.md
|
|
158
|
+
- [x] Read: patterns/testing.md
|
|
159
|
+
|
|
160
|
+
### B. Existing Endpoints Search ✓
|
|
161
|
+
**Search Performed:**
|
|
162
|
+
```bash
|
|
163
|
+
Grep: "router\\.(post|get|put|delete).*\\/api\\/auth"
|
|
164
|
+
Grep: "@app\\.(post|get).*\\/api\\/auth"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Results:**
|
|
168
|
+
- ❌ No existing /api/auth/login
|
|
169
|
+
- ❌ No existing /api/auth/register
|
|
170
|
+
- ✅ Can proceed with implementation
|
|
171
|
+
|
|
172
|
+
### C. TDD Workflow (if metadata: | TDD |) ✓
|
|
173
|
+
**TDD Required:** YES (metadata flag detected)
|
|
174
|
+
|
|
175
|
+
**Phase Plan:**
|
|
176
|
+
1. 🔴 RED: Write 7 tests FIRST
|
|
177
|
+
- test_register_success
|
|
178
|
+
- test_register_duplicate_email
|
|
179
|
+
- test_register_invalid_email
|
|
180
|
+
- test_register_weak_password
|
|
181
|
+
- test_login_success
|
|
182
|
+
- test_login_invalid_credentials
|
|
183
|
+
- test_login_validation_error
|
|
184
|
+
|
|
185
|
+
2. ✅ GREEN: Minimal implementation
|
|
186
|
+
- User model
|
|
187
|
+
- Password hashing (bcrypt)
|
|
188
|
+
- JWT generation
|
|
189
|
+
- Registration endpoint
|
|
190
|
+
- Login endpoint
|
|
191
|
+
|
|
192
|
+
3. 🔧 REFACTOR: Add production quality
|
|
193
|
+
- Structured logging
|
|
194
|
+
- Error handling
|
|
195
|
+
- Type hints
|
|
196
|
+
- Docstrings
|
|
197
|
+
|
|
198
|
+
**Commitment:** Will follow RED-GREEN-REFACTOR strictly.
|
|
199
|
+
|
|
200
|
+
### D. Error Handling Pattern ✓
|
|
201
|
+
**From:** patterns/error-handling.md
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
# Pattern to follow:
|
|
205
|
+
try:
|
|
206
|
+
# Business logic
|
|
207
|
+
user = await create_user(...)
|
|
208
|
+
logger.info("user_created", extra={"user_id": user.id})
|
|
209
|
+
return {"id": user.id}
|
|
210
|
+
except HTTPException:
|
|
211
|
+
raise # Re-raise HTTP exceptions
|
|
212
|
+
except Exception as e:
|
|
213
|
+
logger.error("user_creation_error", extra={"error": str(e)})
|
|
214
|
+
raise HTTPException(status_code=500, detail="Internal server error")
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### E. Logging Pattern ✓
|
|
218
|
+
**From:** patterns/logging.md
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
# All significant events:
|
|
222
|
+
logger.info("api_route_entry", extra={"route": "/api/auth/login"})
|
|
223
|
+
logger.info("login_success", extra={"user_id": user.id})
|
|
224
|
+
logger.warning("login_failed", extra={"email": email, "reason": "invalid_credentials"})
|
|
225
|
+
logger.error("login_error", extra={"error": str(e)})
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### F. Ready to Implement ✓
|
|
229
|
+
✅ Patterns loaded
|
|
230
|
+
✅ Existing endpoints searched
|
|
231
|
+
✅ TDD workflow planned
|
|
232
|
+
✅ Error handling pattern identified
|
|
233
|
+
✅ Logging pattern identified
|
|
234
|
+
|
|
235
|
+
**Proceeding with TDD (RED phase first)...**
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Validation Keywords:**
|
|
239
|
+
- MUST contain: "Patterns Loaded ✓"
|
|
240
|
+
- MUST contain: "Existing Endpoints Search ✓"
|
|
241
|
+
- IF TDD: MUST contain: "TDD Workflow" + "RED-GREEN-REFACTOR"
|
|
242
|
+
- MUST contain: "Error Handling Pattern ✓"
|
|
243
|
+
- MUST contain: "Logging Pattern ✓"
|
|
244
|
+
- MUST contain: "Ready to Implement ✓"
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
### 3️⃣ **frontend Agent**
|
|
249
|
+
|
|
250
|
+
**Required Pre-Work:**
|
|
251
|
+
|
|
252
|
+
```markdown
|
|
253
|
+
## ✅ Pre-Implementation Validation Report
|
|
254
|
+
|
|
255
|
+
### A. Patterns Loaded ✓
|
|
256
|
+
- [x] Read: patterns/error-handling.md
|
|
257
|
+
- [x] Read: patterns/logging.md
|
|
258
|
+
- [x] Read: patterns/testing.md
|
|
259
|
+
|
|
260
|
+
### B. API Contract Review ✓
|
|
261
|
+
**From:** integration agent / API spec
|
|
262
|
+
|
|
263
|
+
**Endpoints to Connect:**
|
|
264
|
+
- POST /api/auth/login
|
|
265
|
+
- Request: { email: string, password: string }
|
|
266
|
+
- Success (200): { token: string, user: { id, email } }
|
|
267
|
+
- Error (401): { detail: "Invalid credentials" }
|
|
268
|
+
- Error (422): { detail: [...validation errors] }
|
|
269
|
+
|
|
270
|
+
**State Management Needed:**
|
|
271
|
+
- Auth state (user, token, isLoading)
|
|
272
|
+
- Form state (email, password, errors)
|
|
273
|
+
|
|
274
|
+
### C. State Management Strategy ✓
|
|
275
|
+
**Framework:** Zustand (from tech-stack.md)
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
// Create auth store
|
|
279
|
+
import { create } from 'zustand'
|
|
280
|
+
|
|
281
|
+
interface AuthState {
|
|
282
|
+
user: User | null
|
|
283
|
+
token: string | null
|
|
284
|
+
isLoading: boolean
|
|
285
|
+
login: (email: string, password: string) => Promise<void>
|
|
286
|
+
logout: () => void
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const useAuthStore = create<AuthState>((set) => ({
|
|
290
|
+
user: null,
|
|
291
|
+
token: null,
|
|
292
|
+
isLoading: false,
|
|
293
|
+
login: async (email, password) => {
|
|
294
|
+
set({ isLoading: true })
|
|
295
|
+
try {
|
|
296
|
+
const response = await fetch('/api/auth/login', {
|
|
297
|
+
method: 'POST',
|
|
298
|
+
body: JSON.stringify({ email, password })
|
|
299
|
+
})
|
|
300
|
+
const data = await response.json()
|
|
301
|
+
set({ user: data.user, token: data.token, isLoading: false })
|
|
302
|
+
} catch (error) {
|
|
303
|
+
set({ isLoading: false })
|
|
304
|
+
throw error
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
logout: () => set({ user: null, token: null })
|
|
308
|
+
}))
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### D. Error Handling Strategy ✓
|
|
312
|
+
```typescript
|
|
313
|
+
// User-friendly error messages
|
|
314
|
+
const handleError = (error: ApiError) => {
|
|
315
|
+
if (error.status === 401) {
|
|
316
|
+
toast.error("Invalid email or password")
|
|
317
|
+
} else if (error.status === 422) {
|
|
318
|
+
// Show validation errors
|
|
319
|
+
error.detail.forEach(err => {
|
|
320
|
+
setFieldError(err.loc[1], err.msg)
|
|
321
|
+
})
|
|
322
|
+
} else {
|
|
323
|
+
toast.error("Something went wrong. Please try again.")
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Log for debugging (no sensitive data)
|
|
327
|
+
logger.error("login_failed", { status: error.status })
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### E. Component Integration Plan ✓
|
|
332
|
+
**Existing Component:** LoginForm (from uxui-frontend phase)
|
|
333
|
+
|
|
334
|
+
**Changes Required:**
|
|
335
|
+
1. Replace mock onClick with real useAuthStore
|
|
336
|
+
2. Add loading state (disable button, show spinner)
|
|
337
|
+
3. Add error handling (toast notifications)
|
|
338
|
+
4. Add form validation (client-side)
|
|
339
|
+
5. Add redirect after success
|
|
340
|
+
|
|
341
|
+
### F. Ready to Implement ✓
|
|
342
|
+
✅ Patterns loaded
|
|
343
|
+
✅ API contract reviewed
|
|
344
|
+
✅ State management strategy defined
|
|
345
|
+
✅ Error handling strategy defined
|
|
346
|
+
✅ Component integration plan ready
|
|
347
|
+
|
|
348
|
+
**Proceeding with implementation...**
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**Validation Keywords:**
|
|
352
|
+
- MUST contain: "Patterns Loaded ✓"
|
|
353
|
+
- MUST contain: "API Contract Review ✓"
|
|
354
|
+
- MUST contain: "State Management Strategy ✓"
|
|
355
|
+
- MUST contain: "Error Handling Strategy ✓"
|
|
356
|
+
- MUST contain: "Ready to Implement ✓"
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
### 4️⃣ **database Agent**
|
|
361
|
+
|
|
362
|
+
**Required Pre-Work:**
|
|
363
|
+
|
|
364
|
+
```markdown
|
|
365
|
+
## ✅ Pre-Implementation Validation Report
|
|
366
|
+
|
|
367
|
+
### A. Patterns Loaded ✓
|
|
368
|
+
- [x] Read: patterns/error-handling.md
|
|
369
|
+
- [x] Read: patterns/logging.md
|
|
370
|
+
|
|
371
|
+
### B. Existing Schema Search ✓
|
|
372
|
+
**Search Performed:**
|
|
373
|
+
```bash
|
|
374
|
+
Glob: "**/*.prisma"
|
|
375
|
+
Glob: "**/*models*.py"
|
|
376
|
+
Grep: "class.*\\(Base\\)"
|
|
377
|
+
Grep: "model User"
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Results:**
|
|
381
|
+
- ❌ No existing User model
|
|
382
|
+
- ✅ Can proceed with schema design
|
|
383
|
+
|
|
384
|
+
### C. Schema Design Plan ✓
|
|
385
|
+
**Model:** User
|
|
386
|
+
|
|
387
|
+
**Fields:**
|
|
388
|
+
- id: string (UUID, primary key)
|
|
389
|
+
- email: string (unique, indexed)
|
|
390
|
+
- hashed_password: string (never exposed)
|
|
391
|
+
- created_at: datetime (auto)
|
|
392
|
+
- updated_at: datetime (auto)
|
|
393
|
+
|
|
394
|
+
**Constraints:**
|
|
395
|
+
- Unique: email
|
|
396
|
+
- Index: email (for fast lookups)
|
|
397
|
+
|
|
398
|
+
**Relationships:**
|
|
399
|
+
- User → Sessions (1:N) - for JWT token management
|
|
400
|
+
|
|
401
|
+
### D. Migration Strategy ✓
|
|
402
|
+
**ORM:** Prisma (from tech-stack.md)
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# Generate migration
|
|
406
|
+
pnpm prisma migrate dev --name add_user_model
|
|
407
|
+
|
|
408
|
+
# This will create:
|
|
409
|
+
# prisma/migrations/YYYYMMDD_add_user_model/migration.sql
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### E. Query Functions Plan ✓
|
|
413
|
+
```typescript
|
|
414
|
+
// Create user
|
|
415
|
+
async function createUser(email: string, hashedPassword: string): Promise<User>
|
|
416
|
+
|
|
417
|
+
// Find by email (for login)
|
|
418
|
+
async function findUserByEmail(email: string): Promise<User | null>
|
|
419
|
+
|
|
420
|
+
// Update password
|
|
421
|
+
async function updatePassword(userId: string, newHashedPassword: string): Promise<void>
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### F. Performance Considerations ✓
|
|
425
|
+
- ✅ Index on email (unique constraint also creates index)
|
|
426
|
+
- ✅ Use select() to avoid exposing hashed_password
|
|
427
|
+
- ✅ No N+1 queries (direct lookups)
|
|
428
|
+
|
|
429
|
+
### G. Ready to Implement ✓
|
|
430
|
+
✅ Patterns loaded
|
|
431
|
+
✅ Existing schemas searched
|
|
432
|
+
✅ Schema design planned
|
|
433
|
+
✅ Migration strategy defined
|
|
434
|
+
✅ Query functions planned
|
|
435
|
+
✅ Performance considered
|
|
436
|
+
|
|
437
|
+
**Proceeding with schema implementation...**
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
**Validation Keywords:**
|
|
441
|
+
- MUST contain: "Patterns Loaded ✓"
|
|
442
|
+
- MUST contain: "Existing Schema Search ✓"
|
|
443
|
+
- MUST contain: "Schema Design Plan ✓"
|
|
444
|
+
- MUST contain: "Migration Strategy ✓"
|
|
445
|
+
- MUST contain: "Ready to Implement ✓"
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### 5️⃣ **test-debug Agent**
|
|
450
|
+
|
|
451
|
+
**Required Pre-Work:**
|
|
452
|
+
|
|
453
|
+
```markdown
|
|
454
|
+
## ✅ Pre-Implementation Validation Report
|
|
455
|
+
|
|
456
|
+
### A. Patterns Loaded ✓
|
|
457
|
+
- [x] Read: patterns/testing.md
|
|
458
|
+
- [x] Read: patterns/error-handling.md
|
|
459
|
+
- [x] Read: patterns/logging.md
|
|
460
|
+
|
|
461
|
+
### B. Test Scope Analysis ✓
|
|
462
|
+
**Phase:** Component Tests / Backend Tests / E2E Tests
|
|
463
|
+
|
|
464
|
+
**Components to Test:**
|
|
465
|
+
- HeroSection
|
|
466
|
+
- FeatureCard
|
|
467
|
+
- LoginForm
|
|
468
|
+
|
|
469
|
+
**Coverage Target:** 85% (from project standards)
|
|
470
|
+
|
|
471
|
+
### C. Test Strategy ✓
|
|
472
|
+
**Framework:** Vitest (from tech-stack.md)
|
|
473
|
+
|
|
474
|
+
**Test Types:**
|
|
475
|
+
1. **Unit Tests**
|
|
476
|
+
- Component rendering
|
|
477
|
+
- Props validation
|
|
478
|
+
- Event handlers
|
|
479
|
+
- State changes
|
|
480
|
+
|
|
481
|
+
2. **Integration Tests**
|
|
482
|
+
- Component interactions
|
|
483
|
+
- API mocking
|
|
484
|
+
- State management
|
|
485
|
+
|
|
486
|
+
### D. Existing Test Patterns ✓
|
|
487
|
+
**Search Performed:**
|
|
488
|
+
```bash
|
|
489
|
+
Grep: "describe.*test.*it\\("
|
|
490
|
+
Grep: "expect\\(.*\\)\\.toBe"
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**Pattern Found:**
|
|
494
|
+
```typescript
|
|
495
|
+
// Existing pattern in __tests__/Button.test.tsx
|
|
496
|
+
describe('Button', () => {
|
|
497
|
+
it('renders with correct text', () => {
|
|
498
|
+
render(<Button>Click me</Button>)
|
|
499
|
+
expect(screen.getByText('Click me')).toBeInTheDocument()
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
it('calls onClick when clicked', () => {
|
|
503
|
+
const handleClick = vi.fn()
|
|
504
|
+
render(<Button onClick={handleClick}>Click</Button>)
|
|
505
|
+
fireEvent.click(screen.getByText('Click'))
|
|
506
|
+
expect(handleClick).toHaveBeenCalledTimes(1)
|
|
507
|
+
})
|
|
508
|
+
})
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
**Will follow this pattern.**
|
|
512
|
+
|
|
513
|
+
### E. Debug Strategy (if tests fail) ✓
|
|
514
|
+
**Max Iterations:** 3-4
|
|
515
|
+
**Per Iteration:**
|
|
516
|
+
1. Read error messages carefully
|
|
517
|
+
2. Identify root cause
|
|
518
|
+
3. Fix code or test
|
|
519
|
+
4. Re-run
|
|
520
|
+
5. Log iteration results
|
|
521
|
+
|
|
522
|
+
**If stuck after 4 iterations:**
|
|
523
|
+
- Escalate to main Claude with:
|
|
524
|
+
- Error messages
|
|
525
|
+
- Code attempted
|
|
526
|
+
- Suspected root cause
|
|
527
|
+
|
|
528
|
+
### F. Ready to Implement ✓
|
|
529
|
+
✅ Patterns loaded
|
|
530
|
+
✅ Test scope analyzed
|
|
531
|
+
✅ Test strategy defined
|
|
532
|
+
✅ Existing patterns identified
|
|
533
|
+
✅ Debug strategy prepared
|
|
534
|
+
|
|
535
|
+
**Proceeding with test implementation...**
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**Validation Keywords:**
|
|
539
|
+
- MUST contain: "Patterns Loaded ✓"
|
|
540
|
+
- MUST contain: "Test Scope Analysis ✓"
|
|
541
|
+
- MUST contain: "Test Strategy ✓"
|
|
542
|
+
- MUST contain: "Existing Test Patterns ✓"
|
|
543
|
+
- MUST contain: "Ready to Implement ✓"
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
### 6️⃣ **integration Agent**
|
|
548
|
+
|
|
549
|
+
**Required Pre-Work:**
|
|
550
|
+
|
|
551
|
+
```markdown
|
|
552
|
+
## ✅ Pre-Implementation Validation Report
|
|
553
|
+
|
|
554
|
+
### A. Validation Type ✓
|
|
555
|
+
**Phase:** API Design / Contract Validation / Business Logic
|
|
556
|
+
|
|
557
|
+
**Tasks:**
|
|
558
|
+
- [ ] Generate OpenAPI spec (if API Design)
|
|
559
|
+
- [ ] Validate backend/frontend contracts (if Contract Validation)
|
|
560
|
+
- [ ] Verify requirements (if Business Logic)
|
|
561
|
+
|
|
562
|
+
### B. Contract Sources ✓
|
|
563
|
+
**Backend API Files:**
|
|
564
|
+
```bash
|
|
565
|
+
Glob: "**/api/**/*.{py,ts,js}"
|
|
566
|
+
Grep: "router\\.(post|get|put|delete)"
|
|
567
|
+
Grep: "@app\\.(post|get)"
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
**Frontend API Calls:**
|
|
571
|
+
```bash
|
|
572
|
+
Grep: "fetch\\(.*\\/api\\/"
|
|
573
|
+
Grep: "axios\\.(post|get)"
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
### C. Validation Checklist ✓
|
|
577
|
+
**For Each Endpoint:**
|
|
578
|
+
- [ ] Request schema matches
|
|
579
|
+
- [ ] Response schema matches
|
|
580
|
+
- [ ] Status codes match
|
|
581
|
+
- [ ] Error responses match
|
|
582
|
+
- [ ] Types compatible
|
|
583
|
+
|
|
584
|
+
### D. Business Requirements Check ✓
|
|
585
|
+
**From:** proposal.md
|
|
586
|
+
|
|
587
|
+
**Requirements:**
|
|
588
|
+
1. User registration with email validation
|
|
589
|
+
2. User login with JWT
|
|
590
|
+
3. Secure password storage
|
|
591
|
+
|
|
592
|
+
**Implementation Check:**
|
|
593
|
+
- [x] Registration endpoint exists → POST /api/auth/register
|
|
594
|
+
- [x] Login endpoint exists → POST /api/auth/login
|
|
595
|
+
- [x] Email validation → Pydantic EmailStr
|
|
596
|
+
- [x] JWT generation → lib/jwt.py
|
|
597
|
+
- [x] Password hashing → bcrypt
|
|
598
|
+
|
|
599
|
+
**Result:** All requirements met ✓
|
|
600
|
+
|
|
601
|
+
### E. Ready to Validate ✓
|
|
602
|
+
✅ Validation type identified
|
|
603
|
+
✅ Contract sources located
|
|
604
|
+
✅ Validation checklist prepared
|
|
605
|
+
✅ Business requirements reviewed
|
|
606
|
+
|
|
607
|
+
**Proceeding with validation...**
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**Validation Keywords:**
|
|
611
|
+
- MUST contain: "Validation Type ✓"
|
|
612
|
+
- MUST contain: "Contract Sources ✓" OR "Requirements Check ✓"
|
|
613
|
+
- MUST contain: "Ready to Validate ✓"
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## 🚨 Validation Enforcement Logic
|
|
618
|
+
|
|
619
|
+
### Orchestrator Validation Function
|
|
620
|
+
|
|
621
|
+
```typescript
|
|
622
|
+
interface ValidationResult {
|
|
623
|
+
passed: boolean
|
|
624
|
+
missing: string[]
|
|
625
|
+
report?: string
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function validateAgentPreWork(
|
|
629
|
+
agentType: string,
|
|
630
|
+
agentResponse: string,
|
|
631
|
+
phaseMetadata: string
|
|
632
|
+
): ValidationResult {
|
|
633
|
+
const required: string[] = []
|
|
634
|
+
|
|
635
|
+
// Common for all agents
|
|
636
|
+
required.push("Pre-Implementation Validation Report")
|
|
637
|
+
required.push("Ready to Implement ✓")
|
|
638
|
+
|
|
639
|
+
// Agent-specific requirements
|
|
640
|
+
switch (agentType) {
|
|
641
|
+
case "uxui-frontend":
|
|
642
|
+
required.push("Design Foundation ✓")
|
|
643
|
+
required.push("Box Thinking Analysis ✓")
|
|
644
|
+
required.push("Component Search ✓")
|
|
645
|
+
required.push("Design Tokens Extracted ✓")
|
|
646
|
+
break
|
|
647
|
+
|
|
648
|
+
case "backend":
|
|
649
|
+
required.push("Patterns Loaded ✓")
|
|
650
|
+
required.push("Existing Endpoints Search ✓")
|
|
651
|
+
required.push("Error Handling Pattern ✓")
|
|
652
|
+
required.push("Logging Pattern ✓")
|
|
653
|
+
|
|
654
|
+
// TDD specific
|
|
655
|
+
if (phaseMetadata.includes("| TDD |")) {
|
|
656
|
+
required.push("TDD Workflow")
|
|
657
|
+
required.push("RED-GREEN-REFACTOR")
|
|
658
|
+
}
|
|
659
|
+
break
|
|
660
|
+
|
|
661
|
+
case "frontend":
|
|
662
|
+
required.push("Patterns Loaded ✓")
|
|
663
|
+
required.push("API Contract Review ✓")
|
|
664
|
+
required.push("State Management Strategy ✓")
|
|
665
|
+
required.push("Error Handling Strategy ✓")
|
|
666
|
+
break
|
|
667
|
+
|
|
668
|
+
case "database":
|
|
669
|
+
required.push("Patterns Loaded ✓")
|
|
670
|
+
required.push("Existing Schema Search ✓")
|
|
671
|
+
required.push("Schema Design Plan ✓")
|
|
672
|
+
required.push("Migration Strategy ✓")
|
|
673
|
+
break
|
|
674
|
+
|
|
675
|
+
case "test-debug":
|
|
676
|
+
required.push("Patterns Loaded ✓")
|
|
677
|
+
required.push("Test Scope Analysis ✓")
|
|
678
|
+
required.push("Test Strategy ✓")
|
|
679
|
+
required.push("Existing Test Patterns ✓")
|
|
680
|
+
break
|
|
681
|
+
|
|
682
|
+
case "integration":
|
|
683
|
+
required.push("Validation Type ✓")
|
|
684
|
+
required.push("Ready to Validate ✓")
|
|
685
|
+
break
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// Check all requirements
|
|
689
|
+
const missing = required.filter(req =>
|
|
690
|
+
!agentResponse.includes(req)
|
|
691
|
+
)
|
|
692
|
+
|
|
693
|
+
return {
|
|
694
|
+
passed: missing.length === 0,
|
|
695
|
+
missing,
|
|
696
|
+
report: missing.length === 0 ? agentResponse : undefined
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
### Rejection Message Template
|
|
702
|
+
|
|
703
|
+
```markdown
|
|
704
|
+
❌ **Validation Failed**
|
|
705
|
+
|
|
706
|
+
Your response is missing required pre-work steps:
|
|
707
|
+
|
|
708
|
+
{missing.map(item => `- ${item}`).join('\n')}
|
|
709
|
+
|
|
710
|
+
**You MUST complete ALL mandatory steps before implementation.**
|
|
711
|
+
|
|
712
|
+
Please provide a complete Pre-Implementation Validation Report covering:
|
|
713
|
+
|
|
714
|
+
{agent-specific requirements}
|
|
715
|
+
|
|
716
|
+
**Format:**
|
|
717
|
+
```markdown
|
|
718
|
+
## ✅ Pre-Implementation Validation Report
|
|
719
|
+
|
|
720
|
+
### A. {First Requirement} ✓
|
|
721
|
+
[details]
|
|
722
|
+
|
|
723
|
+
### B. {Second Requirement} ✓
|
|
724
|
+
[details]
|
|
725
|
+
|
|
726
|
+
...
|
|
727
|
+
|
|
728
|
+
### Ready to Implement ✓
|
|
729
|
+
[confirmation]
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
**Only after validation passes can you proceed with implementation.**
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
---
|
|
736
|
+
|
|
737
|
+
## 🔄 Updated Workflow
|
|
738
|
+
|
|
739
|
+
```
|
|
740
|
+
User: /cdev CHANGE-001
|
|
741
|
+
↓
|
|
742
|
+
Main Claude: Read phases.md → Phase 1 (uxui-frontend)
|
|
743
|
+
↓
|
|
744
|
+
Main Claude: Build prompt with validation requirement
|
|
745
|
+
↓
|
|
746
|
+
Main Claude: Invoke agent
|
|
747
|
+
↓
|
|
748
|
+
Agent: Respond with Pre-Implementation Report
|
|
749
|
+
↓
|
|
750
|
+
Main Claude: Validate report
|
|
751
|
+
├─ ❌ Invalid → Send rejection message → Wait for corrected report
|
|
752
|
+
└─ ✅ Valid → Allow agent to proceed
|
|
753
|
+
↓
|
|
754
|
+
Agent: Implement with validated context
|
|
755
|
+
↓
|
|
756
|
+
Agent: Update flags.json
|
|
757
|
+
↓
|
|
758
|
+
Main Claude: Move to next phase
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
---
|
|
762
|
+
|
|
763
|
+
## 📊 Validation Coverage
|
|
764
|
+
|
|
765
|
+
| Agent | Design | TDD | Reuse | Errors | Logging | Testing | State |
|
|
766
|
+
|-------|--------|-----|-------|--------|---------|---------|-------|
|
|
767
|
+
| **uxui-frontend** | ✅ | - | ✅ | - | - | - | - |
|
|
768
|
+
| **backend** | - | ✅ | ✅ | ✅ | ✅ | - | - |
|
|
769
|
+
| **frontend** | - | - | - | ✅ | ✅ | - | ✅ |
|
|
770
|
+
| **database** | - | - | ✅ | ✅ | ✅ | - | - |
|
|
771
|
+
| **test-debug** | - | - | ✅ | - | - | ✅ | - |
|
|
772
|
+
| **integration** | - | - | - | - | - | - | - |
|
|
773
|
+
|
|
774
|
+
---
|
|
775
|
+
|
|
776
|
+
**Every agent, every pattern, fully validated!** ✅
|