What is the figma-to-react skill?
figma-to-react is a skill in the majiayu000/spellbook library. It tells an AI coding agent to convert Figma MCP output into React or Next.js components with TypeScript and Tailwind CSS, following numbered rules on code truncation, absolute positioning, dimensions, font loading and text heights.
A header title at top 41px, not 82px, and a header line at top 100px, not 141px. Those verified positions sit in the figma-to-react skill because it exists to stop a common mistake when turning Figma MCP output into code.
The skill's own description is extracting Figma designs into production-ready React or Next.js components with TypeScript, Tailwind CSS and pixel-perfect accuracy. It is a long list of rules, each with a wrong and a correct example.
The rules, in the order the skill lists them
- Never truncate code. Use all of the Figma MCP output and keep every className.
- Flatten
absolute contentswrappers. Children are already positioned absolutely, so keep their offsets and drop the parent. - Extract dimensions from metadata by calling
mcp__figma__get_metadata, never hardcode a frame size. - Load fonts from the Google Fonts CDN link in layout.tsx instead of
next/font/google, and map Figma font names to Tailwind classes. - Add critical CSS to globals.css, including horizontal overflow and a
.page-containerthat does not compress. - Replace simple line images with CSS lines.
- Inline SVG assets.
- Remove fixed heights from multi-line text blocks.
Why the font and height rules matter
The skill warns that Figma weight names may not match CSS weights. Bold may need 500 or 600, and ExtraBold may need 700, so you compare against a Figma screenshot. It also fixes old names: Source Serif Pro becomes Source Serif 4.
On text, it explains that fixed heights from Figma cause overflow and different line counts, so multi-line paragraphs lose their height. Containers, single-line table rows and images keep theirs. Later rules, including table pattern detection, live in a reference file.
Who the figma-to-react skill is for
Best for
- Developers who already have a Figma MCP server connected and want the generated React matched to the design. See Framelink Figma MCP or the free Figma MCP for ways to connect.
- Teams building in Next.js with Tailwind, where Tailwind 4 conventions may also apply.
- Anyone whose pages must match a fixed frame, such as 1920 by 1080, closely.
Not for
- Projects without a Figma MCP connection, since every rule starts from its output.
- Fluid layouts. The skill leans on absolute positioning taken from the frame, so use frontend responsive UI when the page must reflow.
- Sites that will live in WordPress, where React output is the wrong target.
Use it with UiChemy
This skill outputs React, not WordPress. If your Figma design is headed for Elementor or Gutenberg, UiChemy's Figma to WordPress plugin converts the design directly. Click Get Started on uichemy.com to see that route.
How to install Figma to React Skill: Lossless Next.js Components
git clone https://github.com/majiayu000/spellbook.gitThe README's quick start uses a skills CLI form. This page lists the clone route instead, with the repository's install.sh as the alternative.Clone the repository
Run
git clone https://github.com/majiayu000/spellbook.git. The skill is in plugins/spellbook-ui/skills/figma-to-react.Copy the skill folder
Copy that folder, including its reference subfolder with extended.md, into your agent's skills folder. For Claude Code the README names ~/.claude/skills, and for Codex it names ~/.agents/skills.
Or use the repository installer
The README shows
./install.sh --target all --skillsfollowed by comma separated skill names, run from the clone. Pass figma-to-react as the name.Connect a Figma MCP server
The skill expects Figma MCP output and a metadata call, so connect one before you start.
Check that it loaded
In Claude Code, type / and look for figma-to-react in the list. For Codex, restart it so it reloads ~/.agents/skills. Then ask for a component from a Figma frame and check that className values are kept.
Key features
- Lossless output ruleUse all of the Figma MCP output and keep every className, since removing any of them changes the result.
- Wrapper flatteningRemoves redundant
absolute contentsparents and keeps the children's own top and left values. - Position tableA small table says when to keep child offsets as they are and when to add parent and child values.
- Metadata-based sizingCalls
mcp__figma__get_metadatawith a file key and node ID, then reads width and height from the returned frame. - Google Fonts CDN loadingPuts a Google Fonts link in layout.tsx, with the opsz axis for Source Serif 4, instead of using
next/font/google. - Font name mappingConverts Figma font strings to Tailwind classes such as font-kaisei font-extrabold, and corrects Source Serif Pro and Source Sans Pro to the 4 and 3 names.
- Weight mismatch guidanceNotes that Figma Bold may need 500 or 600 and ExtraBold may need 700, and says to test visually.
- Critical CSSAdds body overflow-x auto and a page-container with min-width max-content and inline-block display.
- Lines and SVG cleanupSwaps simple line images for CSS lines and inlines SVG assets in place of image tags.
- Text height ruleRemoves fixed heights from multi-line text and keeps them on containers, single-line table rows, images and icons.
Frequently asked questions
What does the figma-to-react skill do?
It gives an AI coding agent rules for turning Figma MCP output into React or Next.js components with TypeScript and Tailwind CSS. The rules cover code truncation, absolute positioning, dimensions, fonts, critical CSS, line images, SVGs and fixed text heights.
How do I install figma-to-react?
Clone majiayu000/spellbook and copy plugins/spellbook-ui/skills/figma-to-react into your agent's skills folder. The README also describes an install.sh script that takes comma separated skill names with a skills flag, so figma-to-react can be named there.
Does it need a Figma MCP server?
Yes. The first rule is to use all of the Figma MCP output, and the third calls mcp__figma__get_metadata for frame width and height. Without an MCP connection there is nothing for the rules to act on.
Why does it avoid next/font/google?
The skill says the self-hosted font output can render differently from reference HTML that uses the Google Fonts CDN, causing different character widths and optical size handling. It puts a CDN link in layout.tsx and includes the opsz axis for Source Serif 4.
Which agents does the figma-to-react skill support?
The repository describes cross-runtime skills for Claude Code and Codex. Its README lists Claude Code at ~/.claude/skills and Codex at ~/.agents/skills. It does not list other agents for this skill, so check before using it elsewhere.
Does it produce responsive layouts?
The skill's examples use absolute positions and fixed pixel sizes from the Figma frame, such as w-[1920px]. It does not describe a responsive pass, so plan separate work if the page must reflow across screen sizes.
What is in the extended reference?
SKILL.md says material starting at Rule 8, table pattern detection and conversion, was moved to reference/extended.md to keep the skill concise. The agent loads it when the task needs the moved examples, checklists or platform details.
What license does figma-to-react use?
The majiayu000/spellbook repository is MIT licensed, and the skill sits inside it. Read the license file in the repository before you copy the skill into a product you plan to distribute.


