claude-code-workflow 6.0.5 → 6.1.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 (117) hide show
  1. package/.claude/agents/action-planning-agent.md +1 -1
  2. package/.claude/agents/cli-execution-agent.md +269 -269
  3. package/.claude/agents/cli-explore-agent.md +182 -182
  4. package/.claude/agents/context-search-agent.md +582 -582
  5. package/.claude/agents/memory-bridge.md +93 -93
  6. package/.claude/commands/cli/cli-init.md +1 -1
  7. package/.claude/commands/memory/docs-full-cli.md +471 -471
  8. package/.claude/commands/memory/docs-related-cli.md +386 -386
  9. package/.claude/commands/memory/docs.md +615 -615
  10. package/.claude/commands/memory/load.md +1 -1
  11. package/.claude/commands/memory/update-full.md +332 -332
  12. package/.claude/commands/memory/update-related.md +5 -5
  13. package/.claude/commands/workflow/init.md +1 -1
  14. package/.claude/commands/workflow/lite-fix.md +621 -621
  15. package/.claude/commands/workflow/lite-plan.md +592 -592
  16. package/.claude/commands/workflow/tools/context-gather.md +434 -434
  17. package/.claude/commands/workflow/ui-design/generate.md +504 -504
  18. package/.claude/commands/workflow/ui-design/import-from-code.md +537 -537
  19. package/.claude/scripts/classify-folders.sh +4 -0
  20. package/.claude/scripts/convert_tokens_to_css.sh +4 -0
  21. package/.claude/scripts/detect_changed_modules.sh +5 -1
  22. package/.claude/scripts/discover-design-files.sh +87 -83
  23. package/.claude/scripts/generate_module_docs.sh +717 -713
  24. package/.claude/scripts/get_modules_by_depth.sh +5 -1
  25. package/.claude/scripts/ui-generate-preview.sh +4 -0
  26. package/.claude/scripts/ui-instantiate-prototypes.sh +4 -0
  27. package/.claude/scripts/update_module_claude.sh +4 -0
  28. package/.claude/skills/command-guide/index/all-commands.json +1 -12
  29. package/.claude/skills/command-guide/index/by-category.json +1 -12
  30. package/.claude/skills/command-guide/index/by-use-case.json +1 -12
  31. package/.claude/skills/command-guide/index/essential-commands.json +1 -12
  32. package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +127 -71
  33. package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +269 -269
  34. package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +182 -182
  35. package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +18 -38
  36. package/.claude/skills/command-guide/reference/agents/context-search-agent.md +582 -577
  37. package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
  38. package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +1 -1
  39. package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
  40. package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
  41. package/.claude/skills/command-guide/reference/commands/memory/docs.md +615 -610
  42. package/.claude/skills/command-guide/reference/commands/memory/load.md +1 -1
  43. package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
  44. package/.claude/skills/command-guide/reference/commands/memory/update-related.md +5 -5
  45. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +299 -451
  46. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +14 -37
  47. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +252 -350
  48. package/.claude/skills/command-guide/reference/commands/workflow/init.md +2 -2
  49. package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +52 -0
  50. package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +621 -602
  51. package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +46 -36
  52. package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +18 -58
  53. package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +22 -52
  54. package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +19 -48
  55. package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +25 -5
  56. package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +1 -1
  57. package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +7 -7
  58. package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
  59. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +151 -11
  60. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +4 -4
  61. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +1 -1
  62. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +504 -504
  63. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +537 -537
  64. package/.claude/workflows/context-search-strategy.md +77 -77
  65. package/.claude/workflows/tool-strategy.md +90 -71
  66. package/.claude/workflows/workflow-architecture.md +1 -1
  67. package/ccw/src/cli.js +7 -0
  68. package/ccw/src/commands/tool.js +181 -0
  69. package/ccw/src/core/dashboard-generator.js +18 -3
  70. package/ccw/src/core/lite-scanner.js +35 -11
  71. package/ccw/src/core/server.js +531 -46
  72. package/ccw/src/templates/dashboard-css/01-base.css +161 -0
  73. package/ccw/src/templates/dashboard-css/02-session.css +726 -0
  74. package/ccw/src/templates/dashboard-css/03-tasks.css +512 -0
  75. package/ccw/src/templates/dashboard-css/04-lite-tasks.css +843 -0
  76. package/ccw/src/templates/dashboard-css/05-context.css +2206 -0
  77. package/ccw/src/templates/dashboard-css/06-cards.css +1570 -0
  78. package/ccw/src/templates/dashboard-css/07-managers.css +936 -0
  79. package/ccw/src/templates/dashboard-css/08-review.css +1266 -0
  80. package/ccw/src/templates/dashboard-css/09-explorer.css +1397 -0
  81. package/ccw/src/templates/dashboard-js/components/global-notifications.js +219 -0
  82. package/ccw/src/templates/dashboard-js/components/hook-manager.js +10 -0
  83. package/ccw/src/templates/dashboard-js/components/mcp-manager.js +11 -1
  84. package/ccw/src/templates/dashboard-js/components/navigation.js +11 -5
  85. package/ccw/src/templates/dashboard-js/components/tabs-context.js +20 -20
  86. package/ccw/src/templates/dashboard-js/components/tabs-other.js +11 -11
  87. package/ccw/src/templates/dashboard-js/components/theme.js +29 -1
  88. package/ccw/src/templates/dashboard-js/main.js +4 -0
  89. package/ccw/src/templates/dashboard-js/state.js +5 -0
  90. package/ccw/src/templates/dashboard-js/views/explorer.js +852 -0
  91. package/ccw/src/templates/dashboard-js/views/home.js +13 -9
  92. package/ccw/src/templates/dashboard-js/views/hook-manager.js +8 -5
  93. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +21 -16
  94. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +90 -19
  95. package/ccw/src/templates/dashboard-js/views/project-overview.js +15 -11
  96. package/ccw/src/templates/dashboard-js/views/review-session.js +3 -3
  97. package/ccw/src/templates/dashboard-js/views/session-detail.js +38 -28
  98. package/ccw/src/templates/dashboard.html +129 -28
  99. package/ccw/src/tools/classify-folders.js +204 -0
  100. package/ccw/src/tools/convert-tokens-to-css.js +250 -0
  101. package/ccw/src/tools/detect-changed-modules.js +288 -0
  102. package/ccw/src/tools/discover-design-files.js +134 -0
  103. package/ccw/src/tools/edit-file.js +266 -0
  104. package/ccw/src/tools/generate-module-docs.js +416 -0
  105. package/ccw/src/tools/get-modules-by-depth.js +308 -0
  106. package/ccw/src/tools/index.js +176 -0
  107. package/ccw/src/tools/ui-generate-preview.js +327 -0
  108. package/ccw/src/tools/ui-instantiate-prototypes.js +301 -0
  109. package/ccw/src/tools/update-module-claude.js +380 -0
  110. package/package.json +1 -1
  111. package/.claude/skills/command-guide/reference/commands/workflow/status.md +0 -352
  112. package/ccw/src/core/server.js.bak +0 -385
  113. package/ccw/src/core/server_original.bak +0 -385
  114. package/ccw/src/templates/dashboard.css +0 -8187
  115. package/ccw/src/templates/dashboard_tailwind.html +0 -42
  116. package/ccw/src/templates/dashboard_test.html +0 -37
  117. package/ccw/src/templates/tailwind-base.css +0 -212
@@ -1,504 +1,504 @@
1
- ---
2
- name: generate
3
- description: Assemble UI prototypes by combining layout templates with design tokens (default animation support), pure assembler without new content generation
4
- argument-hint: [--design-id <id>] [--session <id>]
5
- allowed-tools: TodoWrite(*), Read(*), Write(*), Task(ui-design-agent), Bash(*)
6
- ---
7
-
8
- # Generate UI Prototypes (/workflow:ui-design:generate)
9
-
10
- ## Overview
11
- Pure assembler that combines pre-extracted layout templates with design tokens to generate UI prototypes (`style × layout × targets`). No layout design logic - purely combines existing components.
12
-
13
- **Strategy**: Pure Assembly
14
- - **Input**: `layout-*.json` files + `design-tokens.json` (+ reference images if available)
15
- - **Process**: Combine structure (DOM) with style (tokens)
16
- - **Output**: Complete HTML/CSS prototypes
17
- - **No Design Logic**: All layout and style decisions already made
18
- - **Automatic Image Reference**: If source images exist in layout templates, they're automatically used for visual context
19
-
20
- **Prerequisite Commands**:
21
- - `/workflow:ui-design:style-extract` → Complete design systems (design-tokens.json + style-guide.md)
22
- - `/workflow:ui-design:layout-extract` → Layout structure
23
-
24
- ## Execution Process
25
-
26
- ```
27
- Input Parsing:
28
- ├─ Parse flags: --design-id, --session
29
- └─ Decision (base path resolution):
30
- ├─ --design-id provided → Exact match by design ID
31
- ├─ --session provided → Latest in session
32
- └─ No flags → Latest globally
33
-
34
- Phase 1: Setup & Validation
35
- ├─ Step 1: Resolve base path & parse configuration
36
- ├─ Step 2: Load layout templates
37
- ├─ Step 3: Validate design tokens
38
- └─ Step 4: Load animation tokens (optional)
39
-
40
- Phase 2: Assembly (Agent)
41
- ├─ Step 1: Calculate agent grouping plan
42
- │ └─ Grouping rules:
43
- │ ├─ Style isolation: Each agent processes ONE style
44
- │ ├─ Balanced distribution: Layouts evenly split
45
- │ └─ Max 10 layouts per agent, max 6 concurrent agents
46
- ├─ Step 2: Launch batched assembly tasks (parallel)
47
- └─ Step 3: Verify generated files
48
-
49
- Phase 3: Generate Preview Files
50
- ├─ Step 1: Run preview generation script
51
- └─ Step 2: Verify preview files
52
- ```
53
-
54
- ## Phase 1: Setup & Validation
55
-
56
- ### Step 1: Resolve Base Path & Parse Configuration
57
- ```bash
58
- # Determine base path with priority: --design-id > --session > auto-detect
59
- if [ -n "$DESIGN_ID" ]; then
60
- # Exact match by design ID
61
- relative_path=$(find .workflow -name "${DESIGN_ID}" -type d -print -quit)
62
- elif [ -n "$SESSION_ID" ]; then
63
- # Latest in session
64
- relative_path=$(find .workflow/active/WFS-$SESSION_ID -name "design-run-*" -type d -printf "%T@ %p\n" 2>/dev/null | sort -nr | head -1 | cut -d' ' -f2)
65
- else
66
- # Latest globally
67
- relative_path=$(find .workflow -name "design-run-*" -type d -printf "%T@ %p\n" 2>/dev/null | sort -nr | head -1 | cut -d' ' -f2)
68
- fi
69
-
70
- # Validate and convert to absolute path
71
- if [ -z "$relative_path" ] || [ ! -d "$relative_path" ]; then
72
- echo "❌ ERROR: Design run not found"
73
- echo "💡 HINT: Run '/workflow:ui-design:list' to see available design runs"
74
- exit 1
75
- fi
76
-
77
- base_path=$(cd "$relative_path" && pwd)
78
- bash(echo "✓ Base path: $base_path")
79
-
80
- # Get style count
81
- bash(ls "$base_path"/style-extraction/style-* -d | wc -l)
82
-
83
- # Image reference auto-detected from layout template source_image_path
84
- ```
85
-
86
- ### Step 2: Load Layout Templates
87
- ```bash
88
- # Check layout templates exist (multi-file pattern)
89
- bash(find {base_path}/layout-extraction -name "layout-*.json" -print -quit | grep -q . && echo "exists")
90
-
91
- # Get list of all layout files
92
- bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null)
93
-
94
- # Load each layout template file
95
- FOR each layout_file in layout_files:
96
- template_data = Read(layout_file)
97
- # Extract: target, variant_id, device_type, dom_structure, css_layout_rules
98
-
99
- # Aggregate: targets[], layout_variants count, device_type, all template structures
100
- ```
101
-
102
- **Output**: `base_path`, `style_variants`, `layout_templates[]`, `targets[]`, `device_type`
103
-
104
- ### Step 3: Validate Design Tokens
105
- ```bash
106
- # Check design tokens exist for all styles
107
- bash(test -f {base_path}/style-extraction/style-1/design-tokens.json && echo "valid")
108
-
109
- # For each style variant: Load design tokens
110
- Read({base_path}/style-extraction/style-{id}/design-tokens.json)
111
- ```
112
-
113
- **Output**: `design_tokens[]` for all style variants
114
-
115
- ### Step 4: Load Animation Tokens (Optional)
116
- ```bash
117
- # Check if animation tokens exist
118
- bash(test -f {base_path}/animation-extraction/animation-tokens.json && echo "exists")
119
-
120
- # Load animation tokens if available
121
- IF exists({base_path}/animation-extraction/animation-tokens.json):
122
- animation_tokens = Read({base_path}/animation-extraction/animation-tokens.json)
123
- has_animations = true
124
- ELSE:
125
- has_animations = false
126
- ```
127
-
128
- **Output**: `animation_tokens` (optional), `has_animations` flag
129
-
130
- ## Phase 2: Assembly (Agent)
131
-
132
- **Executor**: `Task(ui-design-agent)` grouped by `target × style` (max 10 layouts per agent, max 6 concurrent agents)
133
-
134
- **⚠️ Core Principle**: **Each agent processes ONLY ONE style** (but can process multiple layouts for that style)
135
-
136
- ### Agent Grouping Strategy
137
-
138
- **Grouping Rules**:
139
- 1. **Style Isolation**: Each agent processes ONLY ONE style (never mixed)
140
- 2. **Balanced Distribution**: Layouts evenly split (e.g., 12→6+6, not 10+2)
141
- 3. **Target Separation**: Different targets use different agents
142
-
143
- **Distribution Formula**:
144
- ```
145
- agents_needed = ceil(layout_count / MAX_LAYOUTS_PER_AGENT)
146
- base_count = floor(layout_count / agents_needed)
147
- remainder = layout_count % agents_needed
148
- # First 'remainder' agents get (base_count + 1), others get base_count
149
- ```
150
-
151
- **Examples** (MAX=10):
152
-
153
- | Scenario | Result | Explanation |
154
- |----------|--------|-------------|
155
- | 3 styles × 3 layouts | 3 agents | Each style: 1 agent (3 layouts) |
156
- | 3 styles × 12 layouts | 6 agents | Each style: 2 agents (6+6 layouts) |
157
- | 2 styles × 5 layouts × 2 targets | 4 agents | Each (target, style): 1 agent (5 layouts) |
158
-
159
- ### Step 1: Calculate Agent Grouping Plan
160
- ```bash
161
- bash(mkdir -p {base_path}/prototypes)
162
-
163
- MAX_LAYOUTS_PER_AGENT = 10
164
- MAX_PARALLEL = 6
165
-
166
- agent_groups = []
167
- FOR each target in targets:
168
- FOR each style_id in [1..S]:
169
- layouts_for_this_target_style = filter layouts by current target
170
- layout_count = len(layouts_for_this_target_style)
171
-
172
- # Balanced distribution (e.g., 12 layouts → 6+6)
173
- agents_needed = ceil(layout_count / MAX_LAYOUTS_PER_AGENT)
174
- base_count = floor(layout_count / agents_needed)
175
- remainder = layout_count % agents_needed
176
-
177
- layout_chunks = []
178
- start_idx = 0
179
- FOR i in range(agents_needed):
180
- chunk_size = base_count + 1 if i < remainder else base_count
181
- layout_chunks.append(layouts[start_idx : start_idx + chunk_size])
182
- start_idx += chunk_size
183
-
184
- FOR each chunk in layout_chunks:
185
- agent_groups.append({
186
- target: target, # Single target
187
- style_id: style_id, # Single style
188
- layout_ids: chunk # Balanced layouts (≤10)
189
- })
190
-
191
- total_agents = len(agent_groups)
192
- total_batches = ceil(total_agents / MAX_PARALLEL)
193
-
194
- TodoWrite({todos: [
195
- {content: "Setup and validation", status: "completed", activeForm: "Loading design systems"},
196
- {content: "Batch 1/{total_batches}: Assemble up to 6 agent groups", status: "in_progress", activeForm: "Assembling batch 1"},
197
- {content: "Batch 2/{total_batches}: Assemble up to 6 agent groups", status: "pending", activeForm: "Assembling batch 2"},
198
- ... (continue for all batches)
199
- ]})
200
- ```
201
-
202
- ### Step 2: Launch Batched Assembly Tasks
203
-
204
- For each batch (up to 6 parallel agents per batch):
205
- For each agent group `{target, style_id, layout_ids[]}` in current batch:
206
- ```javascript
207
- Task(ui-design-agent): `
208
- [LAYOUT_STYLE_ASSEMBLY]
209
- 🎯 {target} × Style-{style_id} × Layouts-{layout_ids}
210
- ⚠️ CONSTRAINT: Use ONLY style-{style_id}/design-tokens.json (never mix styles)
211
-
212
- TARGET: {target} | STYLE: {style_id} | LAYOUTS: {layout_ids} (max 10)
213
- BASE_PATH: {base_path}
214
-
215
- ## Inputs (READ ONLY - NO DESIGN DECISIONS)
216
- 1. Layout Templates (LOOP THROUGH):
217
- FOR each layout_id in layout_ids:
218
- Read("{base_path}/layout-extraction/layout-{target}-{layout_id}.json")
219
- This file contains the specific layout template for this target and variant.
220
- Extract: dom_structure, css_layout_rules, device_type, source_image_path (from template field)
221
-
222
- 2. Design Tokens (SHARED - READ ONCE):
223
- Read("{base_path}/style-extraction/style-{style_id}/design-tokens.json")
224
- Extract: ALL token values including:
225
- * colors, typography (with combinations), spacing, opacity
226
- * border_radius, shadows, breakpoints
227
- * component_styles (button, card, input variants)
228
- Note: typography.combinations, opacity, and component_styles fields contain preset configurations using var() references
229
-
230
- 3. Animation Tokens (OPTIONAL):
231
- IF exists("{base_path}/animation-extraction/animation-tokens.json"):
232
- Read("{base_path}/animation-extraction/animation-tokens.json")
233
- Extract: duration, easing, transitions, keyframes, interactions
234
- has_animations = true
235
- ELSE:
236
- has_animations = false
237
-
238
- 4. Reference Image (AUTO-DETECTED):
239
- IF template.source_image_path exists:
240
- Read(template.source_image_path)
241
- Purpose: Additional visual context for better placeholder content generation
242
- Note: This is for reference only - layout and style decisions already made
243
- ELSE:
244
- Use generic placeholder content
245
-
246
- ## Assembly Process (LOOP FOR EACH LAYOUT)
247
- FOR each layout_id in layout_ids:
248
-
249
- 1. Build HTML: {base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.html
250
- - Recursively build from template.dom_structure
251
- - Add: <!DOCTYPE html>, <head>, <meta viewport>
252
- - CSS link: <link href="{target}-style-{style_id}-layout-{layout_id}.css">
253
- - Inject placeholder content:
254
- * Default: Use Lorem ipsum, generic sample data
255
- * If reference image available: Generate more contextually appropriate placeholders
256
- (e.g., realistic headings, meaningful text snippets that match the visual context)
257
- - Preserve all attributes from dom_structure
258
-
259
- 2. Build CSS: {base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.css
260
- - Start with template.css_layout_rules
261
- - Replace ALL var(--*) with actual token values from design-tokens.json
262
- Example: var(--spacing-4) → 1rem (from tokens.spacing.4)
263
- Example: var(--breakpoint-md) → 768px (from tokens.breakpoints.md)
264
- Example: var(--opacity-80) → 0.8 (from tokens.opacity.80)
265
- - Add visual styling using design tokens:
266
- * Colors: tokens.colors.*
267
- * Typography: tokens.typography.* (including combinations)
268
- * Opacity: tokens.opacity.*
269
- * Shadows: tokens.shadows.*
270
- * Border radius: tokens.border_radius.*
271
- - IF tokens.component_styles exists: Add component style classes
272
- * Generate classes for button variants (.btn-primary, .btn-secondary)
273
- * Generate classes for card variants (.card-default, .card-interactive)
274
- * Generate classes for input variants (.input-default, .input-focus, .input-error)
275
- * Use var() references that resolve to actual token values
276
- - IF tokens.typography.combinations exists: Add typography preset classes
277
- * Generate classes for typography presets (.text-heading-primary, .text-body-regular, .text-caption)
278
- * Use var() references for family, size, weight, line-height, letter-spacing
279
- - IF has_animations == true: Inject animation tokens (ONCE, shared across layouts)
280
- * Add CSS Custom Properties for animations at :root level:
281
- --duration-instant, --duration-fast, --duration-normal, etc.
282
- --easing-linear, --easing-ease-out, etc.
283
- * Add @keyframes rules from animation_tokens.keyframes
284
- * Add interaction classes (.button-hover, .card-hover) from animation_tokens.interactions
285
- * Add utility classes (.transition-color, .transition-transform) from animation_tokens.transitions
286
- * Include prefers-reduced-motion media query for accessibility
287
- - Device-optimized for template.device_type
288
-
289
- 3. Write files IMMEDIATELY after each layout completes
290
-
291
- ## Assembly Rules
292
- - ✅ Pure assembly: Combine pre-extracted structure + tokens
293
- - ❌ NO design decisions (layout/style pre-defined)
294
- - ✅ Read tokens ONCE, apply to all layouts in this batch
295
- - ✅ Replace var() with actual values
296
- - ✅ CSS filename MUST match HTML <link href="...">
297
-
298
- ## Output
299
- - Files: {len(layout_ids) × 2} (HTML + CSS pairs)
300
- - Each layout generates 2 files independently
301
- `
302
-
303
- # After each batch completes
304
- TodoWrite: Mark current batch completed, next batch in_progress
305
- ```
306
-
307
- ### Step 3: Verify Generated Files
308
- ```bash
309
- # Count expected vs found (should equal S × L × T)
310
- bash(ls {base_path}/prototypes/{target}-style-*-layout-*.html | wc -l)
311
-
312
- # Validate samples
313
- Read({base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.html)
314
- # Check: <!DOCTYPE html>, correct CSS href, sufficient CSS length
315
- ```
316
-
317
- **Output**: `total_files = S × L × T × 2` files verified (HTML + CSS pairs)
318
-
319
- ## Phase 3: Generate Preview Files
320
-
321
- ### Step 1: Run Preview Generation Script
322
- ```bash
323
- bash(~/.claude/scripts/ui-generate-preview.sh "{base_path}/prototypes")
324
- ```
325
-
326
- **Script generates**:
327
- - `compare.html` (interactive matrix)
328
- - `index.html` (navigation)
329
- - `PREVIEW.md` (instructions)
330
-
331
- ### Step 2: Verify Preview Files
332
- ```bash
333
- bash(ls {base_path}/prototypes/compare.html {base_path}/prototypes/index.html {base_path}/prototypes/PREVIEW.md)
334
- ```
335
-
336
- **Output**: 3 preview files
337
-
338
- ## Completion
339
-
340
- ### Todo Update
341
- ```javascript
342
- TodoWrite({todos: [
343
- {content: "Setup and validation", status: "completed", activeForm: "Loading design systems"},
344
- {content: "Batch 1/{total_batches}: Assemble 6 tasks", status: "completed", activeForm: "Assembling batch 1"},
345
- {content: "Batch 2/{total_batches}: Assemble 6 tasks", status: "completed", activeForm: "Assembling batch 2"},
346
- ... (all batches completed)
347
- {content: "Verify files & generate previews", status: "completed", activeForm: "Creating previews"}
348
- ]});
349
- ```
350
-
351
- ### Output Message
352
- ```
353
- ✅ UI prototype assembly complete!
354
-
355
- Configuration:
356
- - Style Variants: {style_variants}
357
- - Layout Variants: {layout_variants} (from layout-*.json files)
358
- - Device Type: {device_type}
359
- - Targets: {targets}
360
- - Total Prototypes: {S × L × T}
361
- - Image Reference: Auto-detected (uses source images when available in layout templates)
362
- - Animation Support: {has_animations ? 'Enabled (animation-tokens.json loaded)' : 'Not available'}
363
-
364
- Assembly Process:
365
- - Pure assembly: Combined pre-extracted layouts + design tokens
366
- - Agent grouping: target × style (max 10 layouts per agent)
367
- - Balanced distribution: Layouts evenly split (e.g., 12 → 6+6, not 10+2)
368
-
369
- Batch Execution:
370
- - Total agents: {total_agents} (each processes ONE style only)
371
- - Batches: {total_batches} (max 6 agents parallel)
372
- - Token efficiency: Read once per agent, apply to all layouts
373
-
374
- Quality:
375
- - Structure: From layout-extract (DOM, CSS layout rules)
376
- - Style: From style-extract (design tokens)
377
- - CSS: Token values directly applied (var() replaced)
378
- - Device-optimized: Layouts match device_type from templates
379
- - Animations: {has_animations ? 'CSS custom properties and @keyframes injected' : 'Static styles only'}
380
-
381
- Generated Files:
382
- {base_path}/prototypes/
383
- ├── {target}-style-{s}-layout-{l}.html ({S×L×T} prototypes)
384
- ├── {target}-style-{s}-layout-{l}.css
385
- ├── compare.html (interactive matrix)
386
- ├── index.html (navigation)
387
- └── PREVIEW.md (instructions)
388
-
389
- Input Files (from layout-extraction/):
390
- ├── layout-{target}-{variant}.json (multiple files, one per target-variant combination)
391
-
392
- Preview:
393
- 1. Open compare.html (recommended)
394
- 2. Open index.html
395
- 3. Read PREVIEW.md
396
-
397
- Next: /workflow:ui-design:update
398
- ```
399
-
400
- ## Simple Bash Commands
401
-
402
- ### Path Operations
403
- ```bash
404
- # Find design directory
405
- bash(find .workflow -type d -name "design-run-*" | head -1)
406
-
407
- # Count style variants
408
- bash(ls {base_path}/style-extraction/style-* -d | wc -l)
409
- ```
410
-
411
- ### Validation Commands
412
- ```bash
413
- # Check layout templates exist (multi-file pattern)
414
- bash(find {base_path}/layout-extraction -name "layout-*.json" -print -quit | grep -q . && echo "exists")
415
-
416
- # Count layout files
417
- bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null | wc -l)
418
-
419
- # Check design tokens exist
420
- bash(test -f {base_path}/style-extraction/style-1/design-tokens.json && echo "valid")
421
-
422
- # Count generated files
423
- bash(ls {base_path}/prototypes/{target}-style-*-layout-*.html | wc -l)
424
-
425
- # Verify preview
426
- bash(test -f {base_path}/prototypes/compare.html && echo "exists")
427
- ```
428
-
429
- ### File Operations
430
- ```bash
431
- # Create directories
432
- bash(mkdir -p {base_path}/prototypes)
433
-
434
- # Run preview script
435
- bash(~/.claude/scripts/ui-generate-preview.sh "{base_path}/prototypes")
436
- ```
437
-
438
- ## Output Structure
439
-
440
- ```
441
- {base_path}/
442
- ├── layout-extraction/
443
- │ └── layout-{target}-{variant}.json # Input (multiple files from layout-extract)
444
- ├── style-extraction/
445
- │ └── style-{s}/
446
- │ ├── design-tokens.json # Input (from style-extract)
447
- │ └── style-guide.md
448
- └── prototypes/
449
- ├── {target}-style-{s}-layout-{l}.html # Assembled prototypes
450
- ├── {target}-style-{s}-layout-{l}.css
451
- ├── compare.html
452
- ├── index.html
453
- └── PREVIEW.md
454
- ```
455
-
456
- ## Error Handling
457
-
458
- ### Common Errors
459
- ```
460
- ERROR: Layout templates not found
461
- → Run /workflow:ui-design:layout-extract first
462
-
463
- ERROR: Design tokens not found
464
- → Run /workflow:ui-design:style-extract first
465
-
466
- ERROR: Agent assembly failed
467
- → Check inputs exist, validate JSON structure
468
-
469
- ERROR: Script permission denied
470
- chmod +x ~/.claude/scripts/ui-generate-preview.sh
471
- ```
472
-
473
- ### Recovery Strategies
474
- - **Partial success**: Keep successful assembly combinations
475
- - **Invalid template structure**: Validate layout-*.json files
476
- - **Invalid tokens**: Validate design-tokens.json structure
477
-
478
- ## Quality Checklist
479
-
480
- - [ ] CSS uses direct token values (var() replaced)
481
- - [ ] HTML structure matches layout template exactly
482
- - [ ] Semantic HTML5 structure preserved
483
- - [ ] ARIA attributes from template present
484
- - [ ] Device-specific optimizations applied
485
- - [ ] All token references resolved
486
- - [ ] compare.html works
487
-
488
- ## Key Features
489
-
490
- - **Pure Assembly**: No design decisions, only combination
491
- - **Token Resolution**: var() → actual values
492
- - **Efficient Grouping**: target × style (max 10 layouts/agent, balanced split)
493
- - **Style Isolation**: Each agent processes ONE style only
494
- - **Production-Ready**: Semantic, accessible, token-driven
495
-
496
- ## Integration
497
-
498
- **Prerequisites**:
499
- - `/workflow:ui-design:style-extract` → `design-tokens.json` + `style-guide.md`
500
- - `/workflow:ui-design:layout-extract` → `layout-{target}-{variant}.json` files
501
-
502
- **Input**: `layout-*.json` files + `design-tokens.json`
503
- **Output**: S×L×T prototypes for `/workflow:ui-design:update`
504
- **Called by**: `/workflow:ui-design:explore-auto`, `/workflow:ui-design:imitate-auto`
1
+ ---
2
+ name: generate
3
+ description: Assemble UI prototypes by combining layout templates with design tokens (default animation support), pure assembler without new content generation
4
+ argument-hint: [--design-id <id>] [--session <id>]
5
+ allowed-tools: TodoWrite(*), Read(*), Write(*), Task(ui-design-agent), Bash(*)
6
+ ---
7
+
8
+ # Generate UI Prototypes (/workflow:ui-design:generate)
9
+
10
+ ## Overview
11
+ Pure assembler that combines pre-extracted layout templates with design tokens to generate UI prototypes (`style × layout × targets`). No layout design logic - purely combines existing components.
12
+
13
+ **Strategy**: Pure Assembly
14
+ - **Input**: `layout-*.json` files + `design-tokens.json` (+ reference images if available)
15
+ - **Process**: Combine structure (DOM) with style (tokens)
16
+ - **Output**: Complete HTML/CSS prototypes
17
+ - **No Design Logic**: All layout and style decisions already made
18
+ - **Automatic Image Reference**: If source images exist in layout templates, they're automatically used for visual context
19
+
20
+ **Prerequisite Commands**:
21
+ - `/workflow:ui-design:style-extract` → Complete design systems (design-tokens.json + style-guide.md)
22
+ - `/workflow:ui-design:layout-extract` → Layout structure
23
+
24
+ ## Execution Process
25
+
26
+ ```
27
+ Input Parsing:
28
+ ├─ Parse flags: --design-id, --session
29
+ └─ Decision (base path resolution):
30
+ ├─ --design-id provided → Exact match by design ID
31
+ ├─ --session provided → Latest in session
32
+ └─ No flags → Latest globally
33
+
34
+ Phase 1: Setup & Validation
35
+ ├─ Step 1: Resolve base path & parse configuration
36
+ ├─ Step 2: Load layout templates
37
+ ├─ Step 3: Validate design tokens
38
+ └─ Step 4: Load animation tokens (optional)
39
+
40
+ Phase 2: Assembly (Agent)
41
+ ├─ Step 1: Calculate agent grouping plan
42
+ │ └─ Grouping rules:
43
+ │ ├─ Style isolation: Each agent processes ONE style
44
+ │ ├─ Balanced distribution: Layouts evenly split
45
+ │ └─ Max 10 layouts per agent, max 6 concurrent agents
46
+ ├─ Step 2: Launch batched assembly tasks (parallel)
47
+ └─ Step 3: Verify generated files
48
+
49
+ Phase 3: Generate Preview Files
50
+ ├─ Step 1: Run preview generation script
51
+ └─ Step 2: Verify preview files
52
+ ```
53
+
54
+ ## Phase 1: Setup & Validation
55
+
56
+ ### Step 1: Resolve Base Path & Parse Configuration
57
+ ```bash
58
+ # Determine base path with priority: --design-id > --session > auto-detect
59
+ if [ -n "$DESIGN_ID" ]; then
60
+ # Exact match by design ID
61
+ relative_path=$(find .workflow -name "${DESIGN_ID}" -type d -print -quit)
62
+ elif [ -n "$SESSION_ID" ]; then
63
+ # Latest in session
64
+ relative_path=$(find .workflow/active/WFS-$SESSION_ID -name "design-run-*" -type d -printf "%T@ %p\n" 2>/dev/null | sort -nr | head -1 | cut -d' ' -f2)
65
+ else
66
+ # Latest globally
67
+ relative_path=$(find .workflow -name "design-run-*" -type d -printf "%T@ %p\n" 2>/dev/null | sort -nr | head -1 | cut -d' ' -f2)
68
+ fi
69
+
70
+ # Validate and convert to absolute path
71
+ if [ -z "$relative_path" ] || [ ! -d "$relative_path" ]; then
72
+ echo "❌ ERROR: Design run not found"
73
+ echo "💡 HINT: Run '/workflow:ui-design:list' to see available design runs"
74
+ exit 1
75
+ fi
76
+
77
+ base_path=$(cd "$relative_path" && pwd)
78
+ bash(echo "✓ Base path: $base_path")
79
+
80
+ # Get style count
81
+ bash(ls "$base_path"/style-extraction/style-* -d | wc -l)
82
+
83
+ # Image reference auto-detected from layout template source_image_path
84
+ ```
85
+
86
+ ### Step 2: Load Layout Templates
87
+ ```bash
88
+ # Check layout templates exist (multi-file pattern)
89
+ bash(find {base_path}/layout-extraction -name "layout-*.json" -print -quit | grep -q . && echo "exists")
90
+
91
+ # Get list of all layout files
92
+ bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null)
93
+
94
+ # Load each layout template file
95
+ FOR each layout_file in layout_files:
96
+ template_data = Read(layout_file)
97
+ # Extract: target, variant_id, device_type, dom_structure, css_layout_rules
98
+
99
+ # Aggregate: targets[], layout_variants count, device_type, all template structures
100
+ ```
101
+
102
+ **Output**: `base_path`, `style_variants`, `layout_templates[]`, `targets[]`, `device_type`
103
+
104
+ ### Step 3: Validate Design Tokens
105
+ ```bash
106
+ # Check design tokens exist for all styles
107
+ bash(test -f {base_path}/style-extraction/style-1/design-tokens.json && echo "valid")
108
+
109
+ # For each style variant: Load design tokens
110
+ Read({base_path}/style-extraction/style-{id}/design-tokens.json)
111
+ ```
112
+
113
+ **Output**: `design_tokens[]` for all style variants
114
+
115
+ ### Step 4: Load Animation Tokens (Optional)
116
+ ```bash
117
+ # Check if animation tokens exist
118
+ bash(test -f {base_path}/animation-extraction/animation-tokens.json && echo "exists")
119
+
120
+ # Load animation tokens if available
121
+ IF exists({base_path}/animation-extraction/animation-tokens.json):
122
+ animation_tokens = Read({base_path}/animation-extraction/animation-tokens.json)
123
+ has_animations = true
124
+ ELSE:
125
+ has_animations = false
126
+ ```
127
+
128
+ **Output**: `animation_tokens` (optional), `has_animations` flag
129
+
130
+ ## Phase 2: Assembly (Agent)
131
+
132
+ **Executor**: `Task(ui-design-agent)` grouped by `target × style` (max 10 layouts per agent, max 6 concurrent agents)
133
+
134
+ **⚠️ Core Principle**: **Each agent processes ONLY ONE style** (but can process multiple layouts for that style)
135
+
136
+ ### Agent Grouping Strategy
137
+
138
+ **Grouping Rules**:
139
+ 1. **Style Isolation**: Each agent processes ONLY ONE style (never mixed)
140
+ 2. **Balanced Distribution**: Layouts evenly split (e.g., 12→6+6, not 10+2)
141
+ 3. **Target Separation**: Different targets use different agents
142
+
143
+ **Distribution Formula**:
144
+ ```
145
+ agents_needed = ceil(layout_count / MAX_LAYOUTS_PER_AGENT)
146
+ base_count = floor(layout_count / agents_needed)
147
+ remainder = layout_count % agents_needed
148
+ # First 'remainder' agents get (base_count + 1), others get base_count
149
+ ```
150
+
151
+ **Examples** (MAX=10):
152
+
153
+ | Scenario | Result | Explanation |
154
+ |----------|--------|-------------|
155
+ | 3 styles × 3 layouts | 3 agents | Each style: 1 agent (3 layouts) |
156
+ | 3 styles × 12 layouts | 6 agents | Each style: 2 agents (6+6 layouts) |
157
+ | 2 styles × 5 layouts × 2 targets | 4 agents | Each (target, style): 1 agent (5 layouts) |
158
+
159
+ ### Step 1: Calculate Agent Grouping Plan
160
+ ```bash
161
+ bash(mkdir -p {base_path}/prototypes)
162
+
163
+ MAX_LAYOUTS_PER_AGENT = 10
164
+ MAX_PARALLEL = 6
165
+
166
+ agent_groups = []
167
+ FOR each target in targets:
168
+ FOR each style_id in [1..S]:
169
+ layouts_for_this_target_style = filter layouts by current target
170
+ layout_count = len(layouts_for_this_target_style)
171
+
172
+ # Balanced distribution (e.g., 12 layouts → 6+6)
173
+ agents_needed = ceil(layout_count / MAX_LAYOUTS_PER_AGENT)
174
+ base_count = floor(layout_count / agents_needed)
175
+ remainder = layout_count % agents_needed
176
+
177
+ layout_chunks = []
178
+ start_idx = 0
179
+ FOR i in range(agents_needed):
180
+ chunk_size = base_count + 1 if i < remainder else base_count
181
+ layout_chunks.append(layouts[start_idx : start_idx + chunk_size])
182
+ start_idx += chunk_size
183
+
184
+ FOR each chunk in layout_chunks:
185
+ agent_groups.append({
186
+ target: target, # Single target
187
+ style_id: style_id, # Single style
188
+ layout_ids: chunk # Balanced layouts (≤10)
189
+ })
190
+
191
+ total_agents = len(agent_groups)
192
+ total_batches = ceil(total_agents / MAX_PARALLEL)
193
+
194
+ TodoWrite({todos: [
195
+ {content: "Setup and validation", status: "completed", activeForm: "Loading design systems"},
196
+ {content: "Batch 1/{total_batches}: Assemble up to 6 agent groups", status: "in_progress", activeForm: "Assembling batch 1"},
197
+ {content: "Batch 2/{total_batches}: Assemble up to 6 agent groups", status: "pending", activeForm: "Assembling batch 2"},
198
+ ... (continue for all batches)
199
+ ]})
200
+ ```
201
+
202
+ ### Step 2: Launch Batched Assembly Tasks
203
+
204
+ For each batch (up to 6 parallel agents per batch):
205
+ For each agent group `{target, style_id, layout_ids[]}` in current batch:
206
+ ```javascript
207
+ Task(ui-design-agent): `
208
+ [LAYOUT_STYLE_ASSEMBLY]
209
+ 🎯 {target} × Style-{style_id} × Layouts-{layout_ids}
210
+ ⚠️ CONSTRAINT: Use ONLY style-{style_id}/design-tokens.json (never mix styles)
211
+
212
+ TARGET: {target} | STYLE: {style_id} | LAYOUTS: {layout_ids} (max 10)
213
+ BASE_PATH: {base_path}
214
+
215
+ ## Inputs (READ ONLY - NO DESIGN DECISIONS)
216
+ 1. Layout Templates (LOOP THROUGH):
217
+ FOR each layout_id in layout_ids:
218
+ Read("{base_path}/layout-extraction/layout-{target}-{layout_id}.json")
219
+ This file contains the specific layout template for this target and variant.
220
+ Extract: dom_structure, css_layout_rules, device_type, source_image_path (from template field)
221
+
222
+ 2. Design Tokens (SHARED - READ ONCE):
223
+ Read("{base_path}/style-extraction/style-{style_id}/design-tokens.json")
224
+ Extract: ALL token values including:
225
+ * colors, typography (with combinations), spacing, opacity
226
+ * border_radius, shadows, breakpoints
227
+ * component_styles (button, card, input variants)
228
+ Note: typography.combinations, opacity, and component_styles fields contain preset configurations using var() references
229
+
230
+ 3. Animation Tokens (OPTIONAL):
231
+ IF exists("{base_path}/animation-extraction/animation-tokens.json"):
232
+ Read("{base_path}/animation-extraction/animation-tokens.json")
233
+ Extract: duration, easing, transitions, keyframes, interactions
234
+ has_animations = true
235
+ ELSE:
236
+ has_animations = false
237
+
238
+ 4. Reference Image (AUTO-DETECTED):
239
+ IF template.source_image_path exists:
240
+ Read(template.source_image_path)
241
+ Purpose: Additional visual context for better placeholder content generation
242
+ Note: This is for reference only - layout and style decisions already made
243
+ ELSE:
244
+ Use generic placeholder content
245
+
246
+ ## Assembly Process (LOOP FOR EACH LAYOUT)
247
+ FOR each layout_id in layout_ids:
248
+
249
+ 1. Build HTML: {base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.html
250
+ - Recursively build from template.dom_structure
251
+ - Add: <!DOCTYPE html>, <head>, <meta viewport>
252
+ - CSS link: <link href="{target}-style-{style_id}-layout-{layout_id}.css">
253
+ - Inject placeholder content:
254
+ * Default: Use Lorem ipsum, generic sample data
255
+ * If reference image available: Generate more contextually appropriate placeholders
256
+ (e.g., realistic headings, meaningful text snippets that match the visual context)
257
+ - Preserve all attributes from dom_structure
258
+
259
+ 2. Build CSS: {base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.css
260
+ - Start with template.css_layout_rules
261
+ - Replace ALL var(--*) with actual token values from design-tokens.json
262
+ Example: var(--spacing-4) → 1rem (from tokens.spacing.4)
263
+ Example: var(--breakpoint-md) → 768px (from tokens.breakpoints.md)
264
+ Example: var(--opacity-80) → 0.8 (from tokens.opacity.80)
265
+ - Add visual styling using design tokens:
266
+ * Colors: tokens.colors.*
267
+ * Typography: tokens.typography.* (including combinations)
268
+ * Opacity: tokens.opacity.*
269
+ * Shadows: tokens.shadows.*
270
+ * Border radius: tokens.border_radius.*
271
+ - IF tokens.component_styles exists: Add component style classes
272
+ * Generate classes for button variants (.btn-primary, .btn-secondary)
273
+ * Generate classes for card variants (.card-default, .card-interactive)
274
+ * Generate classes for input variants (.input-default, .input-focus, .input-error)
275
+ * Use var() references that resolve to actual token values
276
+ - IF tokens.typography.combinations exists: Add typography preset classes
277
+ * Generate classes for typography presets (.text-heading-primary, .text-body-regular, .text-caption)
278
+ * Use var() references for family, size, weight, line-height, letter-spacing
279
+ - IF has_animations == true: Inject animation tokens (ONCE, shared across layouts)
280
+ * Add CSS Custom Properties for animations at :root level:
281
+ --duration-instant, --duration-fast, --duration-normal, etc.
282
+ --easing-linear, --easing-ease-out, etc.
283
+ * Add @keyframes rules from animation_tokens.keyframes
284
+ * Add interaction classes (.button-hover, .card-hover) from animation_tokens.interactions
285
+ * Add utility classes (.transition-color, .transition-transform) from animation_tokens.transitions
286
+ * Include prefers-reduced-motion media query for accessibility
287
+ - Device-optimized for template.device_type
288
+
289
+ 3. Write files IMMEDIATELY after each layout completes
290
+
291
+ ## Assembly Rules
292
+ - ✅ Pure assembly: Combine pre-extracted structure + tokens
293
+ - ❌ NO design decisions (layout/style pre-defined)
294
+ - ✅ Read tokens ONCE, apply to all layouts in this batch
295
+ - ✅ Replace var() with actual values
296
+ - ✅ CSS filename MUST match HTML <link href="...">
297
+
298
+ ## Output
299
+ - Files: {len(layout_ids) × 2} (HTML + CSS pairs)
300
+ - Each layout generates 2 files independently
301
+ `
302
+
303
+ # After each batch completes
304
+ TodoWrite: Mark current batch completed, next batch in_progress
305
+ ```
306
+
307
+ ### Step 3: Verify Generated Files
308
+ ```bash
309
+ # Count expected vs found (should equal S × L × T)
310
+ bash(ls {base_path}/prototypes/{target}-style-*-layout-*.html | wc -l)
311
+
312
+ # Validate samples
313
+ Read({base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.html)
314
+ # Check: <!DOCTYPE html>, correct CSS href, sufficient CSS length
315
+ ```
316
+
317
+ **Output**: `total_files = S × L × T × 2` files verified (HTML + CSS pairs)
318
+
319
+ ## Phase 3: Generate Preview Files
320
+
321
+ ### Step 1: Run Preview Generation Script
322
+ ```bash
323
+ bash(ccw tool exec ui_generate_preview '{"prototypesDir":"{base_path}/prototypes"}')
324
+ ```
325
+
326
+ **Script generates**:
327
+ - `compare.html` (interactive matrix)
328
+ - `index.html` (navigation)
329
+ - `PREVIEW.md` (instructions)
330
+
331
+ ### Step 2: Verify Preview Files
332
+ ```bash
333
+ bash(ls {base_path}/prototypes/compare.html {base_path}/prototypes/index.html {base_path}/prototypes/PREVIEW.md)
334
+ ```
335
+
336
+ **Output**: 3 preview files
337
+
338
+ ## Completion
339
+
340
+ ### Todo Update
341
+ ```javascript
342
+ TodoWrite({todos: [
343
+ {content: "Setup and validation", status: "completed", activeForm: "Loading design systems"},
344
+ {content: "Batch 1/{total_batches}: Assemble 6 tasks", status: "completed", activeForm: "Assembling batch 1"},
345
+ {content: "Batch 2/{total_batches}: Assemble 6 tasks", status: "completed", activeForm: "Assembling batch 2"},
346
+ ... (all batches completed)
347
+ {content: "Verify files & generate previews", status: "completed", activeForm: "Creating previews"}
348
+ ]});
349
+ ```
350
+
351
+ ### Output Message
352
+ ```
353
+ ✅ UI prototype assembly complete!
354
+
355
+ Configuration:
356
+ - Style Variants: {style_variants}
357
+ - Layout Variants: {layout_variants} (from layout-*.json files)
358
+ - Device Type: {device_type}
359
+ - Targets: {targets}
360
+ - Total Prototypes: {S × L × T}
361
+ - Image Reference: Auto-detected (uses source images when available in layout templates)
362
+ - Animation Support: {has_animations ? 'Enabled (animation-tokens.json loaded)' : 'Not available'}
363
+
364
+ Assembly Process:
365
+ - Pure assembly: Combined pre-extracted layouts + design tokens
366
+ - Agent grouping: target × style (max 10 layouts per agent)
367
+ - Balanced distribution: Layouts evenly split (e.g., 12 → 6+6, not 10+2)
368
+
369
+ Batch Execution:
370
+ - Total agents: {total_agents} (each processes ONE style only)
371
+ - Batches: {total_batches} (max 6 agents parallel)
372
+ - Token efficiency: Read once per agent, apply to all layouts
373
+
374
+ Quality:
375
+ - Structure: From layout-extract (DOM, CSS layout rules)
376
+ - Style: From style-extract (design tokens)
377
+ - CSS: Token values directly applied (var() replaced)
378
+ - Device-optimized: Layouts match device_type from templates
379
+ - Animations: {has_animations ? 'CSS custom properties and @keyframes injected' : 'Static styles only'}
380
+
381
+ Generated Files:
382
+ {base_path}/prototypes/
383
+ ├── {target}-style-{s}-layout-{l}.html ({S×L×T} prototypes)
384
+ ├── {target}-style-{s}-layout-{l}.css
385
+ ├── compare.html (interactive matrix)
386
+ ├── index.html (navigation)
387
+ └── PREVIEW.md (instructions)
388
+
389
+ Input Files (from layout-extraction/):
390
+ ├── layout-{target}-{variant}.json (multiple files, one per target-variant combination)
391
+
392
+ Preview:
393
+ 1. Open compare.html (recommended)
394
+ 2. Open index.html
395
+ 3. Read PREVIEW.md
396
+
397
+ Next: /workflow:ui-design:update
398
+ ```
399
+
400
+ ## Simple Bash Commands
401
+
402
+ ### Path Operations
403
+ ```bash
404
+ # Find design directory
405
+ bash(find .workflow -type d -name "design-run-*" | head -1)
406
+
407
+ # Count style variants
408
+ bash(ls {base_path}/style-extraction/style-* -d | wc -l)
409
+ ```
410
+
411
+ ### Validation Commands
412
+ ```bash
413
+ # Check layout templates exist (multi-file pattern)
414
+ bash(find {base_path}/layout-extraction -name "layout-*.json" -print -quit | grep -q . && echo "exists")
415
+
416
+ # Count layout files
417
+ bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null | wc -l)
418
+
419
+ # Check design tokens exist
420
+ bash(test -f {base_path}/style-extraction/style-1/design-tokens.json && echo "valid")
421
+
422
+ # Count generated files
423
+ bash(ls {base_path}/prototypes/{target}-style-*-layout-*.html | wc -l)
424
+
425
+ # Verify preview
426
+ bash(test -f {base_path}/prototypes/compare.html && echo "exists")
427
+ ```
428
+
429
+ ### File Operations
430
+ ```bash
431
+ # Create directories
432
+ bash(mkdir -p {base_path}/prototypes)
433
+
434
+ # Run preview script
435
+ bash(ccw tool exec ui_generate_preview '{"prototypesDir":"{base_path}/prototypes"}')
436
+ ```
437
+
438
+ ## Output Structure
439
+
440
+ ```
441
+ {base_path}/
442
+ ├── layout-extraction/
443
+ │ └── layout-{target}-{variant}.json # Input (multiple files from layout-extract)
444
+ ├── style-extraction/
445
+ │ └── style-{s}/
446
+ │ ├── design-tokens.json # Input (from style-extract)
447
+ │ └── style-guide.md
448
+ └── prototypes/
449
+ ├── {target}-style-{s}-layout-{l}.html # Assembled prototypes
450
+ ├── {target}-style-{s}-layout-{l}.css
451
+ ├── compare.html
452
+ ├── index.html
453
+ └── PREVIEW.md
454
+ ```
455
+
456
+ ## Error Handling
457
+
458
+ ### Common Errors
459
+ ```
460
+ ERROR: Layout templates not found
461
+ → Run /workflow:ui-design:layout-extract first
462
+
463
+ ERROR: Design tokens not found
464
+ → Run /workflow:ui-design:style-extract first
465
+
466
+ ERROR: Agent assembly failed
467
+ → Check inputs exist, validate JSON structure
468
+
469
+ ERROR: Script permission denied
470
+ Verify ccw tool is available: ccw tool list
471
+ ```
472
+
473
+ ### Recovery Strategies
474
+ - **Partial success**: Keep successful assembly combinations
475
+ - **Invalid template structure**: Validate layout-*.json files
476
+ - **Invalid tokens**: Validate design-tokens.json structure
477
+
478
+ ## Quality Checklist
479
+
480
+ - [ ] CSS uses direct token values (var() replaced)
481
+ - [ ] HTML structure matches layout template exactly
482
+ - [ ] Semantic HTML5 structure preserved
483
+ - [ ] ARIA attributes from template present
484
+ - [ ] Device-specific optimizations applied
485
+ - [ ] All token references resolved
486
+ - [ ] compare.html works
487
+
488
+ ## Key Features
489
+
490
+ - **Pure Assembly**: No design decisions, only combination
491
+ - **Token Resolution**: var() → actual values
492
+ - **Efficient Grouping**: target × style (max 10 layouts/agent, balanced split)
493
+ - **Style Isolation**: Each agent processes ONE style only
494
+ - **Production-Ready**: Semantic, accessible, token-driven
495
+
496
+ ## Integration
497
+
498
+ **Prerequisites**:
499
+ - `/workflow:ui-design:style-extract` → `design-tokens.json` + `style-guide.md`
500
+ - `/workflow:ui-design:layout-extract` → `layout-{target}-{variant}.json` files
501
+
502
+ **Input**: `layout-*.json` files + `design-tokens.json`
503
+ **Output**: S×L×T prototypes for `/workflow:ui-design:update`
504
+ **Called by**: `/workflow:ui-design:explore-auto`, `/workflow:ui-design:imitate-auto`