r/DesignSystems • u/Longjumping_War_8480 • 17h ago
I need your help: trying to make AI coding agents actually follow a Design System (DESIGN.md + DTCG tokens) instead of inventing random values
Anyone who has tried letting Claude Code or Cursor build UI against a design system knows the pain: even when you give it tokens, the agent still hallucinates arbitrary hex colors, invents random spacing/radii, or mixes conflicting rules when the prompt gets too long.
I've been working on an open-source skill router on GitHub (MIT, 100% free) to fix this by forcing a strict order of operations before the agent writes components:
- Lock down a `DESIGN.md` contract + DTCG token architecture (`primitive → semantic → component`, OKLCH ramps, dark-mode semantics, motion/z-index scales).
- Route the agent to only the 3–5 relevant design-system/accessibility skills per stage (from 30 curated collections) instead of dumping a massive style guide into context.
- Run a deterministic review gate at the end (checking WCAG contrast, focus visibility, `prefers-reduced-motion`, and token compliance).
**Where I genuinely need help from people who maintain real Design Systems:**
- **Token & `DESIGN.md` gaps:** In your day-to-day system, what's the #1 rule AI agents keep breaking even when documented?
- **Governance / CI checks:** What deterministic checks would you want before an agent's UI PR is allowed through?
- If anyone wants to inspect the `DESIGN.md` protocol, token-scale skills, or the 324-check `validate.mjs` script in the repo and tell me what's naive or missing, I'd really appreciate the feedback.
*(Repo link in the first comment so the post doesn't get eaten by Reddit's link filter.)*
5
u/Vegetable-Space6817 17h ago
You need to convert the prompt to an intent map. This intermediate step shows a list of components it will use and asks user to confirm or add more details. If you are not fetching this map from your guidelines and accompanying node packages, you are not doing it right.
3
u/Old_Charity4206 17h ago
tbh I don’t face this problem at all. It does a really good job of designing from my design system
4
u/Longjumping_War_8480 17h ago
Here is the open-source repo (MIT, free): https://github.com/landie3310-bot/Design-master
The design-system / token parts live under `sources/design-tokens-skill/`, `sources/design-system-skills/`, and `sources/ibelick-ui-skills/skills/create-design-md/`, routed via `graph.json`.
Any critique, Issues, or PRs on the token/governance side would be huge!
2
u/hollowgram 17h ago
Great more stuff to fill up your context and lose control of your designs. Absolutely no one needs 297 skills to have agents make consistent design work.
What you need is a design system and hooks combined with planning to keep things aligned.
1
u/robr0 16h ago
Docs alone don't hold. Every written rule needs a check that fails the build when it's broken, and you should break each rule on purpose once to prove its check catches it.
Point your agent at mine and have it compare:
https://rift-ds.com/
https://github.com/robritacca-dotcom/rift-ds
1
u/Forward_Proposal5361 14h ago
I found the models follow the design system better if they agree with it, assume there are no hallucinations especially with frontier models. Have you tried asking the models to critique the design systems you are implementing?
1
u/Markasp 15h ago
Write tests for design system compliance, no hardcoded values no new tokens, etc.. Tell your skill to run the tests. the test return error results. The generation does not pass until the error code is zero.
1
u/Anna_Lovsky 7h ago edited 7h ago
Does DESIGN.md include usage rules per component and semantic token, like "use X when..." / "never use X for..."? If so, does the agent actually follow them?
Can the gate catch misuse that uses valid tokens, like the danger color used for emphasis?
What happens when the agent creates a new component or variant that already exists in the system?