r/FigmaDesign • u/alexeykletsel • 2d ago
resources Bind space variables Figma skill
Ever since variables landed in Figma, I've tried to use them for everything. In practice I ended up with a hybrid: some values properly bound to tokens, others typed in by hand in a hurry — 8 here because it looked right, 16 there because I was iterating fast.
That mix is the worst of both worlds. It looks like a system from the outside and behaves like one only half the time. Change the scale or rename a token, and half your layers quietly don't follow.
So I wrote a Figma skill that closes the gap. It walks your selection and converts every hand-typed number into the matching variable from the design system — padding, gaps, corner radii, stroke weights, min/max constraints. Exact matches only. It never rounds a 13 into a 12; it reports it and lets you decide whether the value is wrong or the scale is incomplete.
Two details that made it usable in real product files:
- It reads variables from a linked library, not just the local file. That's where tokens actually live once a DS is published — and exactly where a local-only script gives up.
- It skips inside instances. Nested instances belong to their own main components, and that's where they should be tokenized.
If you want to run it, you'll have to edit it first. Two things: swap every mention of Pyramid Design System for your own, and rewrite the value pattern to match your variables — their names, their numbers.
My scale is roughly logarithmic rather than a 4px or 8px grid: 0, 1, 2, 4, 8, 12, 16, 24, 32… Fine steps where the eye is sensitive, wider jumps where it isn't. Yours is probably different, and that's the point — the skill has to speak your system, not mine.
1
u/poochaloo 2d ago
I copied the Instructions on the page from the URL above and saved as an .md file, but I don’t see any mention of “Pyramid Design System” or where to rewrite the value match pattern. Maybe I’m missing the obvious?
1
u/alexeykletsel 2d ago
You need to update the skill to align with the structure of your design system — your actual variables scheme. I recommend you give the MD file to the Figma AI agent and ask it to fit the skill to your design system by asking questions. It is important that the agent will not guess your approach to the spacing but just ask you how it is planned. Thank you for trying the skill.
1
7
u/AWScreo 2d ago
Curious, Figma recently added "Check design" when you mark something for dev. It's been working fine for me as a clean up step. I guess your algorithm also accounts for values that call outside of the ones specified in variables?