Keeping tokens in sync from Figma to code
A simple setup for variables and tokens that never drift apart.

Zander Whitehurst
9 min read
Design tokens are meant to create a single source of truth for colour, spacing, typography and more. In practice, many teams end up with two sources of truth: one in Figma and one in code. Over time they drift apart, and the product slowly becomes inconsistent.
I once spent an entire afternoon trying to work out why a button looked slightly different in production. It turned out we had two tokens with almost identical names and slightly different values, one in Figma and one in code. Two shades of grey, separated by about three percent and a lot of confusion. I still think about that afternoon.
Keeping tokens in sync does not require a complex pipeline. It requires a clear structure, consistent naming and a simple process that everyone follows. Here is a setup that works for most teams.
Why drift happens
Drift usually starts small. A designer adds a new colour variable for a one off design. An engineer hard codes a spacing value because the right token did not exist. A token gets renamed in code but not in Figma.
Each change seems harmless on its own. Together they create a situation where Figma and code no longer match, nobody is sure which is correct and every handoff involves guesswork.
Drift has become even more costly with AI. Agents that read Figma through MCP and build in code will produce inconsistent results if the two do not match.
Start with a shared structure
The foundation of a good token setup is a clear, shared structure. Most teams benefit from two layers:
- Primitive tokens. Raw values such as specific colours, sizes and font weights. These are the palette.
- Semantic tokens. Tokens that describe purpose, such as
surface,text-muted,border-subtleorspace-section. These reference primitives.
Components should almost always use semantic tokens. That way you can change a primitive value or add a dark theme without touching every component.
Use the same names everywhere
The single most effective way to prevent drift is to use identical names in Figma and code. If the Figma variable is called surface/raised, the code token should clearly map to the same name.
Agree on a naming convention early and document it. Include how you separate groups, how you handle states and how you name themes. Consistent naming makes it obvious when something is missing or mismatched.
Decide where tokens are defined
Teams need to decide which side is the source of truth. There are two common approaches:
- Figma first. Tokens are defined as Figma variables and exported to code.
- Code first. Tokens are defined in code and synced into Figma.
Either approach can work. What matters is choosing one and being consistent. Changes should flow in one direction, so there is never confusion about which version is correct.
Automate what you can
Manual syncing works for small systems but becomes fragile as they grow. Tools and plugins can export Figma variables into token files, or import code tokens into Figma. Even a simple script that compares the two and flags differences can prevent drift.
You do not need a perfect automated pipeline on day one. Start with a regular manual check, then automate the steps that cause the most problems.
Make changes visible
Token changes affect the whole product, so they should be visible and reviewed. Treat token updates like any other important change:
- Propose changes clearly, explaining why they are needed
- Review them with both design and engineering
- Update Figma and code together
- Communicate the change to the wider team
A simple changelog for tokens helps everyone understand what has changed and why.
Handle themes properly
Themes such as light and dark mode are where a good token structure really pays off. Each semantic token holds a value for each theme. Components reference the semantic token and automatically adapt.
Make sure themes are defined consistently on both sides. Figma variable modes and code theme values should map to each other exactly, so a design in dark mode looks the same as the built product in dark mode.
Give AI agents clear instructions
AI agents are now some of the most frequent users of your tokens. Make it easy for them to use tokens correctly:
- Keep token names descriptive and semantic
- Document when to use each token in plain language
- Include rules about which tokens components should never use directly
When agents understand your tokens, they produce consistent work across every theme and screen. When they do not, they fall back to hard coded values and drift accelerates. Our AI Color Token Skills package this kind of guidance for colour.
Audit regularly
Even with a good process, some drift will creep in. Schedule regular audits to find hard coded values in code, unused variables in Figma and mismatches between the two.
Each audit is also an opportunity to simplify. Remove tokens nobody uses, merge near duplicates and clarify confusing names. A smaller, cleaner set of tokens is easier to keep in sync.
If your token setup currently lives in a spreadsheet, a Figma page and someone's memory, you are not alone. Most teams start there. The trick is not building the perfect pipeline. It is picking one direction, using the same names and checking in regularly. Boring, consistent habits beat clever tooling every time.
The result
When tokens stay in sync, handoffs become simpler, themes work reliably and AI agents produce consistent output. Designers and engineers spend less time debating values and more time building great products.
It takes discipline to set up, but once the structure and process are in place, keeping Figma and code aligned becomes a normal part of how the team works. We build this whole setup from scratch in the AI Design Systems Bootcamp.
Memorisely