A Design System from One DESIGN.md: How an AI Agent Built HTML-First Components and Found Token GapsNote · digest for November 28
Conceptual 3D workshop of an AI model generating HTML components with instant zero-build browser calibration
Note3 sections≈ 4 min

A Design System from One DESIGN.md: How an AI Agent Built HTML-First Components and Found Token Gaps

When you build UI with an AI agent, you quickly hit a fork in the road. You can wait for Figma mockups and wire up Figma MCP so the model reads layers directly. Or you can paste a reference link saying "make it look like this site" and leave the design to the agent's taste. The first path slows down on mockup sync, while the second breaks buttons and spacing by the third screen.

The DevHands experiment tested a third option: put a plain-text DESIGN.md in the repo and let an agent build an HTML-first design system with no Figma and no reference screenshots. The result is a 12-section showcase in a warm Claude-like palette—strictly tied to tokens and backed by automated spec-gap auditing.

Why keep UI building blocks inside the repository

If a task already comes with full specs and mockups, an engineer doesn't need a local design system. The pain shows up when a developer builds features directly with an agent. Figma MCP (a Model Context Protocol bridge for reading Figma layers) helps, yet the source of truth still sits outside the repo. Generating UI "by taste" quickly spawns mismatched cards.

A library of ready-made building blocks inside the same repo or metarepo changes the workflow: the agent grabs a proven component and plugs in data. The HTML-first approach relies on semantic markup and CSS, adding JavaScript only where the browser can't do the job natively, like tabs.

<!-- Disclosure using native <details>: zero JS -->
<details class="disclosure">
  <summary class="disclosure__trigger">
    What counts as an input token?
  </summary>
  <p class="disclosure__body">
    System prompt, conversation history, tool
    descriptions, and attached files.
  </p>
</details>

The less extra code a base block carries, the harder it is for an agent to break it. A button stays a <button>, a spoiler runs on <details>, and shared styles hold the look together.

Tokens, GAP comments, and contrast auditing

The showcase builds with Tailwind CSS v4.3.3 via src/assemble.sh, and every style property must pull a design token (a named CSS variable for color, spacing, or typography) from src/theme.css. If you edit HTML by hand or hardcode a random color, src/verify.sh (check 6) fails immediately.

When a component is missing a token, the agent doesn't silently hardcode a value. It computes one via color-mix() or calc(), leaves a GAP marker in components.css, and collects all missing pieces in a Token gaps section with ready-to-paste proposals for DESIGN.md.

/* build/app.css — base tokens from src/theme.css */
:root {
  --color-canvas: #faf9f5;
  --color-ink: #141413;
  --color-primary: #cc785c;
  --color-primary-active: #a9583e;
}

/* build/components.css — explicit GAP instead of hardcoding */
/* GAP(primary-pressed): no pressed token darker than primary-active */
.btn--primary:active {
  background: color-mix(
    in oklab,
    var(--color-primary-active) 86%,
    var(--color-ink)
  );
}

That Token gaps log caught two real bugs. The generator emitted --font-body-md as one quoted string ("StyreneB, Inter, sans-serif"), making the browser look for a single font with commas in its name—so the agent logged GAP(font-stacks) and added a check to npm run verify:render. And because CSS can't read var(--bp) inside @media, breakpoints were extracted to src/BREAKPOINTS.txt, guarded by verify.sh.

The system also ran WCAG contrast checks (at least 4.5:1 for normal text and 3:1 for large text and UI) and flagged three flaws in the original DESIGN.md.

Color pair in specContrastIssueReplacement
--color-primary on #faf9f53.11:1Too low for text links--color-primary-active (4.80:1)
White text on coral button3.28:1Too low for small text--color-ink on same background (5.63:1)
--color-muted-soft on #faf9f53.23:1Decorative use only--color-muted (5.13:1)

Instead of hiding behind quiet workarounds, the team sees exactly where the palette hurts readability and fixes DESIGN.md itself.

Where it pays off and where you still need Figma

A code-based design system with verify.sh in CI fits startups, admin panels, and agent pipelines that don't have a designer for every screen.

Autonomy has a price, though. The DevHands showcase avoids external fonts, so licensed Copernicus and StyreneB fall back to local Garamond and Inter (whereas tools like getdesign.md load EB Garamond from Google Fonts). For unique branding, complex motion, and UX research, a designer in Figma is still irreplaceable. The generation pipeline itself isn't open source yet—for now, you can inspect the showcase and its tokens in app.css.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 4