@champpaba/claude-agent-kit 2.5.0 → 2.7.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 (32) hide show
  1. package/.claude/CLAUDE.md +103 -58
  2. package/.claude/agents/02-uxui-frontend.md +5 -6
  3. package/.claude/agents/07-ux-tester.md +407 -0
  4. package/.claude/commands/cdev.md +113 -8
  5. package/.claude/commands/csetup.md +86 -28
  6. package/.claude/commands/designsetup.md +171 -48
  7. package/.claude/commands/extract.md +382 -668
  8. package/.claude/commands/pageplan.md +43 -27
  9. package/.claude/contexts/design/box-thinking.md +4 -4
  10. package/.claude/contexts/design/color-theory.md +5 -5
  11. package/.claude/contexts/design/index.md +9 -9
  12. package/.claude/contexts/design/spacing.md +4 -4
  13. package/.claude/contexts/patterns/agent-discovery.md +1 -1
  14. package/.claude/contexts/patterns/animation-patterns.md +3 -3
  15. package/.claude/contexts/patterns/ui-component-consistency.md +3 -3
  16. package/.claude/lib/README.md +1 -1
  17. package/.claude/lib/agent-executor.md +223 -0
  18. package/.claude/lib/context-loading-protocol.md +5 -6
  19. package/.claude/lib/detailed-guides/agent-system.md +4 -4
  20. package/.claude/lib/detailed-guides/best-practices-system.md +5 -4
  21. package/.claude/lib/detailed-guides/context-optimization.md +21 -22
  22. package/.claude/lib/detailed-guides/design-system.md +6 -5
  23. package/.claude/lib/detailed-guides/page-planning.md +6 -6
  24. package/.claude/lib/document-loader.md +32 -47
  25. package/.claude/lib/task-analyzer.md +194 -1
  26. package/.claude/templates/PROJECT_STATUS.template.yml +1 -1
  27. package/.claude/templates/STYLE_GUIDE.template.md +7 -7
  28. package/.claude/templates/design-context-template.md +22 -29
  29. package/.claude/templates/page-plan-example.md +9 -9
  30. package/.claude/templates/phases-sections/ux-testing.md +164 -0
  31. package/README.md +3 -1
  32. package/package.json +1 -1
@@ -10,21 +10,21 @@
10
10
 
11
11
  **Before v1.2.0:**
12
12
  ```
13
- /pageplan → reads STYLE_GUIDE.md (~5K tokens)
14
- /csetup → reads STYLE_GUIDE.md (~5K tokens)
15
- /cdev → sends STYLE_GUIDE.md (~5K tokens)
16
- uxui-frontend → reads STYLE_GUIDE.md (~5K tokens)
13
+ /pageplan → reads data.yaml (~800 tokens)
14
+ /csetup → reads data.yaml (~800 tokens)
15
+ /cdev → sends data.yaml (~800 tokens)
16
+ uxui-frontend → reads data.yaml (~800 tokens)
17
17
  ────────────────────────────────────────────────
18
18
  Total: ~20K tokens (same content read 4 times!)
19
19
  ```
20
20
 
21
21
  **After v1.2.0:**
22
22
  ```
23
- /designsetup → generates STYLE_TOKENS.json (~500 tokens) ✅
24
- /pageplan → reads STYLE_TOKENS.json (~500 tokens) ✅
23
+ /designsetup → generates data.yaml (~500 tokens) ✅
24
+ /pageplan → reads data.yaml (~500 tokens) ✅
25
25
  /csetup → validates files exist (0 tokens) ✅
26
26
  /cdev → sends reference only (~200 tokens) ✅
27
- uxui-frontend → reads STYLE_TOKENS.json + selective STYLE_GUIDE (~3.5K) ✅
27
+ uxui-frontend → reads data.yaml (~800 tokens) ✅
28
28
  ────────────────────────────────────────────────
29
29
  Total: ~4.7K tokens (70% reduction!) ✨
30
30
  ```
@@ -33,7 +33,7 @@ Total: ~4.7K tokens (70% reduction!) ✨
33
33
 
34
34
  ## The Solution: 3-Tier Loading
35
35
 
36
- ### Tier 1: STYLE_TOKENS.json (500 tokens)
36
+ ### Tier 1: data.yaml (500 tokens)
37
37
 
38
38
  - Lightweight design tokens only
39
39
  - Used by: /pageplan, /csetup, agents
@@ -49,13 +49,13 @@ Total: ~4.7K tokens (70% reduction!) ✨
49
49
 
50
50
  **Purpose:** Agent orientation and file discovery
51
51
 
52
- ### Tier 3: STYLE_GUIDE.md (5K tokens)
52
+ ### Tier 3: README.md (100 tokens)
53
53
 
54
- - Full reference with examples
55
- - Loaded selectively (specific sections only)
56
- - Used by: agents (when needed)
54
+ - Human-readable summary
55
+ - NOT for agents (use data.yaml instead)
56
+ - Used by: humans reviewing design
57
57
 
58
- **Purpose:** Complete design system documentation
58
+ **Purpose:** Quick human reference
59
59
 
60
60
  ---
61
61
 
@@ -66,8 +66,8 @@ Total: ~4.7K tokens (70% reduction!) ✨
66
66
  ### Pattern A: Planning (/pageplan, /csetup)
67
67
 
68
68
  ```typescript
69
- Read: STYLE_TOKENS.json (~500 tokens)
70
- Validate: STYLE_GUIDE.md exists (0 tokens)
69
+ Read: data.yaml (~500 tokens)
70
+ Validate: data.yaml exists (0 tokens)
71
71
  Total: ~500 tokens
72
72
  ```
73
73
 
@@ -75,16 +75,15 @@ Total: ~500 tokens
75
75
 
76
76
  ```typescript
77
77
  Send: Design reference (~200 tokens)
78
- Agent reads: STYLE_TOKENS.json (~500 tokens)
78
+ Agent reads: data.yaml (~500 tokens)
79
79
  Total: ~700 tokens
80
80
  ```
81
81
 
82
82
  ### Pattern C: Agent (uxui-frontend)
83
83
 
84
84
  ```typescript
85
- Read: STYLE_TOKENS.json (~500 tokens)
86
- Read: STYLE_GUIDE sections (~2K tokens, selective)
87
- Total: ~2.5K tokens
85
+ Read: data.yaml (~800 tokens)
86
+ Total: ~800 tokens
88
87
  ```
89
88
 
90
89
  ---
@@ -103,10 +102,10 @@ Total: ~2.5K tokens
103
102
  ## Generated Files
104
103
 
105
104
  **/designsetup now creates:**
106
- 1. `design-system/STYLE_GUIDE.md` (full guide, 17 sections)
107
- 2. `design-system/STYLE_TOKENS.json` (tokens only) **NEW!**
105
+ 1. `design-system/data.yaml` (tokens + psychology, ~800 lines) **FOR AGENTS**
106
+ 2. `design-system/README.md` (human-readable summary, ~100 lines) **FOR HUMANS**
108
107
 
109
- **Agents automatically use both!**
108
+ **Agents read data.yaml only!**
110
109
 
111
110
  ---
112
111
 
@@ -30,11 +30,12 @@
30
30
 
31
31
  ---
32
32
 
33
- ## Generated File
33
+ ## Generated Files
34
34
 
35
35
  ```
36
36
  design-system/
37
- └── STYLE_GUIDE.mdComprehensive 17-section guide
37
+ ├── data.yamlDesign tokens + psychology (agent reads this)
38
+ └── README.md ← Human-readable summary
38
39
  ```
39
40
 
40
41
  **All 17 Sections (Complete):**
@@ -69,7 +70,7 @@ design-system/
69
70
  # 2. Setup change and project (discovers style guide, auto-detects tech stack)
70
71
  /csetup feature-login
71
72
 
72
- # 3. Start development (agents use STYLE_GUIDE.md)
73
+ # 3. Start development (agents use data.yaml)
73
74
  /cdev feature-login
74
75
  ```
75
76
 
@@ -78,7 +79,7 @@ design-system/
78
79
  ## Agent Discovery
79
80
 
80
81
  **uxui-frontend agent automatically reads:**
81
- 1. `design-system/STYLE_GUIDE.md` (if exists) ← **Priority #1**
82
+ 1. `design-system/data.yaml` (if exists) ← **Priority #1**
82
83
  2. `.claude/contexts/design/*.md` (general principles) ← Fallback
83
84
 
84
85
  **Why this matters:**
@@ -92,6 +93,6 @@ design-system/
92
93
  ## 🔗 See Also
93
94
 
94
95
  - `../../commands/designsetup.md` - /designsetup command (generates style guide)
95
- - `context-optimization.md` - 3-tier loading strategy (STYLE_TOKENS.json)
96
+ - `context-optimization.md` - 3-tier loading strategy (data.yaml)
96
97
  - `../../contexts/design/index.md` - General design principles (fallback)
97
98
  - `../../contexts/patterns/ui-component-consistency.md` - Component reuse patterns
@@ -34,7 +34,7 @@ User: /pageplan @prd.md @project_brief.md
34
34
  Main Claude:
35
35
  1. Reads user-specified files (@prd.md, @brief.md)
36
36
  2. Reads proposal.md (technical architecture)
37
- 3. Reads STYLE_GUIDE.md (visual design)
37
+ 3. Reads data.yaml (design tokens)
38
38
  4. Searches existing components (Glob/Grep)
39
39
  5. Generates: openspec/changes/{id}/page-plan.md
40
40
  - 🔄 Reuse: Navbar, Footer (found)
@@ -99,7 +99,7 @@ User: /cdev landing-page
99
99
  |----------------------|------------------------|
100
100
  | ❌ Agent guesses structure | ✅ Clear structure defined |
101
101
  | ❌ Duplicate components | ✅ Reuse existing components |
102
- | ❌ Inconsistent design | ✅ Sync with STYLE_GUIDE |
102
+ | ❌ Inconsistent design | ✅ Sync with data.yaml |
103
103
  | ❌ Lorem ipsum content | ✅ Real content from PRD |
104
104
  | ❌ Missing assets | ✅ Asset checklist prepared |
105
105
  | ❌ Agent wastes time searching | ✅ Search done once upfront (25% faster) |
@@ -124,14 +124,14 @@ User: /cdev landing-page
124
124
 
125
125
  ---
126
126
 
127
- ## Integration with STYLE_GUIDE
127
+ ## Integration with data.yaml
128
128
 
129
129
  ```
130
- STYLE_GUIDE.md Visual design (colors, spacing, shadows)
130
+ data.yaml Design tokens (colors, spacing, shadows, psychology)
131
131
  page-plan.md → Content structure (sections, components, assets)
132
132
 
133
133
  uxui-frontend agent combines both:
134
- - Colors from STYLE_GUIDE (#0d7276)
134
+ - Colors from data.yaml (#0d7276)
135
135
  - Content from page-plan ("Master TOEIC...")
136
136
  - Result: Consistent + Real content
137
137
  ```
@@ -141,7 +141,7 @@ uxui-frontend agent combines both:
141
141
  ## 🔗 See Also
142
142
 
143
143
  - `../../commands/pageplan.md` - /pageplan command implementation
144
- - `../../commands/designsetup.md` - /designsetup command (generates STYLE_GUIDE.md)
144
+ - `../../commands/designsetup.md` - /designsetup command (generates data.yaml + README.md)
145
145
  - `../../contexts/patterns/ui-component-consistency.md` - Component reuse patterns
146
146
  - `../../contexts/patterns/frontend-component-strategy.md` - When to create vs reuse
147
147
  - `../document-loader.md` - Token-efficient loading patterns
@@ -31,7 +31,7 @@ Why: Lightweight summary that points to full resources
31
31
 
32
32
  ### Tier 2: Design Tokens (Load for UI Work)
33
33
  ```
34
- File: design-system/STYLE_TOKENS.json
34
+ File: design-system/data.yaml
35
35
  Tokens: ~500
36
36
  Contains: Colors, spacing, typography, shadows, borders, animations
37
37
 
@@ -39,14 +39,14 @@ When: Commands/agents that need design tokens (pageplan, csetup, uxui-frontend)
39
39
  Why: Lightweight token-only file for quick reference
40
40
  ```
41
41
 
42
- ### Tier 3: Full Style Guide (Optional - Selective Loading)
42
+ ### Tier 3: Human-Readable Summary (Optional)
43
43
  ```
44
- File: design-system/STYLE_GUIDE.md
45
- Tokens: ~5000 (full) or ~2000 (selective sections)
46
- Contains: 17 sections including examples, patterns, component library
44
+ File: design-system/README.md
45
+ Tokens: ~100 (human-readable summary)
46
+ Contains: Quick reference for humans, not for agents
47
47
 
48
- When: Agent needs detailed examples or specific sections
49
- Why: Full reference, but load selectively to save tokens
48
+ When: Human wants to read design summary
49
+ Why: Short, scannable summary for humans
50
50
  ```
51
51
 
52
52
  ### Tier 4: Universal Principles (Fallback)
@@ -65,7 +65,7 @@ Why: Universal design principles apply to any project
65
65
 
66
66
  ### Pattern A: Planning Commands (/pageplan, /csetup)
67
67
 
68
- **Goal:** Understand design system without loading full STYLE_GUIDE
68
+ **Goal:** Understand design system efficiently
69
69
 
70
70
  ```typescript
71
71
  function loadDesignContext(projectName: string) {
@@ -77,18 +77,15 @@ function loadDesignContext(projectName: string) {
77
77
  context.summary = Read(designContextPath) // ~1K tokens
78
78
  }
79
79
 
80
- // 2. Load STYLE_TOKENS.json (design tokens only)
81
- const tokensPath = 'design-system/STYLE_TOKENS.json'
80
+ // 2. Load data.yaml (design tokens only)
81
+ const tokensPath = 'design-system/data.yaml'
82
82
  if (exists(tokensPath)) {
83
83
  context.tokens = JSON.parse(Read(tokensPath)) // ~500 tokens
84
84
  }
85
85
 
86
- // 3. Validate STYLE_GUIDE.md exists (don't load!)
87
- const styleGuidePath = 'design-system/STYLE_GUIDE.md'
88
- context.hasStyleGuide = exists(styleGuidePath)
89
-
90
- if (!context.hasStyleGuide && hasFrontendWork) {
91
- warn(`⚠️ UI work detected but no STYLE_GUIDE.md
86
+ // 3. Validate data.yaml loaded successfully
87
+ if (!context.tokens && hasFrontendWork) {
88
+ warn(`⚠️ UI work detected but no data.yaml
92
89
  Run: /designsetup`)
93
90
  }
94
91
 
@@ -115,8 +112,7 @@ const spacingScale = designContext.tokens.spacing.scale
115
112
  ```typescript
116
113
  function buildDesignReference(projectName: string): string {
117
114
  const designContextPath = `.claude/contexts/domain/${projectName}/design-context.md`
118
- const tokensPath = 'design-system/STYLE_TOKENS.json'
119
- const styleGuidePath = 'design-system/STYLE_GUIDE.md'
115
+ const tokensPath = 'design-system/data.yaml'
120
116
 
121
117
  // Don't load content! Just send paths + minimal summary
122
118
  return `
@@ -128,10 +124,7 @@ function buildDesignReference(projectName: string): string {
128
124
  → Project design summary, file paths
129
125
 
130
126
  2. Read: ${tokensPath} (~500 tokens)
131
- → Design tokens (colors, spacing, typography)
132
-
133
- 3. Optional: ${styleGuidePath} (selective sections ~2K tokens)
134
- → Full guide - load Component Styles, Layout Patterns if needed
127
+ → Design tokens (colors, spacing, typography, psychology)
135
128
 
136
129
  **Style Guidelines:**
137
130
  | Instead of | Use | WHY |
@@ -140,7 +133,7 @@ function buildDesignReference(projectName: string): string {
140
133
  | p-5 | p-4 or p-6 | Spacing scale |
141
134
 
142
135
  **Report format:**
143
- "Design Context Loaded: design-context.md + STYLE_TOKENS.json"
136
+ "Design Context Loaded: design-context.md + data.yaml"
144
137
  "Design Tokens Extracted: [list key tokens]"
145
138
  `
146
139
 
@@ -170,13 +163,13 @@ async function loadDesignSystem(projectName: string) {
170
163
  warn(`⚠️ No design-context.md - using fallback`)
171
164
  }
172
165
 
173
- // STEP 0.5.2: Load STYLE_TOKENS.json
174
- const tokensPath = 'design-system/STYLE_TOKENS.json'
166
+ // STEP 0.5.2: Load data.yaml
167
+ const tokensPath = 'design-system/data.yaml'
175
168
  let tokens = null
176
169
 
177
170
  if (exists(tokensPath)) {
178
171
  tokens = JSON.parse(Read(tokensPath)) // ~500 tokens
179
- report.push(`✅ STYLE_TOKENS.json loaded`)
172
+ report.push(`✅ data.yaml loaded`)
180
173
  }
181
174
 
182
175
  // STEP 0.5.3: Extract key tokens
@@ -192,14 +185,7 @@ async function loadDesignSystem(projectName: string) {
192
185
  report.push(` - Spacing: ${extractedTokens.spacing.join(', ')}px`)
193
186
  report.push(` - Component Library: ${extractedTokens.componentLibrary}`)
194
187
 
195
- // STEP 0.5.4: Optional - Load specific STYLE_GUIDE sections
196
- const styleGuidePath = 'design-system/STYLE_GUIDE.md'
197
- if (needsDetailedExamples && exists(styleGuidePath)) {
198
- // Selective loading: Only Component Styles section
199
- const fullGuide = Read(styleGuidePath)
200
- const componentSection = extractSection(fullGuide, '## 6. Component Styles')
201
- report.push(`✅ STYLE_GUIDE.md (Section 6: Component Styles) loaded`)
202
- }
188
+ // STEP 0.5.4: data.yaml contains all design info - no need for separate files
203
189
 
204
190
  // Report to user
205
191
  output(`
@@ -220,10 +206,9 @@ ${report.join('\n')}
220
206
 
221
207
  | Approach | Tier 1 | Tier 2 | Tier 3 | Total | Use Case |
222
208
  |----------|--------|--------|--------|-------|----------|
223
- | **Planning** (pageplan, csetup) | design-context.md (1K) | STYLE_TOKENS.json (500) | - | **1.5K** | ✅ Efficient |
209
+ | **Planning** (pageplan, csetup) | design-context.md (1K) | data.yaml (500) | - | **1.5K** | ✅ Efficient |
224
210
  | **Execution** (/cdev) | Reference only (200) | - | - | **200** | ✅ Very efficient |
225
- | **Agent** (uxui-frontend) | design-context.md (1K) | STYLE_TOKENS.json (500) | Selective sections (2K) | **3.5K** | ✅ Good |
226
- | **Old approach** | - | - | Full STYLE_GUIDE (5K) | **5K** | ❌ Wasteful |
211
+ | **Agent** (uxui-frontend) | design-context.md (1K) | data.yaml (500) | - | **1.5K** | ✅ Efficient |
227
212
 
228
213
  **Savings: 70-95% reduction in tokens!**
229
214
 
@@ -234,8 +219,8 @@ ${report.join('\n')}
234
219
  | Practice | WHY |
235
220
  |----------|-----|
236
221
  | Load design-context.md first | Entry point with file paths |
237
- | Load STYLE_TOKENS.json for UI work | Lightweight token reference |
238
- | Load STYLE_GUIDE.md selectively | Save tokens (5K 2K) |
222
+ | Load data.yaml for UI work | Lightweight token reference |
223
+ | Use data.yaml for tokens | ~500 tokens, contains all design info |
239
224
  | Validate files exist before loading | Prevent errors |
240
225
  | Report what was loaded | Transparency for debugging |
241
226
  | Skip design files for backend/database | Not needed, saves tokens |
@@ -252,13 +237,13 @@ function loadDesignFallback() {
252
237
  warn(`⚠️ No design-context.md found
253
238
  Attempting fallback...`)
254
239
 
255
- // Option 1: Load STYLE_TOKENS.json directly
256
- if (exists('design-system/STYLE_TOKENS.json')) {
257
- return { tokens: JSON.parse(Read('design-system/STYLE_TOKENS.json')) }
240
+ // Option 1: Load data.yaml directly
241
+ if (exists('design-system/data.yaml')) {
242
+ return { tokens: JSON.parse(Read('design-system/data.yaml')) }
258
243
  }
259
244
 
260
245
  // Option 2: Load universal design principles
261
- warn(`⚠️ No STYLE_TOKENS.json - using universal principles`)
246
+ warn(`⚠️ No data.yaml - using universal principles`)
262
247
  return {
263
248
  universal: [
264
249
  Read('.claude/contexts/design/box-thinking.md'),
@@ -286,8 +271,8 @@ if (designContext.tokens) {
286
271
  output(`Using primary color: ${primary}`)
287
272
  }
288
273
 
289
- if (!designContext.hasStyleGuide) {
290
- warn(`⚠️ No STYLE_GUIDE.md - run /designsetup first`)
274
+ if (!designContext.tokens) {
275
+ warn(`⚠️ No data.yaml - run /designsetup first`)
291
276
  }
292
277
  ```
293
278
 
@@ -339,8 +324,8 @@ const Button = `
339
324
  - [ ] Identify if command deals with UI/design
340
325
  - [ ] Use appropriate loading pattern (A, B, or C)
341
326
  - [ ] Load design-context.md first
342
- - [ ] Load STYLE_TOKENS.json if needed
343
- - [ ] Only load STYLE_GUIDE.md selectively
327
+ - [ ] Load data.yaml if needed
328
+ - [ ] Load data.yaml for design tokens
344
329
  - [ ] Validate files exist
345
330
  - [ ] Report what was loaded
346
331
  - [ ] Handle fallback gracefully
@@ -255,7 +255,7 @@ function detectResearchNeeds(task: Task, changeContext: any): ResearchRequiremen
255
255
  }
256
256
 
257
257
  // Special case: If no design system exists and UI work detected
258
- if (task.type === 'uxui-frontend' && !fileExists('design-system/STYLE_GUIDE.md')) {
258
+ if (task.type === 'uxui-frontend' && !fileExists('design-system/data.yaml')) {
259
259
  detectedPatterns.push({
260
260
  category: 'missingDesignSystem',
261
261
  reason: 'No design system found - component library selection needed',
@@ -1087,4 +1087,197 @@ function calculateBuffer(complexity: number, risk: RiskLevel): number {
1087
1087
 
1088
1088
  ---
1089
1089
 
1090
+ ## 🧪 UX Testing Phase Injection (v2.7.0)
1091
+
1092
+ > **NEW:** Auto-inject Phase 1.5 (UX Testing) after uxui-frontend phase
1093
+
1094
+ ### Purpose
1095
+
1096
+ Ensure UI is tested from user perspectives before proceeding to backend development.
1097
+
1098
+ ### Detection Logic
1099
+
1100
+ ```typescript
1101
+ function shouldInjectUXTesting(phases: Phase[]): boolean {
1102
+ // Check if any phase uses uxui-frontend agent
1103
+ return phases.some(p => p.agent === 'uxui-frontend')
1104
+ }
1105
+ ```
1106
+
1107
+ ### Injection Logic
1108
+
1109
+ ```typescript
1110
+ function injectUXTestingPhase(phases: Phase[], context?: ChangeContext): Phase[] {
1111
+ // Step 1: Check if should inject
1112
+ if (!shouldInjectUXTesting(phases)) {
1113
+ return phases // No UI work, skip injection
1114
+ }
1115
+
1116
+ // Step 2: Check skip conditions (optional context)
1117
+ if (context && shouldSkipUXTesting(phases, context)) {
1118
+ return phases // Skip due to context conditions
1119
+ }
1120
+
1121
+ // Step 3: Find the last uxui-frontend phase
1122
+ const lastUxuiFrontendIndex = phases
1123
+ .map((p, i) => p.agent === 'uxui-frontend' ? i : -1)
1124
+ .filter(i => i >= 0)
1125
+ .pop()
1126
+
1127
+ if (lastUxuiFrontendIndex === undefined) {
1128
+ return phases
1129
+ }
1130
+
1131
+ // Step 4: Create UX Testing phase
1132
+ const uxTestingPhase: Phase = {
1133
+ number: `${phases[lastUxuiFrontendIndex].number}.5`, // e.g., "1.5"
1134
+ name: 'UX Testing',
1135
+ agent: 'ux-tester',
1136
+ estimatedTime: 30,
1137
+ metadata: ['approval-gate', 'user-testing', 'persona-based'],
1138
+ requires_approval: true,
1139
+ description: 'Test UI from user perspectives before backend development'
1140
+ }
1141
+
1142
+ // Step 5: Insert after the last uxui-frontend phase
1143
+ const newPhases = [...phases]
1144
+ newPhases.splice(lastUxuiFrontendIndex + 1, 0, uxTestingPhase)
1145
+
1146
+ // Step 6: Renumber subsequent phases if needed
1147
+ return renumberPhases(newPhases)
1148
+ }
1149
+
1150
+ function renumberPhases(phases: Phase[]): Phase[] {
1151
+ // Keep .5 phases as-is, renumber whole numbers
1152
+ let wholeNumber = 1
1153
+
1154
+ return phases.map(phase => {
1155
+ if (phase.number.toString().includes('.5')) {
1156
+ return phase // Keep .5 as-is
1157
+ }
1158
+
1159
+ const newPhase = { ...phase, number: wholeNumber }
1160
+ wholeNumber++
1161
+ return newPhase
1162
+ })
1163
+ }
1164
+ ```
1165
+
1166
+ ### Integration Point
1167
+
1168
+ **In `/csetup` command, after phase generation:**
1169
+
1170
+ ```typescript
1171
+ // STEP 4: Generate phases from template
1172
+ let phases = generatePhasesFromTemplate(templateName, analyzedTasks)
1173
+
1174
+ // STEP 4.5: Inject UX Testing phase (NEW v2.7.0)
1175
+ phases = injectUXTestingPhase(phases)
1176
+
1177
+ output(`
1178
+ 📊 Phases Generated:
1179
+ ${phases.map(p => ` Phase ${p.number}: ${p.name} (${p.agent})`).join('\n')}
1180
+
1181
+ ${phases.some(p => p.agent === 'ux-tester') ?
1182
+ '🧪 UX Testing phase auto-injected after uxui-frontend' : ''}
1183
+ `)
1184
+
1185
+ // STEP 5: Write phases.md
1186
+ writePhasesFile(phases, changeId)
1187
+ ```
1188
+
1189
+ ### Output Example
1190
+
1191
+ **Before injection:**
1192
+ ```
1193
+ Phase 1: Frontend Mockup (uxui-frontend)
1194
+ Phase 2: Backend API (backend)
1195
+ Phase 3: Database Schema (database)
1196
+ Phase 4: Frontend Integration (frontend)
1197
+ Phase 5: Testing (test-debug)
1198
+ ```
1199
+
1200
+ **After injection:**
1201
+ ```
1202
+ Phase 1: Frontend Mockup (uxui-frontend)
1203
+ Phase 1.5: UX Testing (ux-tester) ← AUTO-INJECTED
1204
+ Phase 2: Backend API (backend)
1205
+ Phase 3: Database Schema (database)
1206
+ Phase 4: Frontend Integration (frontend)
1207
+ Phase 5: Testing (test-debug)
1208
+ ```
1209
+
1210
+ ### Approval Gate Behavior
1211
+
1212
+ When `/cdev` reaches Phase 1.5:
1213
+
1214
+ 1. `ux-tester` agent runs and generates report
1215
+ 2. Workflow **PAUSES** - waits for user
1216
+ 3. User options:
1217
+ - `approve` → Continue to Phase 2
1218
+ - `reject [feedback]` → Loop back to Phase 1
1219
+
1220
+ ```
1221
+ Phase 1 (uxui-frontend) ──► Phase 1.5 (ux-tester) ──► [PAUSE]
1222
+ ▲ │
1223
+ │ ▼
1224
+ └──────────── reject ◄────────────────── User Decision
1225
+
1226
+
1227
+ approve ──► Phase 2
1228
+ ```
1229
+
1230
+ ### Skip Conditions
1231
+
1232
+ **Do NOT inject UX Testing if:**
1233
+
1234
+ ```typescript
1235
+ function shouldSkipUXTesting(phases: Phase[], context: ChangeContext): boolean {
1236
+ // 1. No UI work detected (redundant with shouldInjectUXTesting but kept for clarity)
1237
+ if (!phases.some(p => p.agent === 'uxui-frontend')) {
1238
+ return true
1239
+ }
1240
+
1241
+ // 2. Backend-only or API-only change (detected from proposal/tasks)
1242
+ const changeType = detectChangeType(context.proposal, context.tasks)
1243
+ if (changeType === 'backend-only' || changeType === 'api-only') {
1244
+ return true
1245
+ }
1246
+
1247
+ // 3. User explicitly disabled (via flags.json)
1248
+ if (context.flags?.skip_ux_testing === true) {
1249
+ return true
1250
+ }
1251
+
1252
+ // 4. Minor UI fix (average complexity < 3)
1253
+ const uiPhases = phases.filter(p => p.agent === 'uxui-frontend')
1254
+ if (uiPhases.length > 0) {
1255
+ const avgComplexity = uiPhases.reduce((sum, p) => sum + (p.complexity || 5), 0) / uiPhases.length
1256
+ if (avgComplexity < 3) {
1257
+ return true
1258
+ }
1259
+ }
1260
+
1261
+ return false
1262
+ }
1263
+
1264
+ // Helper: Detect change type from content
1265
+ function detectChangeType(proposal: string, tasks: string): string {
1266
+ const content = `${proposal} ${tasks}`.toLowerCase()
1267
+
1268
+ // Check for UI indicators
1269
+ const hasUI = content.match(/landing|page|component|ui|frontend|form|button|modal|dashboard/i)
1270
+
1271
+ // Check for backend-only indicators
1272
+ const isBackendOnly = content.match(/api.only|backend.only|no.ui|cli|cron|migration|script/i)
1273
+
1274
+ if (isBackendOnly && !hasUI) return 'backend-only'
1275
+ if (!hasUI) return 'api-only'
1276
+
1277
+ return 'full-stack' // default
1278
+ }
1279
+ ```
1280
+
1281
+ ---
1282
+
1090
1283
  **This framework transforms simple tasks.md into intelligent, analyzed workflows! 🚀**
@@ -167,4 +167,4 @@ notes: |
167
167
  references:
168
168
  # roadmap: "docs/proposal_list.md"
169
169
  # architecture: "openspec/specs/architecture.md"
170
- # style_guide: "design-system/STYLE_GUIDE.md"
170
+ # design_tokens: "design-system/data.yaml"
@@ -734,10 +734,10 @@ module.exports = {
734
734
 
735
735
  **Priority:**
736
736
  ```
737
- STYLE_GUIDE.md > best-practices/ > generic design contexts
737
+ data.yaml > best-practices/ > generic design contexts
738
738
  ```
739
739
 
740
- This file is the single source of truth for design.
740
+ The data.yaml file is the single source of truth for design.
741
741
 
742
742
  ### For Designers
743
743
 
@@ -752,7 +752,7 @@ This file is the single source of truth for design.
752
752
 
753
753
  **Good:**
754
754
  ```tsx
755
- // Uses STYLE_GUIDE values
755
+ // Uses data.yaml values
756
756
  <button className="bg-[#6366f1] px-4 py-2 rounded-md shadow-sm">
757
757
  Sign In
758
758
  </button>
@@ -760,7 +760,7 @@ This file is the single source of truth for design.
760
760
 
761
761
  **Bad:**
762
762
  ```tsx
763
- // Arbitrary values not in STYLE_GUIDE
763
+ // Arbitrary values not in data.yaml
764
764
  <button className="bg-[#5555ff] px-5 py-3 rounded-lg shadow-md">
765
765
  Sign In
766
766
  </button>
@@ -800,7 +800,7 @@ Before submitting a new component, verify:
800
800
  ```
801
801
 
802
802
  2. **Review changes:**
803
- - Compare new STYLE_GUIDE with old
803
+ - Compare new data.yaml with old
804
804
  - Identify breaking changes
805
805
  - Document migration path
806
806
 
@@ -846,11 +846,11 @@ Before submitting a new component, verify:
846
846
 
847
847
  ### Components look inconsistent
848
848
 
849
- **Cause:** Not following STYLE_GUIDE, using arbitrary values
849
+ **Cause:** Not following data.yaml, using arbitrary values
850
850
 
851
851
  **Solution:**
852
852
  - Review component code
853
- - Compare against STYLE_GUIDE values
853
+ - Compare against data.yaml values
854
854
  - Refactor to match specifications
855
855
 
856
856
  ---