How I keep my design system in one piece with Claude Code. Part 1
If you are designer who works with Claude Code, you probably know this moment. Agent writes code fast, everything looks fine, and after a week the project has its own colors, its own spacing and couple of new buttons nobody designed. On my previous project I gave agents the design system rules in "just warn me" mode. In few weeks we got 613 classes outside the kit, 469 raw HTML elements and 22 versions of a button. Then a separate phase only for cleanup. Fun)
So the conclusion I came to: if agent can break a rule without consequences, it will break it. Not because it is evil, it's just easier way to get to "done". You can write in claude.md "please use only kit components" as many times as you want, for agent it's context, not a law. By the way, in a recent research of 20 design systems only around half of agent failures could be fixed with prompts.
So on the new project I did the opposite. I don't ask agents to respect the design system, I made it hard to break. Bad edit just doesn't get written. Agent can't say "done" while something is broken. The code is checked by separate agent who didn't write it. And everything that needs judgement (what the kit is allowed to become, what a color means, what we are building at all) stays with me.
I'm not a big fan of building super complex harness with tons of agents. I try to keep as few agents as possible, but still I have a small set that works for me, with different roles and different models. Some build screens, one only reviews, others do research and variants. But more about this in the next post.
Now numbers for one week (76 commits): - 11 times agent tried to write an edit that breaks the design system, it was refused before it was written - 100 times agent said "done" while something was broken, and it was not let go until it fixed it - 76 times agents tried to change the rules or base components themselves to pass the check (yes, they do this 🙃) - 4 commits didn't go through without independent review and 0 violations in the final code
To be honest, it's not clean "before/after", the projects are different. But you can see the scale. This is how many times in one week everything would fall apart if I just trusted agents.
And even more honest: the system keeps the form, not the meaning. One agent made up a client checklist, and it quietly ended up in the code. The real one was on a frame from client's video. I caught it, not the automation. Clean screen that passes all the rules still can be a wrong screen. In the next post I will show how it works inside: which agents, which models, where the checks are.
How do you keep agents inside your design system? Take care 🫡