", ...], + "accessibility_features": ["skip-link", "landmarks", ...], + "research_references": ["source URLs/insights"] + } -**Parallel Executor**: → @ui-design-agent - -```bash -CREATE: {base_path}/prototypes/_templates/ -CREATE: {base_path}/prototypes/ - -# Launch parallel template generation tasks → @ui-design-agent -# Total agent tasks: layout_variants × len(target_list) -FOR layout_id IN range(1, layout_variants + 1): - FOR target IN target_list: - # Read the target-specific layout plan - layout_json_path = f"{base_path}/prototypes/_templates/{target}-layout-{layout_id}.json" - layout_plan = Read(layout_json_path) - - Task(ui-design-agent): " - [UI_LAYOUT_TEMPLATE_GENERATION] - - 🚨 TARGET INDEPENDENCE: Generate template for EXACTLY ONE target: '{target}' (standalone, reusable) - - LAYOUT_ID: {layout_id} | TARGET: {target} | TARGET_TYPE: {target_type} - BASE_PATH: {base_path} - {IF --session: REQUIREMENTS: .workflow/WFS-{session}/.brainstorming/synthesis-specification.md} - - ## Layout Plan to Implement - **Path**: {layout_json_path} - **Plan**: {JSON.stringify(layout_plan, null, 2)} - - ## Task - Generate TWO template files implementing the layout plan: - - HTML: {base_path}/prototypes/_templates/{target}-layout-{layout_id}.html - - CSS: {base_path}/prototypes/_templates/{target}-layout-{layout_id}.css - - ## HTML Requirements - - Complete HTML5 document (, , , ) - - Semantic elements + ARIA attributes - - Body content: - * IF page → Full structure (header, nav, main, footer) - * IF component → Isolated element in presentation wrapper - - ⚠️ CRITICAL CSS placeholders in : - - - - ## CSS Requirements - Token Reference - - **1. Read tokens.css** - Read(\"{base_path}/style-consolidation/style-1/tokens.css\") - Extract all CSS variable names (pattern: lines with \" --\" in \":root {}\") - - **2. Available Tokens** - - Colors: {', '.join(color_vars[:5])}... ({len(color_vars)} total) - - Typography: {', '.join(typography_vars[:5])}... ({len(typography_vars)} total) - - Spacing: {', '.join(spacing_vars[:5])}... ({len(spacing_vars)} total) - - Radius: {', '.join(radius_vars[:3])}... ({len(radius_vars)} total) - - Shadows: {', '.join(shadow_vars)} - - **3. Variable Usage Rules** - - ✅ Use ONLY variables from tokens.css (exact names) - - ✅ Format: var(--exact-name-from-file) - - ❌ NO invented/guessed variable names - - ❌ NO hardcoded values (colors, fonts, spacing) - - **4. Optional Extension** - If core tokens insufficient → Create `{target}-layout-{layout_id}-tokens.css` with `--layout-*` prefix - Examples: `--layout-spacing-navbar-height`, `--layout-size-sidebar-width` - - **CSS Scope**: Structural layout only (Flexbox, Grid, positioning) - **Responsive**: Mobile-first approach - - ## Write Operations - Write(\"{base_path}/prototypes/_templates/{target}-layout-{layout_id}.html\", html_content) - Write(\"{base_path}/prototypes/_templates/{target}-layout-{layout_id}.css\", css_content) - - Report completion with file paths. Write files directly (not text output). - " - -REPORT: "⏳ Phase 2a: Waiting for agents to complete template generation..." + ## 注意 + - Layout #{layout_id} must be STRUCTURALLY DIFFERENT from other IDs + - Structure section must match target_type (page vs component) + - Write file directly, no text output +` ``` -#### Phase 2a.5: Verify Agent Template File Creation - +### Step 2: Verify Layout Plans ```bash -REPORT: "📝 Phase 2a.5: Verifying agent template file creation..." +# Verify files created +bash(ls {base_path}/prototypes/_templates/*.json | wc -l) # Should equal L×T -# Verify each agent created template files -FOR layout_id IN range(1, layout_variants + 1): - FOR target IN target_list: - html_label = f"{target}-layout-{layout_id}.html" - css_label = f"{target}-layout-{layout_id}.css" - - html_path = f"{base_path}/prototypes/_templates/{html_label}" - css_path = f"{base_path}/prototypes/_templates/{css_label}" - - # Verify files exist - VERIFY: exists(html_path), f"HTML template not created by agent: {html_label}" - VERIFY: exists(css_path), f"CSS template not created by agent: {css_label}" - - # Validate content - TRY: - html_content = Read(html_path) - css_content = Read(css_path) - - # Basic validation checks - VALIDATE: len(html_content) > 100, f"HTML template too short: {html_label}" - VALIDATE: len(css_content) > 50, f"CSS template too short: {css_label}" - VALIDATE: "" in html_content, f"Invalid HTML structure: {html_label}" - VALIDATE: "var(--" in css_content, f"Missing CSS variables: {css_label}" - - html_size = get_file_size(html_path) - css_size = get_file_size(css_path) - REPORT: f" ✓ Verified: {html_label} ({html_size} KB) + {css_label} ({css_size} KB)" - CATCH error: - ERROR: f"Validation failed for {target}-layout-{layout_id}: {error}" - REPORT: f" ⚠️ Files exist but validation failed - review agent output" - -REPORT: "✅ Phase 2a.5 complete: Verified {layout_variants * len(target_list) * 2} template files" +# Validate JSON structure +Read({base_path}/prototypes/_templates/{target}-layout-{layout_id}.json) ``` -#### Phase 2b: Prototype Instantiation +**Output**: `L × T` layout plan JSON files +## Phase 3: Token Conversion + +### Step 1: Convert JSON to CSS Variables ```bash -REPORT: "🚀 Phase 2b: Instantiating prototypes from templates..." +# Check jq dependency +bash(command -v jq >/dev/null 2>&1 || echo "ERROR: jq not found") -# Verify tokens.css files exist (should be created in Phase 1.6) -FOR style_id IN range(1, style_variants + 1): - tokens_css_path = "{base_path}/style-consolidation/style-${style_id}/tokens.css" - VERIFY: exists(tokens_css_path), f"tokens.css missing for style-{style_id}. Phase 1.6 may have failed." - -REPORT: " ✓ Verified {style_variants} tokens.css files exist" - -# Use ui-instantiate-prototypes.sh script for instantiation -prototypes_dir = "{base_path}/prototypes" -targets_csv = ','.join(target_list) -session_id = --session provided ? {session_id} : "standalone" - -# Execute instantiation script with target type -Bash(~/.claude/scripts/ui-instantiate-prototypes.sh "{prototypes_dir}" --session-id "{session_id}" --mode "{target_type}") - -# The script auto-detects: Targets, Style variants, Layout variants -# The script generates: -# 1. S × L × T HTML prototypes with CSS links -# 2. Implementation notes for each prototype -# 3. compare.html (interactive matrix) -# 4. index.html (navigation page) -# 5. PREVIEW.md (documentation) - -REPORT: "✅ Phase 2b complete: Instantiated {style_variants * layout_variants * len(target_list)} final prototypes" -REPORT: " Mode: {target_type} | Performance: {style_variants}× faster than original approach" +# Convert each style's design-tokens.json to tokens.css +bash(cat {base_path}/style-consolidation/style-1/design-tokens.json | ~/.claude/scripts/convert_tokens_to_css.sh > tokens.css) ``` -### Phase 3: Verify Preview Files - +### Step 2: Extract Variable Names ```bash -REPORT: "🔍 Phase 3: Verifying preview files..." +# Read generated tokens.css +Read({base_path}/style-consolidation/style-1/tokens.css) -expected_files = ["{base_path}/prototypes/compare.html", "{base_path}/prototypes/index.html", "{base_path}/prototypes/PREVIEW.md"] - -all_present = true -FOR file_path IN expected_files: - IF exists(file_path): REPORT: " ✓ Found: {basename(file_path)}" - ELSE: REPORT: " ✗ Missing: {basename(file_path)}"; all_present = false - -IF all_present: REPORT: "✅ Phase 3 complete: All preview files verified" -ELSE: WARN: "⚠️ Some preview files missing - script may have failed" - -# Optional: Generate fallback design-tokens.css for reference -fallback_css_path = "{base_path}/prototypes/design-tokens.css" -IF NOT exists(fallback_css_path): - Write(fallback_css_path, "/* Auto-generated fallback CSS custom properties */\n/* See style-consolidation/style-{n}/tokens.css for actual values */") - REPORT: " ✓ Generated fallback design-tokens.css" +# Extract CSS variable names (pattern: --variable-name:) +# Categorize: colors, typography, spacing, radius, shadows ``` -### Phase 3.5: Cross-Target Consistency Validation +**Output**: `S × tokens.css` files + extracted variable list -**Condition**: Only executes if `len(target_list) > 1 AND target_type == "page"` +## Phase 4: Template Generation (Agent) -```bash -# Skip if single target or component mode -IF len(target_list) <= 1 OR target_type == "component": SKIP to Phase 4 +**Executor**: `Task(ui-design-agent)` × `L × T` tasks in parallel -# For multi-page workflows, validate cross-page consistency → @ui-design-agent -FOR style_id IN range(1, style_variants + 1): - FOR layout_id IN range(1, layout_variants + 1): - Task(@ui-design-agent): " - [CROSS_PAGE_CONSISTENCY_VALIDATION] +### Step 1: Launch Agent Tasks +For each `layout_id × target`: +```javascript +Task(ui-design-agent): ` + [UI_LAYOUT_TEMPLATE_GENERATION] + 🚨 ONE target only: '{target}' (standalone, reusable) - STYLE: {style_id} | LAYOUT: {layout_id} | TARGETS: {target_list} | TYPE: {target_type} - BASE_PATH: {base_path} + LAYOUT: {layout_id} | TARGET: {target} | TYPE: {target_type} + BASE_PATH: {base_path} + ${--session ? "REQUIREMENTS: .workflow/WFS-{session}/.brainstorming/synthesis-specification.md" : ""} - ## Input - {base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.html/css (all targets) + ## 参考 + - Layout plan: Read("{base_path}/prototypes/_templates/{target}-layout-{layout_id}.json") + - Design tokens: Read("{base_path}/style-consolidation/style-1/tokens.css") + Extract variables: --color-*, --font-*, --spacing-*, --border-radius-*, --shadow-* - ## Validate - 1. Shared components (header/nav/footer) - 2. Token usage (no hardcoded values) - 3. Accessibility (ARIA, headings, landmarks) - 4. Layout strategy consistency + ## 生成 + 1. HTML: {base_path}/prototypes/_templates/{target}-layout-{layout_id}.html + - Complete HTML5 doc with and + - Body: Full structure (page) OR isolated element (component) + - Semantic:
,