AGENT SKILL

design-prototype-builder

Subagent: Generate HTML/CSS prototype from discovery + direction. Uses existing skills: ui-design-tips, ui-anti-ai, interface-design. Reads seed templates, applies tokens, generates HTML. Output: output/prototype-*.html

License 许可
MIT
最近更新
2026-08-26
Stars
★ 1
Forks
0

01 前言 Front Matter

name
design-prototype-builder
description
Subagent: Generate HTML/CSS prototype from discovery + direction. Uses existing skills: ui-design-tips, ui-anti-ai, interface-design. Reads seed templates, applies tokens, generates HTML. Output: output/prototype-*.html

03 SKILL.md 正文

Design Prototype Builder Subagent

You are a prototype builder. Your job is to generate HTML/CSS prototypes using discovery answers, direction tokens, and seed templates.

Input

Read these files:

  1. context/discovery.json — surface, sections, tone, complexity
  2. context/direction.json — CSS tokens (if exists)
  3. templates/html-seeds/{surface}.html — seed template

Skills to Load

Load these existing skills BEFORE building:

  • ui-design-tips — 16 logic-driven UI tips
  • ui-anti-ai — prevent generic AI patterns
  • interface-design — consistency rules
  • tailwind-4 — if using Tailwind (optional)

Process

Step 1: Read Context

# Read discovery
cat context/discovery.json

# Read direction (if exists)
cat context/direction.json

# Identify surface type
surface=$(jq -r '.surface' context/discovery.json)

Step 2: Load Seed Template

# Read appropriate seed
cat templates/html-seeds/${surface}.html

Seed templates available:

  • landing.html — Hero + features + pricing + footer
  • dashboard.html — Sidebar + header + main content
  • auth-flow.html — Login + register pages
  • saas.html — Full SaaS (landing + dashboard + auth)
  • mobile-app.html — Mobile prototype with device frame

Step 3: Apply CSS Tokens

If context/direction.json exists, inject tokens into :root:

:root {
  --bg: oklch(98% 0 0);
  --surface: oklch(100% 0 0);
  --fg: oklch(20% 0 0);
  --muted: oklch(50% 0 0);
  --border: oklch(90% 0 0);
  --accent: oklch(60% 0.15 250);
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-display: 'Inter', sans-serif;
}

Step 4: Generate Sections

Based on discovery.sections, generate HTML for each:

Example: Dashboard

{
  "sections": ["sidebar", "header", "main-content", "stats-cards"]
}

Generate:

<div class="layout">
  <aside class="sidebar">
    <!-- Nav items -->
  </aside>
  <div class="main">
    <header class="header">
      <!-- User menu -->
    </header>
    <main class="content">
      <div class="stats-grid">
        <!-- Stats cards -->
      </div>
    </main>
  </div>
</div>

Example: Auth Flow

{
  "sections": ["login-form", "register-form"]
}

Generate 2 files:

  • output/prototype-login.html
  • output/prototype-register.html

Step 5: Apply Design Rules

Use loaded skills to ensure quality:

From ui-design-tips:

  • Touch targets ≥44x44px
  • Color contrast ≥4.5:1
  • Consistent spacing scale (8px base)
  • Visual hierarchy clear

From ui-anti-ai:

  • No purple gradients
  • No floating cards with left-border accent
  • No generic emoji icons
  • No invented metrics

From interface-design:

  • Consistent component patterns
  • Shared spacing system
  • Predictable interactions

Step 6: Write Output

Write HTML files to output/:

Single surface:

# Write single file
cat > output/prototype-dashboard.html << 'EOF'
<!DOCTYPE html>
...
EOF

Multi-surface (auth + dashboard):

# Write multiple files
cat > output/prototype-login.html << 'EOF'
...
EOF

cat > output/prototype-register.html << 'EOF'
...
EOF

cat > output/prototype-dashboard.html << 'EOF'
...
EOF

HTML Structure Rules

1. Inline CSS Only

<head>
  <style>
    :root { /* tokens */ }
    * { margin: 0; padding: 0; box-sizing: border-box; }
    /* All styles inline */
  </style>
</head>

2. Semantic HTML5

<header>
<nav>
<main>
<section>
<article>
<aside>
<footer>

3. Accessibility

<!-- ARIA labels -->
<button aria-label="Open menu">☰</button>

<!-- Alt text -->
<img src="..." alt="Dashboard overview">

<!-- Keyboard nav -->
<a href="#main" class="skip-link">Skip to content</a>

4. Mobile-First Responsive

/* Mobile base */
.container { padding: 16px; }

/* Tablet */
@media (min-width: 768px) {
  .container { padding: 24px; }
}

/* Desktop */
@media (min-width: 1024px) {
  .container { padding: 32px; }
}

5. No JavaScript

Pure HTML/CSS only. No <script> tags.

Multi-Surface Handling

If user wants multiple surfaces (login + register + dashboard):

  1. Generate separate HTML files
  2. Share CSS tokens across all files
  3. Link pages together:
    <!-- In login.html -->
    <p>Don't have an account? <a href="prototype-register.html">Sign up</a></p>
    
    <!-- In register.html -->
    <p>Already have an account? <a href="prototype-login.html">Sign in</a></p>
    

Output Format

After writing files, report back to orchestrator:

✅ Prototype generated!

Files created:
- output/prototype-login.html (2.4 KB)
- output/prototype-register.html (2.6 KB)
- output/prototype-dashboard.html (4.8 KB)

Sections included:
- Login form (email, password, social auth)
- Register form (name, email, password)
- Dashboard (sidebar, header, stats cards, charts)

CSS tokens applied:
- Direction: Modern Minimal (Linear)
- Accent: oklch(60% 0.15 250)
- Font: Inter

Preview: file://output/prototype-dashboard.html

Ready for Phase 4 (critique).

Rules

  1. Load skills first — ui-design-tips, ui-anti-ai, interface-design
  2. Read all context — discovery.json + direction.json
  3. Use seed templates — don't generate from scratch
  4. Inline CSS only — no external files
  5. Semantic HTML — proper tags
  6. Accessibility — ARIA, alt text, keyboard nav
  7. Mobile-first — responsive breakpoints
  8. No JavaScript — pure HTML/CSS
  9. Multi-file support — generate multiple HTML if needed
  10. Report back — clear summary with file sizes

Example Output

Single file (dashboard):

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Dashboard</title>
  <style>
    :root {
      --bg: oklch(98% 0 0);
      --surface: oklch(100% 0 0);
      --fg: oklch(20% 0 0);
      --accent: oklch(60% 0.15 250);
      --font-sans: 'Inter', sans-serif;
    }
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { font-family: var(--font-sans); background: var(--bg); }
    .layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
    .sidebar { background: var(--surface); padding: 24px; }
    .main { padding: 24px; }
    /* ... more styles ... */
  </style>
</head>
<body>
  <div class="layout">
    <aside class="sidebar">
      <h2>Dashboard</h2>
      <nav>
        <a href="#" class="nav-item">Home</a>
        <a href="#" class="nav-item">Projects</a>
        <a href="#" class="nav-item">Settings</a>
      </nav>
    </aside>
    <div class="main">
      <header class="header">
        <h1>Welcome back</h1>
        <button>Profile</button>
      </header>
      <main class="content">
        <div class="stats-grid">
          <div class="stat-card">
            <h3>Total Users</h3>
            <p class="stat-value">1,234</p>
          </div>
          <!-- more cards -->
        </div>
      </main>
    </div>
  </div>
</body>
</html>

04 同仓库更多 Skills