Back to writing

Writing / AI Engineering

Design to code, under contract.

A smaller contract helps AI agents use the right design system—and prove the code follows it.

DateAug 26, 2026
Read time4 min read
TagsDesign Systems · AI Agents · Frontend Engineering · Figma

Design to code, under contract

Design to code, under contract

AI agents can write polished interfaces that use the wrong design system.

The code may compile and the screen may look convincing, but the details drift: public components, hard-coded colours, incorrect tokens, and patterns that do not belong to the product.

The model is not incapable. It is missing the internal rules that define the finish line.

The problem

A polished result can still be wrong.

The model is not incapable. It is uninformed.

What it actually shipped

Public component imports
Hard-coded hex values
A type scale that is not ours
Competent, convincing, and built from someone else's system.

The prior wins when the contract is missing.

A polished operations dashboard can still be wrong when it ships public components, hard-coded values, and another system's type scale.

The short version

A prompt describes what to build. A contract defines what the result must obey.

Instead of loading an entire design system into the model, retrieve only the relevant component, variants, tokens, and guidance. Then validate the generated code independently.

The turn

The fix is not a better prompt. It is a smaller contract.

RetrieveComposeVerify
The fix is not a better prompt. It is a smaller contract that can be retrieved, composed, and verified.

The goal is focused context, not maximum context. Give the agent enough information to make the next decision correctly, while leaving room to reason.

Deck

Download the complete presentation as a PDF.

Design to code, under contract previewDesign to code, under contractPDF · 17 pagesDownload PDF ↓

How the system works

An internal search returns one small contract for the requested component. Validators check imports, tokens, icons, APIs, and other explicit rules. Failures return structured guidance the agent can fix and rerun.

Figma provides the visual reference. A compact semantic specification adds hierarchy, component identity, copy, props, and tokens without sending the entire layer tree.

System architecture

Four controls. One governed loop.

The agent orchestrates. The surrounding system supplies control.

01 · Start hookAuto-run
02 · IndexRetrieve
Orchestration surfaceCursorPrompt / edit / tool call
03 · RecipeOn demand
04 · DoctorValidate
A governed design-to-code loop surrounds the coding agent with a start hook, retrieval index, optional recipe, and independent Doctor.

The operating path is simple: picture, intent, contract, code, proof. Each handoff is visible and testable.

Try the tools

Screen Spec MD on Figma logoScreen Spec MD on FigmaGenerate compact semantic context from a Figma frame.Open link ↗Screen Spec MD on GitHub logoScreen Spec MD on GitHubView the source, documentation, and implementation.Open link ↗

Reliable AI is inspectable AI.