Component contracts align Figma and React, including data props and Figma-only states.
UpSkill Agentic Design System
Building an AI-driven operating system around a component library, so maintainers and AI agents can create, validate and maintain UI components side by side with minimal upkeep.
Lead Product Designer
AI harness for a component library
Production-ready components without 24/7 agent orchestration
AI generates UI fast, but the result only looks fine on the surface; by default it's expensive to run and unreliable. At scale it drifts: invented components, misused tokens, stale Figma files.
The real challenge is guiding the LLM to understand design intent and stay aware of the system's state, without 24/7 orchestration or costly live MCP calls.
Turning unpredictable AI output into reliable code
Where I started, and why it changed
Figma as the source of truth. It can't hold every state, accessibility rule or code-only property, and syncing it needed an Enterprise-only API. So code became the source and Figma a checked mirror.
A single large AGENTS.md file. It became tiered, loading rules
by task instead of all at once.
One contract file per component. It became two: a metadata file on how to use a component, and a spec on how to build it.
The framework
The system keeps the model out of every part a script can handle. 75+ scripts and workflows are the tools, the repo is the memory, Claude commands handle judgment, and a deterministic gate with a reviewer agent acts as guards. See the four parts
- Tools. More than 75 deterministic scripts, commands and workflows sync the system and prepare the data agents read, without spending a single token.
- Memory. The repo is the single source of truth. It records what components mean, how work is done, why the system is this way and what is true right now, and agents load only the part a task needs.
- Judgment. Nine Claude commands handle the design intent a script can't encode, like proposing a component API or generating one, and run only when a maintainer triggers them.
- Guards. A deterministic gate stops bad changes before they merge, and an adversarial reviewer agent challenges interactive components. A screenshot check compares each of the 28 components, in light and dark mode, against approved baselines and flags visual changes that code checks can't see. A status command shows maintainers each component's build and review state, and issues found in audits become new rules agents follow, so they aren't repeated.
Giving AI the right context at the right time
Each task loads only the context it needs: too much costs money and distracts the model, too little makes it guess. The system's memory lives in four layers an agent reads on demand. See memory layers
- Intent: what things mean. Component contracts, token layers, docs and glossary, loaded only when a task touches them.
- Procedure: how work is done. A small
AGENTS.mdloads in every session, kept under 8KB by CI. Detailed rules, commands and skills load on demand, so every developer and agent works the same way. - History: why it is this way. Decision records (ADRs) explain each structural choice, and handoff files let a fresh agent pick up where the last one stopped.
- State: what is true right now. Snapshot files hold each
component's lifecycle stage, token use and sign-off, rolled into one
STATUS_QUO.mdsummary. Agents, the CLI, Storybook and Airtable all read from it, so nothing queries Figma live.
Loops that build, review and learn
Before building, /add-component proposes an API, with every
prop checked against the system's prop vocabulary, and waits for my approval before
writing any file. That proposal becomes the spec, validated against
its schema, that code and Figma are built from, followed by the deterministic gate
and Storybook visual review.
Review depth follows risk. component:risk reads the spec and
flags a component as interactive when it has an interactive role or a keyboard
contract beyond Tab. Interactive components owe behavioural accessibility tests and go
to /review-component, which spawns an adversarial reviewer agent. Display
components get a lighter code review.
Other loops keep the system current: /docs-sync rewrites
stale docs and /extract-learnings turns review findings into rules.
Keeping only what tests prove
I built evals to test what the agent needs, and kept only what improved its output.
- Context over loops. Written rules made every rebuild come out clean. An extra review loop added cost without fixing more, so it now runs only on interactive components.
- Context in the right place. A shared pattern file cut errors by 69% on page layouts but raised them by 29% on component builds, so only the layout command reads it.
- Rules over new steps. In a blind test against 11 past calls, the agent recommended the same reuse, extend or build answer as me 10 times using the existing rules and metadata, so I didn't add a separate decision step.
AI as infrastructure
Design and code stay in parity. Contracts define properties, states and behaviour, so Figma matches production code beyond tokens.
It costs little to run. Nothing runs around the clock, so cost follows actual work.
Every contributor reads the same source. Every touchpoint, from the Airtable board to Storybook, is generated from the repo, so no one updates one by hand or asks which version is current.
AI assists where judgment is needed. Scripts automate the routine checks, and the agent reviews each new or changed component against its contract and past decisions, then recommends a path for a person to approve.
In numbers
- 91% Figma build accuracy, up from 55%: Figma builds from the API schema and contracts, significantly simplifying handoff.
- Zero LLM token spend on routine work: 27 scripts, 44 npm commands and 8 GitHub Actions, with API reads up to 62× smaller.
- 97% of docs written from a single source of truth: cuts manual writing and drift.
- 10 of 11 build-or-reuse decisions matched mine: in a blind test, with every out-of-scope request declined.
Screens
Figma build accuracy rises when the agent builds Button from the spec instead of code alone.