@champpaba/claude-agent-kit 3.2.0 → 3.3.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/.claude/CHANGELOG.md +62 -0
- package/.claude/CLAUDE.md +56 -2
- package/.claude/agents/02-uxui-frontend.md +99 -16
- package/.claude/agents/07-ux-tester.md +307 -108
- package/.claude/commands/cdev.md +465 -492
- package/.claude/lib/README.md +8 -0
- package/.claude/lib/design-validator.md +330 -0
- package/package.json +1 -1
package/.claude/lib/README.md
CHANGED
|
@@ -19,6 +19,14 @@ Ensures Main Claude updates flags.json after EVERY phase completion. Provides he
|
|
|
19
19
|
**`agent-router.md`** - Agent routing rules
|
|
20
20
|
Defines agent boundaries. Main Claude delegates implementation work to specialized agents. Includes work type detection patterns and self-check protocol.
|
|
21
21
|
|
|
22
|
+
**`design-validator.md`** - Design system validation (v3.3.0 NEW!)
|
|
23
|
+
Single Source of Truth for design compliance. Contains:
|
|
24
|
+
- Part 1: Design token loading protocol
|
|
25
|
+
- Part 2: Pre-work validation (uxui-frontend)
|
|
26
|
+
- Part 3: Post-work validation (ux-tester with Chrome DevTools)
|
|
27
|
+
- Part 4: Main Claude pre-flight checklist
|
|
28
|
+
Used by: Main Claude (/cdev), uxui-frontend agent, ux-tester agent
|
|
29
|
+
|
|
22
30
|
**`validation-gates.md`** - Validation checkpoints
|
|
23
31
|
Four validation gates that Main Claude passes: before work, after agent responds, before reporting, and before phase start. Ensures quality and correctness at each step.
|
|
24
32
|
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# Design Validator
|
|
2
|
+
|
|
3
|
+
> **Version:** 1.1.0 - Imperative Instructions (No Pseudocode)
|
|
4
|
+
> **Purpose:** Single Source of Truth for Design System Validation
|
|
5
|
+
> **Used by:** Main Claude, uxui-frontend, ux-tester
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This file defines **mandatory steps** for design system compliance.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
PREVENTION (Before Implementation)
|
|
15
|
+
├── Main Claude: Pre-Flight Check before invoking uxui-frontend
|
|
16
|
+
└── uxui-frontend: STEP 0.5 - Read data.yaml, report tokens
|
|
17
|
+
|
|
18
|
+
DETECTION (After Implementation)
|
|
19
|
+
└── ux-tester: Step 5.5 - Chrome DevTools style comparison
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Part 1: Design Token Locations
|
|
25
|
+
|
|
26
|
+
**Primary source (project-specific):**
|
|
27
|
+
```
|
|
28
|
+
design-system/data.yaml
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Fallback (universal principles):**
|
|
32
|
+
```
|
|
33
|
+
.claude/contexts/design/*.md
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Page-specific plan:**
|
|
37
|
+
```
|
|
38
|
+
openspec/changes/{changeId}/page-plan.md
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Part 2: Main Claude Pre-Flight Check
|
|
44
|
+
|
|
45
|
+
**เมื่อไหร่ต้องทำ:** ก่อน invoke uxui-frontend หรือ frontend agent ทุกครั้ง
|
|
46
|
+
|
|
47
|
+
**ขั้นตอนที่ต้องทำ:**
|
|
48
|
+
|
|
49
|
+
### 2.1 ตรวจสอบว่ามี design system หรือไม่
|
|
50
|
+
|
|
51
|
+
อ่านไฟล์ `design-system/data.yaml`
|
|
52
|
+
|
|
53
|
+
**ถ้ามีไฟล์:**
|
|
54
|
+
```
|
|
55
|
+
✅ Design system found: design-system/data.yaml
|
|
56
|
+
```
|
|
57
|
+
→ ไปขั้นตอน 2.2
|
|
58
|
+
|
|
59
|
+
**ถ้าไม่มีไฟล์:**
|
|
60
|
+
```
|
|
61
|
+
⚠️ WARNING: No design system found!
|
|
62
|
+
Path: design-system/data.yaml (not found)
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
1. Run /designsetup first (recommended)
|
|
66
|
+
2. Continue with fallback design principles
|
|
67
|
+
|
|
68
|
+
Proceeding with fallback...
|
|
69
|
+
```
|
|
70
|
+
→ ไปขั้นตอน 2.3 แต่ใช้ fallback
|
|
71
|
+
|
|
72
|
+
### 2.2 บอก agent ให้อ่าน design system
|
|
73
|
+
|
|
74
|
+
เมื่อ invoke agent ต้องบอกในส่วน prompt ว่า:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
MANDATORY: Read design-system/data.yaml before writing any CSS/Tailwind.
|
|
78
|
+
Report the tokens you loaded before starting implementation.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2.3 Verify agent compliance
|
|
82
|
+
|
|
83
|
+
หลัง agent ตอบกลับ ตรวจสอบว่ามี report นี้หรือไม่:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
✅ Design System Loaded
|
|
87
|
+
- Source: design-system/data.yaml
|
|
88
|
+
- Colors: [list]
|
|
89
|
+
- Spacing: [list]
|
|
90
|
+
- Animation: [list]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**ถ้าไม่มี report:** ถาม agent ว่าอ่าน design system หรือยัง
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Part 3: uxui-frontend STEP 0.5 (MANDATORY)
|
|
98
|
+
|
|
99
|
+
**ขั้นตอนที่ agent ต้องทำก่อนเขียน code:**
|
|
100
|
+
|
|
101
|
+
### 3.1 อ่าน design-system/data.yaml
|
|
102
|
+
|
|
103
|
+
อ่านไฟล์ `design-system/data.yaml`
|
|
104
|
+
|
|
105
|
+
**ถ้ามีไฟล์:** จด tokens ต่อไปนี้:
|
|
106
|
+
- colors (primary, secondary, background, foreground, muted, accent)
|
|
107
|
+
- spacing scale (4, 8, 12, 16, 24, 32, 48, 64)
|
|
108
|
+
- animation durations (150ms, 300ms, 500ms เท่านั้น!)
|
|
109
|
+
- shadows (sm, md, lg, xl)
|
|
110
|
+
- borderRadius scale
|
|
111
|
+
|
|
112
|
+
**ถ้าไม่มีไฟล์:**
|
|
113
|
+
```
|
|
114
|
+
⚠️ Design System NOT FOUND
|
|
115
|
+
- Path: design-system/data.yaml (missing)
|
|
116
|
+
- Fallback: Using .claude/contexts/design/*.md
|
|
117
|
+
- Recommendation: Run /designsetup to generate design system
|
|
118
|
+
```
|
|
119
|
+
→ อ่าน `.claude/contexts/design/*.md` แทน
|
|
120
|
+
|
|
121
|
+
### 3.2 Report ก่อนเริ่มเขียน code
|
|
122
|
+
|
|
123
|
+
**ต้อง report นี้ก่อนเขียน CSS/Tailwind ใดๆ:**
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
✅ Design System Loaded (STEP 0.5)
|
|
127
|
+
- Source: design-system/data.yaml
|
|
128
|
+
- Colors: primary=#xxx, secondary=#xxx, background=#xxx, foreground=#xxx
|
|
129
|
+
- Spacing scale: 4, 8, 12, 16, 24, 32, 48, 64
|
|
130
|
+
- Animation durations: 150ms, 300ms, 500ms
|
|
131
|
+
- Shadows: sm, md, lg, xl
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 3.3 กฎการใช้ tokens
|
|
135
|
+
|
|
136
|
+
**ห้ามใช้ (NEVER):**
|
|
137
|
+
|
|
138
|
+
| ห้าม | ตัวอย่าง |
|
|
139
|
+
|------|---------|
|
|
140
|
+
| Hardcoded colors | `#3b82f6`, `rgb(59,130,246)`, `text-blue-500` |
|
|
141
|
+
| Arbitrary spacing | `p-5`, `gap-7`, `m-[13px]`, `p-[22px]` |
|
|
142
|
+
| Random duration | `duration-200`, `duration-250`, `duration-400` |
|
|
143
|
+
| Mixed shadow levels | ใช้ `shadow-sm` ที่หนึ่ง `shadow-xl` ที่อื่น |
|
|
144
|
+
|
|
145
|
+
**ต้องใช้ (ALWAYS):**
|
|
146
|
+
|
|
147
|
+
| ใช้ | ตัวอย่าง |
|
|
148
|
+
|-----|---------|
|
|
149
|
+
| Theme colors | `bg-primary`, `text-foreground`, `bg-muted` |
|
|
150
|
+
| Spacing scale | `p-4`, `p-6`, `gap-8`, `m-16` |
|
|
151
|
+
| Standard durations | `duration-150`, `duration-300`, `duration-500` |
|
|
152
|
+
| Consistent shadows | เลือก level เดียวสำหรับ cards ทั้งหมด |
|
|
153
|
+
|
|
154
|
+
### 3.4 Report หลังเขียน code เสร็จ
|
|
155
|
+
|
|
156
|
+
**ต้อง report การใช้ tokens:**
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
📊 Design Token Usage Report
|
|
160
|
+
Colors used: text-foreground, bg-primary, bg-muted, border-border
|
|
161
|
+
Spacing used: p-4, p-6, p-8, gap-4, gap-8
|
|
162
|
+
Animations: duration-150, duration-300
|
|
163
|
+
Shadows: shadow-md (consistent)
|
|
164
|
+
|
|
165
|
+
✅ All tokens from data.yaml
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**ถ้ามี non-standard values:**
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
📊 Design Token Usage Report
|
|
172
|
+
...
|
|
173
|
+
⚠️ Non-standard values used:
|
|
174
|
+
- p-5 (reason: needed odd spacing for alignment)
|
|
175
|
+
- #custom-color (reason: brand requirement not in data.yaml)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Part 4: ux-tester Step 5.5 Design Compliance Check
|
|
181
|
+
|
|
182
|
+
**เมื่อไหร่ต้องทำ:** หลัง persona testing (Step 5) ก่อน generate final report (Step 6)
|
|
183
|
+
|
|
184
|
+
### 4.1 ตรวจสอบว่ามี data.yaml หรือไม่
|
|
185
|
+
|
|
186
|
+
อ่านไฟล์ `design-system/data.yaml`
|
|
187
|
+
|
|
188
|
+
**ถ้าไม่มี:**
|
|
189
|
+
```
|
|
190
|
+
ℹ️ Skipping design compliance check (no data.yaml)
|
|
191
|
+
```
|
|
192
|
+
→ ข้าม Step 5.5 ไปเลย
|
|
193
|
+
|
|
194
|
+
**ถ้ามี:** ทำขั้นตอนถัดไป
|
|
195
|
+
|
|
196
|
+
### 4.2 Load expected tokens จาก data.yaml
|
|
197
|
+
|
|
198
|
+
จดค่าที่คาดหวัง:
|
|
199
|
+
- Colors ทั้งหมด (พร้อม hex values)
|
|
200
|
+
- Animation durations: 150ms, 300ms, 500ms
|
|
201
|
+
- Spacing scale
|
|
202
|
+
|
|
203
|
+
### 4.3 ใช้ Chrome DevTools ตรวจสอบ
|
|
204
|
+
|
|
205
|
+
**ขั้นตอน:**
|
|
206
|
+
|
|
207
|
+
1. Navigate ไปหน้าที่ต้องการตรวจ:
|
|
208
|
+
```
|
|
209
|
+
mcp__chrome-devtools__navigate_page({ url: "http://localhost:xxxx" })
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
2. Take snapshot เพื่อดู DOM และ styles:
|
|
213
|
+
```
|
|
214
|
+
mcp__chrome-devtools__take_snapshot()
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
3. ดู elements หลักๆ:
|
|
218
|
+
- buttons (สี, padding, transition)
|
|
219
|
+
- headings (font-size, color)
|
|
220
|
+
- cards (shadow, border-radius, padding)
|
|
221
|
+
- links (color, hover states)
|
|
222
|
+
|
|
223
|
+
4. เปรียบเทียบกับ tokens ที่คาดหวัง
|
|
224
|
+
|
|
225
|
+
### 4.4 บันทึก violations ที่พบ
|
|
226
|
+
|
|
227
|
+
**ตัวอย่าง violations:**
|
|
228
|
+
|
|
229
|
+
| Element | Property | Actual | Expected |
|
|
230
|
+
|---------|----------|--------|----------|
|
|
231
|
+
| button.cta | background-color | #3b82f6 | primary: #2563eb |
|
|
232
|
+
| .card | transition-duration | 200ms | 150ms หรือ 300ms หรือ 500ms |
|
|
233
|
+
| h1.hero | font-size | 52px | 48px (max in scale) |
|
|
234
|
+
|
|
235
|
+
### 4.5 เพิ่มใน ux-test-report.md
|
|
236
|
+
|
|
237
|
+
**เพิ่ม section นี้ใน report:**
|
|
238
|
+
|
|
239
|
+
```markdown
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 📐 Design Compliance Check
|
|
243
|
+
|
|
244
|
+
> Validated against: design-system/data.yaml
|
|
245
|
+
|
|
246
|
+
### Summary
|
|
247
|
+
|
|
248
|
+
| Category | Compliant | Violations | Status |
|
|
249
|
+
|----------|-----------|------------|--------|
|
|
250
|
+
| Colors | 15 | 2 | ⚠️ |
|
|
251
|
+
| Spacing | 20 | 0 | ✅ |
|
|
252
|
+
| Animation | 5 | 3 | ❌ |
|
|
253
|
+
|
|
254
|
+
### Violations Found
|
|
255
|
+
|
|
256
|
+
| Element | Property | Actual | Expected |
|
|
257
|
+
|---------|----------|--------|----------|
|
|
258
|
+
| button.cta | background | #3b82f6 | #2563eb (primary) |
|
|
259
|
+
| .card | duration | 200ms | 150/300/500ms |
|
|
260
|
+
|
|
261
|
+
### Quick Fixes
|
|
262
|
+
|
|
263
|
+
1. **button.cta**
|
|
264
|
+
- เปลี่ยนจาก `bg-blue-500` → `bg-primary`
|
|
265
|
+
|
|
266
|
+
2. **.card transition**
|
|
267
|
+
- เปลี่ยนจาก `duration-200` → `duration-150`
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Part 5: Quick Reference Checklist
|
|
275
|
+
|
|
276
|
+
### For Main Claude
|
|
277
|
+
|
|
278
|
+
Before invoking uxui-frontend or frontend:
|
|
279
|
+
|
|
280
|
+
- [ ] Check if `design-system/data.yaml` exists
|
|
281
|
+
- [ ] If exists: Tell agent to read it and report tokens
|
|
282
|
+
- [ ] If not exists: Warn user, suggest /designsetup
|
|
283
|
+
- [ ] After agent responds: Verify token report exists
|
|
284
|
+
|
|
285
|
+
### For uxui-frontend
|
|
286
|
+
|
|
287
|
+
Before writing any CSS/Tailwind:
|
|
288
|
+
|
|
289
|
+
- [ ] Read `design-system/data.yaml`
|
|
290
|
+
- [ ] Report loaded tokens (colors, spacing, animation, shadows)
|
|
291
|
+
- [ ] Use ONLY tokens from data.yaml
|
|
292
|
+
- [ ] NO hardcoded colors (#xxx)
|
|
293
|
+
- [ ] NO arbitrary spacing (p-5, gap-7)
|
|
294
|
+
- [ ] NO random durations (only 150/300/500ms)
|
|
295
|
+
|
|
296
|
+
After implementation:
|
|
297
|
+
|
|
298
|
+
- [ ] Report token usage
|
|
299
|
+
- [ ] List any non-standard values with reasons
|
|
300
|
+
|
|
301
|
+
### For ux-tester
|
|
302
|
+
|
|
303
|
+
After persona testing:
|
|
304
|
+
|
|
305
|
+
- [ ] Check if `design-system/data.yaml` exists
|
|
306
|
+
- [ ] If exists: Load expected tokens
|
|
307
|
+
- [ ] Use Chrome DevTools to check computed styles
|
|
308
|
+
- [ ] Compare actual vs expected
|
|
309
|
+
- [ ] Add compliance section to ux-test-report.md
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Common Violations and Fixes
|
|
314
|
+
|
|
315
|
+
| Violation | Bad | Good |
|
|
316
|
+
|-----------|-----|------|
|
|
317
|
+
| Hardcoded color | `bg-blue-500`, `#3b82f6` | `bg-primary` |
|
|
318
|
+
| Arbitrary spacing | `p-5`, `gap-7` | `p-4`, `p-6`, `gap-8` |
|
|
319
|
+
| Wrong duration | `duration-200` | `duration-150` or `duration-300` |
|
|
320
|
+
| Inconsistent shadow | `shadow-sm` here, `shadow-xl` there | `shadow-md` everywhere |
|
|
321
|
+
| Non-scale font | `text-[52px]` | `text-5xl` (48px) |
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## See Also
|
|
326
|
+
|
|
327
|
+
- `.claude/agents/02-uxui-frontend.md` - Agent file (STEP 0.5)
|
|
328
|
+
- `.claude/agents/07-ux-tester.md` - Agent file (Step 5.5)
|
|
329
|
+
- `.claude/commands/cdev.md` - Main Claude workflow
|
|
330
|
+
- `design-system/data.yaml` - Design tokens source
|