--- name: generate-v2 description: Generate UI prototypes using target-style-centric batch generation usage: /workflow:ui-design:generate-v2 [--targets ""] [--target-type "page|component"] [--base-path ] [--session ] [--style-variants ] [--layout-variants ] examples: - /workflow:ui-design:generate-v2 --session WFS-auth --targets "dashboard,settings" - /workflow:ui-design:generate-v2 --targets "home,pricing" --style-variants 2 --layout-variants 2 allowed-tools: TodoWrite(*), Read(*), Write(*), Task(ui-design-agent), Bash(*) --- # Generate UI Prototypes V2 (/workflow:ui-design:generate-v2) ## Overview Generate matrix of UI prototypes (`style × layout × targets`) using **target-style-centric batch generation**. Each agent handles all layouts for one target × style combination. **Strategy**: Target-Style-Centric - **Agent scope**: Each of `T × S` agents generates `L` layouts - **Component isolation**: Complete task independence - **Style-aware**: HTML adapts to design_attributes - **Self-contained CSS**: Direct token values (no var() refs) **Supports**: Pages (full layouts) and components (isolated elements) ## Phase 1: Setup & Validation ### Step 1: Resolve Base Path & Parse Configuration ```bash # Determine working directory bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect # Get counts (defaults: style=auto, layout=3) bash(ls {base_path}/style-consolidation/style-* -d | wc -l) # Parse targets (Priority: --targets → --pages → synthesis-specification.md → default ["home"]) # Target type: "page" (default) or "component" ``` ### Step 2: Validate Inputs ```bash # Check design systems exist bash(test -f {base_path}/style-consolidation/style-1/design-tokens.json && echo "valid") # Validate target names (lowercase, alphanumeric, hyphens only) # Load design-space-analysis.json (optional, for style-aware generation) ``` **Output**: `base_path`, `style_variants`, `layout_variants`, `target_list[]`, `target_type`, `design_space_analysis` (optional) ### Step 3: Detect Token Sources ```bash # Priority 1: consolidated tokens (production-ready from /workflow:ui-design:consolidate) # Priority 2: proposed tokens from style-cards.json (fast-track from /workflow:ui-design:extract) bash(test -f {base_path}/style-consolidation/style-1/design-tokens.json && echo "consolidated") # OR bash(test -f {base_path}/style-extraction/style-cards.json && echo "proposed") # If proposed: Create temp consolidation dir + write proposed tokens bash(mkdir -p {base_path}/style-consolidation/style-{id}) Write({base_path}/style-consolidation/style-{id}/design-tokens.json, proposed_tokens) ``` **Output**: `token_sources{}`, `consolidated_count`, `proposed_count` ### Step 4: Gather Layout Inspiration ```bash bash(mkdir -p {base_path}/prototypes/_inspirations) # For each target: Research via MCP # mcp__exa__web_search_exa(query="{target} {target_type} layout patterns", numResults=5) # Write simple inspiration file Write({base_path}/prototypes/_inspirations/{target}-layout-ideas.txt, inspiration_content) ``` **Output**: `L` inspiration text files ## Phase 2: Target-Style-Centric Generation (Agent) **Executor**: `Task(ui-design-agent)` × `T × S` tasks in parallel ### Step 1: Launch Agent Tasks ```bash bash(mkdir -p {base_path}/prototypes) ``` For each `target × style_id`: ```javascript Task(ui-design-agent): ` [TARGET_STYLE_UI_GENERATION] 🎯 ONE component: {target} × Style-{style_id} ({philosophy_name}) Generate: {layout_variants} × 2 files (HTML + CSS per layout) TARGET: {target} | TYPE: {target_type} | STYLE: {style_id}/{style_variants} BASE_PATH: {base_path} ${design_attributes ? "DESIGN_ATTRIBUTES: " + JSON.stringify(design_attributes) : ""} ## 参考 - Layout inspiration: Read("{base_path}/prototypes/_inspirations/{target}-layout-ideas.txt") - Design tokens: Read("{base_path}/style-consolidation/style-{style_id}/design-tokens.json") Parse ALL token values (colors, typography, spacing, borders, shadows, breakpoints) ${design_attributes ? "- Adapt DOM structure to: density, visual_weight, formality, organic_vs_geometric" : ""} ## 生成 For EACH layout (1 to {layout_variants}): 1. HTML: {base_path}/prototypes/{target}-style-{style_id}-layout-N.html - Complete HTML5: , , - CSS ref: - Semantic:
,