# Design System for Agents

> Five-layer framework for structuring design systems so coding agents build consistent UI

A practical framework for translating product design systems into files AI coding agents can interpret accurately. It organizes styling and UI logic into five sequential layers: raw primitives, functional semantic tokens, component definitions, compound blocks, and explicit operational rules with reusable skill files. This structure prevents AI agents from guessing arbitrary styles or using non-existent component variants.

## The framework

Premise: I asked Claude Code to build a screen from my design. It came back very fast, clean and completely wrong — details were missing. The agent couldn't be blamed: I had never told it what makes my product feel right. Those decisions lived in my head. A design system is becoming the place where you write down what good looks like so an agent can follow along without guessing. Built one layer at a time.

1. START WITH DESIGN PRIMITIVES

Primitives are raw values — colour, type, spacing, radius, shadows, motion. They mean little alone; they're a palette to pick from. Kept in one file every product reads from:

Colour: --gray-0 \#ffffff, --gray-50 \#fafafa, --gray-100 \#f4f4f5, --gray-200 \#e4e4e7, --gray-400 \#a1a1aa, --gray-500 \#71717a, --gray-700 \#3f3f46, --gray-900 \#18181b, --blue-500 \#3b82f6, --green-500 \#22c55e, --amber-500 \#f59e0b, --red-500 \#ef4444.

Type: --font-sans "Inter", system-ui, sans-serif; --font-mono "JetBrains Mono", monospace; --text-xs 12px, --text-sm 13px, --text-base 14px, --text-lg 16px, --text-xl 20px, --text-2xl 24px; --weight-regular 400, --weight-medium 500, --weight-semibold 600; --leading-tight 1.25, --leading-normal 1.5.

Spacing: --space-1 4px, --space-2 8px, --space-3 12px, --space-4 16px, --space-6 24px, --space-8 32px, --space-12 48px.

Radius: --radius-sm 4px, --radius-md 8px, --radius-lg 12px, --radius-full 9999px.

Shadow: --shadow-sm 0 1px 2px rgb(0 0 0 / 0.05); --shadow-md 0 4px 12px rgb(0 0 0 / 0.08); --shadow-lg 0 12px 32px rgb(0 0 0 / 0.12).

Motion: --ease-smooth cubic-bezier(0.22, 1, 0.36, 1); --duration-fast 150ms, --duration-normal 200ms, --duration-slow 300ms.

At the top of the file, a short note asks the agent to take values from here instead of inventing new ones — before that he'd find surprises like a 13.5px font or a 10px gap from nowhere. Primitives are not used directly in components; they feed the next layer.

2. DEFINE THE SEMANTIC FOUNDATIONS

Semantic tokens describe what a value is for, not what it looks like: not "gray-500" but "text muted"; not "green" but "status success". Each points back to a primitive:

Surface: --bg-app var(--gray-50); --bg-surface var(--gray-0); --bg-subtle var(--gray-100); --border-default var(--gray-200).

Text: --text-primary var(--gray-900); --text-secondary var(--gray-700); --text-muted var(--gray-500); --text-disabled var(--gray-400).

Action: --action-primary var(--gray-900); --action-primary-text var(--gray-0); --focus-ring var(--blue-500).

Status: --status-success var(--green-500); --status-warning var(--amber-500); --status-error var(--red-500); --status-running var(--blue-500).

Layout: --gap-inline var(--space-2); --gap-stack var(--space-4); --padding-card var(--space-4); --padding-page var(--space-8); --radius-control var(--radius-md); --radius-card var(--radius-lg).

Elevation: --elevation-card var(--shadow-sm); --elevation-popover var(--shadow-md); --elevation-dialog var(--shadow-lg).

Motion: --motion-hover var(--duration-fast) var(--ease-smooth); --motion-enter var(--duration-normal) var(--ease-smooth); --motion-panel var(--duration-slow) var(--ease-smooth).

Naming this way felt awkward at first but makes the agent's job easier: it can pick a value by what it needs to do on screen. It also protects colour meaning — green/amber/red only when they mean something (a task finishing, something going wrong); used decoratively, the meaning gets harder to read. Undecided values get a note asking the agent to check first, otherwise it fills gaps with reasonable guesses that slowly become part of the product.

3. MAP THE COMPONENTS

Components are reusable pieces — button, badge, dialog. Starting point is shadcn/ui, built on top of. Full shadcn/ui set grouped by job:

• Actions: button, button-group, toggle, toggle-group, kbd

• Inputs: input, input-group, input-otp, textarea, checkbox, radio-group, switch, slider, select, native-select, combobox, calendar, label, field, form

• Overlays: dialog, alert-dialog, sheet, drawer, popover, hover-card, tooltip, dropdown-menu, context-menu, command

• Navigation: sidebar, navigation-menu, menubar, breadcrumb, tabs, pagination

• Layout: card, item, separator, accordion, collapsible, resizable, scroll-area, aspect-ratio, carousel, direction

• Data: table, chart, avatar, badge, marker, progress

• Feedback: alert, toast, sonner, spinner, skeleton, empty

• Agent and chat: message, message-scroller, bubble, attachment, code-block, trace, questionnaire

For each component used, write down: when to use it and when to use something else; which variant is default; one good and one bad example from real code; how it looks in each state — hover, pressed, loading, empty, disabled, error. Document only what actually exists: describing a variant that wasn't built yet made the agent keep trying to use it.

4. DEFINE THE BLOCKS

A block is a small section made from components: a run card, an approval panel, a task row with status and avatar. Don't design blocks up front — design a few real screens first, notice which parts you keep rebuilding, then turn those into blocks, so they come from the product instead of a template. Blocks also keep the product focused: every screen is a stack of blocks (header, stat cards, chart, list, side panel). When each part of a screen can be named that way, the agent can build it the same way, one block at a time. When a screen needs something no block can do, that's a sign to slow down and ask if it belongs.

\[Illustration: a full screen taken apart — each section is a block with its own name and states, and the screen is just those blocks put together.\]

5. SET THE RULES AND SKILLS

Tokens, components and blocks tell the agent what to build with. Rules and skills tell it how you like things done.

Rules: one short sentence with its reason right after it, all in one file the agent reads every time (CLAUDE.md or AGENTS.md). The reason is what lets the agent handle cases you never wrote down. Examples:

"Show a status badge on every run card, even while it's running. People check agents in passing, so the state should be visible at a glance."

"Use only one primary button per screen. If everything is important, nothing is."

Easiest way to write rules: wait until the agent gets something wrong, then write down what it did, what you wanted, and why. That note becomes your next rule.

Skills: an instruction file for one specific job. Rules are always on; a skill is only used when its job comes up.

---

name: review-screen

description: Use after building or changing a screen.

---

1. Flag any raw value that isn't a token.

2. Check each block has loading, empty and error states.

3. Check status text matches the real state of the agent.

A good skill is clear enough that two people would follow it the same way. His recently caught an approval card that still said "Needs approval" after it had been approved — small things like that are often what make an agent product feel trustworthy.

WHAT STAYS WITH YOU

An agent can follow a system quite closely, but it can't decide what great looks like for you. That part still takes time and patience. The slower work of writing these things down is what lets everything after it move a little faster.

## What it is for

- Structure repository design tokens and guidelines for tools like Claude Code
- Prevent AI coding assistants from hallucinating arbitrary font sizes, margins, or colors
- Define concrete component and block states for agents to implement consistently
- Create automated screen review checklists as AI agent skills

## Key points

- Layer 1: Design primitives defining raw tokens for color, typography, spacing, radius, shadow, and motion
- Layer 2: Semantic foundations that assign functional meaning to primitives (surface, action, status)
- Layer 3: Component mapping categorizing reusable elements (e.g. shadcn/ui) with explicit states and usage constraints
- Layer 4: Pattern blocks that assemble components into product-specific structural modules
- Layer 5: Rules and skill files (like CLAUDE.md) containing rationale-driven design principles and task-specific workflows

## Pricing

Free

## Details

- Type: Framework
- Category: [Development](https://xiry.app/topics/development.md)
- Topic: [Design Systems](https://xiry.app/topics/design/design-systems.md)
- Open source: no
- Platforms: other
- For: Product designers, design engineers, and developers working with AI coding agents
- Tags: design systems, ai agents, claude code, design tokens, frontend, prompting

## Why it was saved

- [@_heyrico, 1 November 2026](https://x.com/_heyrico/status/2116953958279479760): Gives a concrete file structure (tokens, semantic tokens, shadcn/ui component docs, blocks, CLAUDE.md rules, skill files) so an agent builds screens that feel like your product instead of guessing.

## Related

- [Awesome DESIGN.md](https://xiry.app/resources/awesome-design-md): Curated collection of plain-text design systems extracted from popular tech websites. (GitHub repo, Open source)
- [Minimal Product Design Cheatsheet](https://xiry.app/resources/minimal-product-design-cheatsheet): Quick typography, color palette, and iconography reference for clean product interfaces. (Tip, Free)
- [Modulor](https://xiry.app/resources/modulor): Open-source, token-driven design system and Figma UI kit by GR8 Tech. (Website, Open source)
- [Refero Styles](https://xiry.app/resources/refero-styles): AI-readable DESIGN.md style references extracted from popular websites. (Web app, Free)
- [Building Effective Agents: Workflow and Agent Patterns](https://xiry.app/resources/building-effective-agents-workflow-and-agent-patterns): Architectural framework categorizing LLM workflows and autonomous agent patterns (Framework, Free)
- [Checklist Design](https://xiry.app/resources/checklist-design): Curated UI and UX checklists for websites, apps, and user flows (Website, Free)

Updated 4 December 2026. Page: https://xiry.app/resources/design-system-for-agents

Make your own library: Xiry for Mac makes your saved Instagram reels and liked tweets searchable and pulls the useful stuff out, like this library. It's invite-only for now; request an invite at https://xiry.app/mac/download.
