Create Figma Sync skill [WIP] - #11
Conversation
|
awesome thanks @LanesGood ! I haven't tested the actual Figma part so I'll leave that to others to confirm. as for Skill best practices, I'm still learning, here are some thoughts I had (with Claude's help): length and formatthe file length of your SKILL.md is long but ok, the issue is that all 450 lines load every run. ~150 lines are Figma MCP reference material (the tool table, the libraryKey vs fileKey distinction, what each tool can and can't do, the community library mappings, the 3 JS snippets) and those only matter once you're deep in a build. you could decompose this into smaller pieces and have it only load what's needed. See parts to turn into a scriptthe skill asks Claude to read the codebase and work out the imports, the components, the theme tokens, the routes and the test data. It does that from scratch on every run, gets it slightly different each time, and it doesn't say what it found before it starts writing to Figma. A small code script that does the reading and spits out one JSON file would fix all 3 of those. It runs once and it's cheap, and would reduce the need to use tokens. You or another dev can look at the output file and fix anything it got wrong before anything gets written to Figma. And when the code changes later, you compare the new file to the old one instead of rebuilding everything, which is what would make it "sync" both ways. Two similar small things:
Everything that needs a judgment call can stay as it is, that's where markdown/LLMs are helpful. small stuff to fix
The skill saves Figma file keys, library keys, and variant keys into the project's CLAUDE.md in 8 different places. CLAUDE.md gets read at the start of every session in that repo, so everyone loads those keys whether they use this skill or not, and they end up committed for everyone. A |
This skill adds the
figma-sync-codebaseskill, which scans a project’s UI code and generates a matching Figma file with the same component structure, styles, and routed pages. It maps library components, local composites, and design tokens to a 1:1 code-to-Figma representation to align design with implementation.I created this skill with the help of Claude, have used it locally on multiple projects, and find it to provide a quite useful starting point.
Why does this exist?
This skill is mainly for use on projects that already have a codebase with frontend UI code, but no designs in Figma. Designers tasked with updating a project or adding new features often need to recreate a project from scratch in design tools. We can take shortcuts and just use layered screenshots, adding new design elements as needed, or even just wireframe or even ignore existing features in favor of speed. However, rebuilding a codebase in design grants designers the ability to make global changes that can then be reviewed and accepted by stakeholders before implementation, and/or can ensure that new features are designed with existing structural or product limitations and business needs in mind.
Prompting with a generic "generate designs for X project in Figma" command in Claude will typically create screens that either are approximations of screenshots, or are simply not accurate. This skill relies on both the official
figma-mcpplugin and the powertoolfigma-console-mcpto instead reproduce a codebase in the most accurate and componentized way possible. It does this by:There are a lot of gotchas/project-specific things that may prevent this from being a widely useful public skill including:
There are also lots of areas that could still be customized or treated as user options - things like the "single page for every route" could potentially be further configured so that there is just one figma page for each route screen.
The skill does seem to use a lot of tokens - I'm not entirely sure how much is normal. Running this on a recent project, to create file structure, design tokens, shared local components, and the irst full screen took ~178,000 tokens. Claude says each additional screen in this project would be 15,000–25,000 tokens, and there are 20 routes identified in this project for a total of 250,000–400,000 tokens.
This could use a review from @dannybauman @wrynearson or @yellowcap for a review of best practices for Claude Skills. I'm unsure if this is an appropriate length or format. Would also love for @ricardoduplos @faustoperez @fannycc to test this out for greater refinement and ensuring it is applicable across design contexts.