Skip to content

Commit e501b7f

Browse files
ChampPABAclaude
andcommitted
feat(v3.3.0): Design Validation System - No Pseudocode
Problem: Design system compliance was not enforced. uxui-frontend agents didn't read design-system/data.yaml, resulting in hardcoded colors, arbitrary spacing, and inconsistent animations. The validation logic was written as TypeScript pseudocode that Claude never executed. Solution: Created single source of truth (design-validator.md) with imperative Thai/English instructions. Converted all procedural pseudocode to step-by-step commands that Claude follows. Changes: - NEW: .claude/lib/design-validator.md (Single Source of Truth) - uxui-frontend.md v2.1.0: Enhanced STEP 0.5 protocol - ux-tester.md v1.1.0: Steps 2-5 rewritten as imperative - cdev.md: Steps 2-5 rewritten, Step 4.0 Pre-Flight Check added - CHANGELOG.md: Added v3.3.0 entry - package.json: Bumped to 3.3.0 Design Validation Flow: PREVENTION: Main Claude Pre-Flight + uxui-frontend STEP 0.5 DETECTION: ux-tester Step 5.5 Chrome DevTools validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 78b7ae9 commit e501b7f

8 files changed

Lines changed: 1328 additions & 619 deletions

File tree

.claude/CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,68 @@
55
66
---
77

8+
## v3.3.0: Design Validation System (No Pseudocode)
9+
10+
**Problem Solved:** Design system compliance was not enforced. uxui-frontend agents didn't read `design-system/data.yaml`, resulting in hardcoded colors, arbitrary spacing, and inconsistent animations. The validation logic was written as TypeScript pseudocode that Claude never executed.
11+
12+
**Solution:** Created a single source of truth (`design-validator.md`) with imperative Thai/English instructions. Converted all procedural pseudocode to step-by-step commands that Claude follows.
13+
14+
### Key Changes
15+
16+
| Component | Before | After |
17+
|-----------|--------|-------|
18+
| design-validator.md | Did not exist | NEW - Single source of truth |
19+
| cdev.md Step 2-5 | TypeScript pseudocode | Imperative instructions |
20+
| ux-tester.md Steps 2-5 | TypeScript pseudocode | Imperative instructions |
21+
| uxui-frontend STEP 0.5 | Brief mention | Full step-by-step protocol |
22+
23+
### Design Validation Flow
24+
25+
```
26+
PREVENTION (Before Implementation)
27+
├── Main Claude: Pre-Flight Check before invoking uxui-frontend
28+
└── uxui-frontend: STEP 0.5 - Read data.yaml, report tokens
29+
30+
DETECTION (After Implementation)
31+
└── ux-tester: Step 5.5 - Chrome DevTools style comparison
32+
```
33+
34+
### What Gets Validated
35+
36+
| Token Category | Violation Example | Expected |
37+
|----------------|-------------------|----------|
38+
| Colors | #3b82f6, text-blue-500 | bg-primary, text-foreground |
39+
| Spacing | p-5, gap-7 | p-4, p-6, gap-8 (scale) |
40+
| Animation | duration-200 | duration-150, 300, 500ms |
41+
| Shadows | mixed sm+xl | consistent level |
42+
43+
### Files Changed
44+
45+
| File | Change |
46+
|------|--------|
47+
| `.claude/lib/design-validator.md` | NEW - Single source of truth |
48+
| `.claude/agents/02-uxui-frontend.md` | v2.1.0 - Enhanced STEP 0.5 |
49+
| `.claude/agents/07-ux-tester.md` | v1.1.0 - Steps 2-5 rewritten |
50+
| `.claude/commands/cdev.md` | Steps 2-5 rewritten, Step 4.0 added |
51+
| `.claude/lib/README.md` | Added design-validator.md entry |
52+
| `.claude/CLAUDE.md` | v3.3.0 + Design Validation section |
53+
54+
### Why This Matters
55+
56+
**Before:**
57+
- Logic scattered across 4 files
58+
- TypeScript pseudocode that Claude ignored
59+
- No enforcement of design tokens
60+
- ux-tester couldn't validate actual CSS
61+
62+
**After:**
63+
- Single source of truth (design-validator.md)
64+
- Imperative instructions Claude follows
65+
- Pre-flight check before visual agents
66+
- Chrome DevTools validation of computed styles
67+
68+
---
69+
870
## v3.2.0: Consolidated Pre-Work Context
971

1072
**Problem Solved:** `/csetup` generated two separate pseudocode outputs (`research-checklist.md` and `INTEGRATION_RISKS.md`) that were never actually created. Agents had to discover context from multiple scattered sources.

.claude/CLAUDE.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# CLAUDE.md
22

33
> **Navigation Hub for AI Agents**
4-
> **Template Version:** 3.2.0 - Consolidated Pre-Work Context
5-
> **Latest:** Step 2.6 generates `pre-work-context.md` - single file with all agent context
4+
> **Template Version:** 3.3.0 - Design Validation System
5+
> **Latest:** Single Source of Truth for design compliance (prevention + detection)
66
77
---
88

@@ -128,6 +128,7 @@ Universal, framework-agnostic template for AI-assisted development.
128128
- `@/.claude/lib/task-analyzer.md` - **v3.1.0!** Template-free task analysis with TDD classification (Step 2.6) ✨
129129
- `@/.claude/lib/flags-updater.md` - Progress tracking protocol (Main Claude updates flags.json)
130130
- `@/.claude/lib/agent-router.md` - Mandatory agent routing rules (enforce delegation)
131+
- `@/.claude/lib/design-validator.md` - **v3.3.0!** Design system validation (prevention + detection) ✨
131132
- `@/.claude/contexts/patterns/agent-discovery.md` - Shared agent discovery flow
132133

133134
---
@@ -212,6 +213,58 @@ Universal, framework-agnostic template for AI-assisted development.
212213

213214
---
214215

216+
## 🎯 Design Validation System (v3.3.0 - NEW!)
217+
218+
**→ See:** `@/.claude/lib/design-validator.md` for full specification
219+
220+
**Problem Solved:**
221+
- uxui-frontend agent ไม่อ่าน design-system/data.yaml → CSS ไม่ตรง design
222+
- ux-tester อ่านแค่ code ไม่ได้เห็น actual rendered output
223+
- Logic กระจายหลายไฟล์ → ไม่มี enforcement
224+
225+
**Solution: Single Source of Truth**
226+
227+
```
228+
┌─────────────────────────────────────────────────────────────┐
229+
│ PREVENTION (Pre-Work) │
230+
├─────────────────────────────────────────────────────────────┤
231+
│ Main Claude → Pre-Flight Design Check (before /cdev) │
232+
│ uxui-frontend → STEP 0.5: Read data.yaml (MANDATORY) │
233+
└─────────────────────────────────────────────────────────────┘
234+
235+
┌─────────────────────────────────────────────────────────────┐
236+
│ DETECTION (Post-Work) │
237+
├─────────────────────────────────────────────────────────────┤
238+
│ ux-tester → Chrome DevTools Style Comparison │
239+
│ Compare computed styles vs data.yaml tokens │
240+
└─────────────────────────────────────────────────────────────┘
241+
```
242+
243+
**What Gets Validated:**
244+
245+
| Token Category | Example Violation | Expected |
246+
|----------------|-------------------|----------|
247+
| Colors | #3b82f6 | bg-primary (from data.yaml) |
248+
| Spacing | p-5, gap-7 | p-4, p-6, gap-8 (scale) |
249+
| Animation | duration-200 | duration-150, 300, 500ms |
250+
| Shadows | mixed sm+xl | consistent level |
251+
252+
**Agent Responsibilities:**
253+
254+
| Agent | What to Do |
255+
|-------|------------|
256+
| Main Claude | Pre-flight check before invoking uxui-frontend |
257+
| uxui-frontend | STEP 0.5: Read data.yaml, report loaded tokens |
258+
| ux-tester | Step 5.5: Chrome DevTools validation |
259+
260+
**Files Updated:**
261+
- `.claude/lib/design-validator.md` (NEW - Single Source of Truth)
262+
- `.claude/agents/02-uxui-frontend.md` (v2.1.0 - references design-validator)
263+
- `.claude/agents/07-ux-tester.md` (v1.1.0 - Design Compliance Check)
264+
- `.claude/commands/cdev.md` (Step 4.0 - Pre-Flight Check)
265+
266+
---
267+
215268
## ⚡ Context Optimization (v2.1.0)
216269

217270
**→ See:** `@/.claude/lib/detailed-guides/context-optimization.md` for complete guide
@@ -310,6 +363,7 @@ User: "Build login system"
310363
**Recent versions:**
311364
| Version | Key Feature |
312365
|---------|-------------|
366+
| v3.3.0 | **Design Validation System** (prevention + detection, single source of truth) |
313367
| v3.2.0 | Consolidated Pre-Work Context (single `pre-work-context.md` for agents) |
314368
| v3.1.1 | Direct Best Practices Execution (Step 2.7 rewritten, no pseudocode) |
315369
| v3.1.0 | TDD Classification + Development Principles Injection |

.claude/agents/02-uxui-frontend.md

Lines changed: 99 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ color: blue
77

88
# UX-UI Frontend Agent
99

10-
> **Version:** 2.0.0 (Claude 4.5 Optimized)
10+
> **Version:** 2.1.0 (Design Validator Integration)
1111
> **Role:** Build UI components with mock data. Focus on design quality and accessibility.
12+
> **Design Validation:** `.claude/lib/design-validator.md` (Part 2)
1213
1314
---
1415

@@ -68,27 +69,97 @@ WHY: UI development shouldn't be blocked by backend availability. Mock data enab
6869

6970
→ See `.claude/contexts/patterns/agent-discovery.md`
7071

71-
**STEP 0.5: Load Design & Content (uxui-frontend specific)**
72+
---
7273

73-
```bash
74-
# Check for project-specific design tokens
75-
Read: design-system/data.yaml
74+
## STEP 0.5: Load Design System (MANDATORY)
75+
76+
**Full Protocol:** `.claude/lib/design-validator.md` (Part 3)
77+
78+
**ก่อนเขียน CSS/Tailwind ใดๆ ต้องทำขั้นตอนนี้ก่อน:**
79+
80+
### ขั้นตอนที่ 1: อ่าน design-system/data.yaml
81+
82+
อ่านไฟล์ `design-system/data.yaml`
83+
84+
**ถ้ามีไฟล์:** จดค่าต่อไปนี้:
85+
- colors: primary, secondary, background, foreground, muted, accent (พร้อม hex values)
86+
- spacing scale: 4, 8, 12, 16, 24, 32, 48, 64
87+
- animation durations: **150ms, 300ms, 500ms เท่านั้น!**
88+
- shadows: sm, md, lg, xl
89+
- typography: font family, sizes
90+
91+
**ถ้าไม่มีไฟล์:**
92+
```
93+
⚠️ Design System NOT FOUND
94+
- Path: design-system/data.yaml (missing)
95+
- Fallback: Using .claude/contexts/design/*.md
96+
- Recommendation: Run /designsetup to generate design system
97+
```
98+
→ อ่าน `.claude/contexts/design/*.md` แทน
99+
100+
### ขั้นตอนที่ 2: อ่าน page-plan.md (ถ้ามี)
101+
102+
อ่านไฟล์ `openspec/changes/{change-id}/page-plan.md`
76103

77-
# Check for page plan (from /pageplan command)
78-
Read: openspec/changes/{change-id}/page-plan.md
104+
**ถ้ามี:**
105+
- ดู Component reuse list, new components, animation blueprint
106+
- ข้าม STEP 3 (component search) ไปเลย เพราะ page-plan ทำไว้แล้ว
107+
- Implement ทุก section ใน Section 2 (Page Structure)
108+
109+
### ขั้นตอนที่ 3: Report ก่อนเริ่มเขียน code
110+
111+
**ต้อง report นี้ก่อนเขียน CSS/Tailwind:**
112+
113+
```
114+
✅ Design System Loaded (STEP 0.5)
115+
- Source: design-system/data.yaml
116+
- Colors: primary=#xxx, secondary=#xxx, background=#xxx, foreground=#xxx
117+
- Spacing scale: 4, 8, 12, 16, 24, 32, 48, 64
118+
- Animation durations: 150ms, 300ms, 500ms
119+
- Shadows: sm, md, lg, xl
79120
```
80121

81-
**Priority order:**
82-
1. **data.yaml** (project-specific) → Use all tokens, colors, spacing, psychology
83-
2. **page-plan.md** (if exists) → Use component plan, content draft, animation blueprint
84-
3. **design/*.md** (fallback) → General design principles
122+
### กฎการใช้ Design Tokens
85123

86-
**If page-plan.md exists:**
87-
- Extract: Component reuse list, new components, content draft, animation blueprint (Section 2.6)
88-
- Skip STEP 3 (component search already done)
89-
- Implement ALL sections from Section 2 (Page Structure)
124+
**ห้ามใช้ (NEVER):**
90125

91-
WHY: page-plan.md has buyer avatar analysis and conversion-optimized content that tasks.md doesn't provide.
126+
| ห้าม | ตัวอย่าง |
127+
|------|---------|
128+
| Hardcoded colors | `#3b82f6`, `rgb(59,130,246)`, `text-blue-500` |
129+
| Arbitrary spacing | `p-5`, `gap-7`, `m-[13px]`, `p-[22px]` |
130+
| Random duration | `duration-200`, `duration-250`, `duration-400` |
131+
| Mixed shadow levels | ใช้ `shadow-sm` ที่หนึ่ง `shadow-xl` ที่อื่น |
132+
133+
**ต้องใช้ (ALWAYS):**
134+
135+
| ใช้ | ตัวอย่าง |
136+
|-----|---------|
137+
| Theme colors | `bg-primary`, `text-foreground`, `bg-muted` |
138+
| Spacing scale | `p-4`, `p-6`, `gap-8`, `m-16` |
139+
| Standard durations | `duration-150`, `duration-300`, `duration-500` |
140+
| Consistent shadows | เลือก level เดียวสำหรับ cards ทั้งหมด |
141+
142+
### ขั้นตอนที่ 4: Report หลังเขียน code เสร็จ
143+
144+
**ต้อง report การใช้ tokens ใน output:**
145+
146+
```
147+
📊 Design Token Usage Report
148+
Colors used: text-foreground, bg-primary, bg-muted, border-border
149+
Spacing used: p-4, p-6, p-8, gap-4, gap-8
150+
Animations: duration-150, duration-300
151+
Shadows: shadow-md (consistent)
152+
153+
✅ All tokens from data.yaml
154+
```
155+
156+
**ถ้ามี non-standard values ต้องบอกเหตุผล:**
157+
158+
```
159+
⚠️ Non-standard values used:
160+
- p-5 (reason: needed odd spacing for alignment)
161+
- #custom-color (reason: brand requirement not in data.yaml)
162+
```
92163

93164
---
94165

@@ -311,9 +382,21 @@ Design:
311382
- Shadows: {level}
312383
- Accessibility: {features}
313384

385+
📊 Design Token Usage Report:
386+
- Colors used: text-foreground, bg-primary, bg-muted, ...
387+
- Spacing used: p-4, p-6, gap-8, ...
388+
- Animations: duration-150, duration-300
389+
- Shadows: shadow-md
390+
391+
✅ All tokens from data.yaml
392+
OR
393+
⚠️ Non-standard values: {list with reasons}
394+
314395
Next Step: {next task or agent}
315396
```
316397

398+
**IMPORTANT:** Include token usage report in final output. ux-tester will validate these against data.yaml using Chrome DevTools.
399+
317400
---
318401

319402
## Handoff to Frontend Agent

0 commit comments

Comments
 (0)