--- name: generate description: Generate UI prototypes in matrix mode (style × layout combinations) usage: /workflow:ui-design:generate [--pages ""] [--base-path ] [--session ] [--style-variants ] [--layout-variants ] argument-hint: "[--pages \"dashboard,auth\"] [--base-path \".workflow/WFS-xxx/runs/run-xxx/.design\"] [--style-variants 3] [--layout-variants 3]" examples: - /workflow:ui-design:generate --base-path ".workflow/WFS-auth/runs/run-xxx/.design" --pages "dashboard,settings" --style-variants 3 --layout-variants 3 - /workflow:ui-design:generate --session WFS-auth --pages "home,pricing" --style-variants 2 --layout-variants 2 - /workflow:ui-design:generate --base-path "./design-session-xxx/.design" --style-variants 3 --layout-variants 3 allowed-tools: TodoWrite(*), Read(*), Write(*), Task(conceptual-planning-agent), Bash(*) --- # UI Generation Command (Matrix Mode) ## Overview Generate production-ready UI prototypes (HTML/CSS) in `style × layout` matrix mode, strictly adhering to consolidated design tokens from separate style design systems. ## Core Philosophy - **Matrix-Only**: Single mode generating `style_variants × layout_variants × pages` prototypes - **Agent-Driven**: Uses `Task(conceptual-planning-agent)` for parallel generation - **Token-Driven**: All styles reference per-style design-tokens.json; no hardcoded values - **Production-Ready**: Semantic HTML5, ARIA attributes, responsive design ## Execution Protocol ### Phase 1: Path Resolution & Context Loading ```bash # Determine base path IF --base-path provided: base_path = {provided_base_path} # e.g., ".workflow/WFS-xxx/runs/run-xxx/.design" ELSE IF --session provided: session_id = {provided_session} base_path = ".workflow/WFS-{session_id}/latest/.design" # Use latest run ELSE: # Standalone mode: search for most recent design-session in scratchpad base_path = find_latest_design_session(".workflow/.scratchpad/") # Determine style and layout variant counts style_variants = --style-variants OR 3 # Default to 3 layout_variants = --layout-variants OR 3 # Default to 3 VALIDATE: 1 <= style_variants <= 5 VALIDATE: 1 <= layout_variants <= 5 # Infer page list if not provided IF --pages provided: page_list = parse_csv({--pages value}) ELSE IF --session: # Read synthesis-specification.md to extract page requirements synthesis_spec = Read(.workflow/WFS-{session}/.brainstorming/synthesis-specification.md) page_list = extract_pages_from_synthesis(synthesis_spec) ELSE: # Infer from existing prototypes or default page_list = detect_from_prototypes({base_path}/prototypes/) OR ["home"] VALIDATE: page_list not empty # Verify design systems exist for all styles FOR style_id IN range(1, style_variants + 1): VERIFY: {base_path}/style-consolidation/style-{style_id}/design-tokens.json exists VERIFY: {base_path}/style-consolidation/style-{style_id}/style-guide.md exists # Load requirements (if integrated mode) IF --session: synthesis_spec = Read(.workflow/WFS-{session}/.brainstorming/synthesis-specification.md) ``` ### Phase 2: Matrix UI Generation (Parallel, Layout-Based) Execute parallel agents to generate `style_variants × layout_variants × pages` prototypes. Each agent handles ONE layout strategy across MULTIPLE styles (batched to max 8 styles per agent). ```bash # Create output directory CREATE: {base_path}/prototypes/ # Calculate style batches (max 8 styles per agent) batch_size = 8 all_style_ids = range(1, style_variants + 1) style_batches = split_into_chunks(all_style_ids, batch_size) # e.g., [[1-8], [9-16]] # Launch layout_variants × num_batches parallel tasks FOR layout_id IN range(1, layout_variants + 1): FOR style_batch IN style_batches: Task(conceptual-planning-agent): " [UI_GENERATION_MATRIX_BATCH] Generate prototypes for layout-{layout_id} across a batch of styles. ## Context LAYOUT_ID: {layout_id} STYLE_IDS_BATCH: {style_batch} # e.g., [1, 2, 3, 4, 5, 6, 7, 8] PAGES: {page_list} BASE_PATH: {base_path} ## Input Files For each style_id in your batch, you MUST load its corresponding files: - Design Tokens: {base_path}/style-consolidation/style-{style_id}/design-tokens.json - Style Guide: {base_path}/style-consolidation/style-{style_id}/style-guide.md {IF --session: - Requirements: .workflow/WFS-{session}/.brainstorming/synthesis-specification.md} ## Task For each style_id in {style_batch}: For each page in [{page_list}]: Generate the prototype files for the specific combination: - {page}-style-{style_id}-layout-{layout_id}.html (semantic HTML5) - {page}-style-{style_id}-layout-{layout_id}.css (token-driven, no hardcoded values) - {page}-style-{style_id}-layout-{layout_id}-notes.md (implementation notes) ## Layout Diversity Strategy You are responsible for Layout {layout_id}. Apply this strategy CONSISTENTLY to all styles in your batch. {IF layout_id == 1} **Layout 1: Classic Hierarchy** - Traditional F-pattern reading flow - Top navigation with sidebar - Card-based content sections {ELSE IF layout_id == 2} **Layout 2: Modern Asymmetric** - Z-pattern visual flow - Split-screen hero sections - Grid-based modular content {ELSE IF layout_id == 3} **Layout 3: Minimal Focus** - Centered single-column content - Floating navigation - Generous whitespace and breathing room {ELSE} **Layout {layout_id}: Custom Variant** - Develop a unique and consistent layout structure different from the standard three {ENDIF} Adapt this strategy to each page's purpose while maintaining layout consistency. ## Token Usage Requirements (STRICT) - For each style, load design tokens from its specific file: {base_path}/style-consolidation/style-{style_id}/design-tokens.json - All colors: var(--color-brand-primary), var(--color-surface-background), etc. - All spacing: var(--spacing-4), var(--spacing-6), etc. - All typography: var(--font-family-heading), var(--font-size-lg), etc. - NO hardcoded values (e.g., #4F46E5, 16px) allowed ## HTML Requirements - Semantic HTML5 elements (
,