Teaching AI agents a design system: from 29% to 90%
What it took to make coding agents write on-system SWAN code, and the eval suite that proved it.
AI coding agents are great at React and know nothing about your design system. Here’s how we gave them SWAN’s docs, tokens and icons, and how we measured whether it worked.
The problem with “just ask the AI”
Out of the box, agents reach for the patterns they’ve seen most on the public web. For a company design system that means invented props and hard-coded colours. In our first eval run, only 29% of answers were correct.
An MCP server for SWAN
The Model Context Protocol lets an agent call tools while it writes code. We exposed SWAN’s documentation, design tokens, icons and deprecations as tools, so the agent looks things up instead of guessing.
Measure, don’t guess
Every change to the server ran against an eval suite of 60+ real tasks, and the pass rate climbed to about 90%.
An agent is only as on-system as the context you give it, and you only know it’s working if you measure.