figma-to-code

figma-to-code is a skill for Claude Code from XRenSiu/claude-code-forge. It costs 97 tokens per session (5,602 once invoked), scanned A, original, MIT.

A workflow for turning a Figma design, a tool for creating interface layouts, into code that uses the project's existing components. It can obtain design details, correct generated code, transform it, and download design assets when the required connections are available.

In plain words
What is it for?
Use it when given a Figma URL and asked to implement the design in a project, especially when the project has a registered component library.
Why use it?
It avoids copying raw generated output that may contain syntax errors or ignore the project's component library. It also identifies when a Figma connection, component registry, or API token is needed.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter. Also seen: mentions subagents.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import iconHome from '../assets/home.png'.

Part of the pdforge plugin — 10 skills, 13 commands, 5 agents, 2 hooks shipped together

Good fit Use it when given a Figma URL and asked to implement the design in a project, especially when the project has a registered component library.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/XRenSiu/claude-code-forge
agentmods
npx agentmods add skills/xrensiu/claude-code-forge/figma-to-code

Made for: Claude Code.

Or install pdforge, the plugin that ships this one along with the rest of its 10 skills, 13 commands, 5 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for figma-to-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/figma-to-code/github.svg)](https://agentmods.dev/skills/xrensiu/claude-code-forge/figma-to-code)
Your own site
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/figma-to-code"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/figma-to-code/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for figma-to-code

Your own site · 80×15
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/figma-to-code"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/figma-to-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,602 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00097 $0.05602
Opus 5.5 $0.00039 $0.02241
Sonnet 5.5 $0.00019 $0.01120
Haiku 4.5 $0.00010 $0.00560

Measured 1mo ago against content hash c1ee7d599b13, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

figma-to-code scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

使用 curl 下载所有资产到本地,**命名要语义化**:
plugins/pdforge/skills/figma-to-code/SKILL.md · 481 lines

How it starts

The opening of the file, as written. The whole thing — 481 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Figma to Code

核心原则

使用项目组件库生成代码,而非 Figma MCP 的原始输出。 MCP 返回的代码有语法问题且不使用项目组件,必须经过修复和转换。

前提条件

  1. Figma MCP 已连接
  2. 可选:项目配置了 local-code-connect(有组件库时)
    • package.json 中有 localCodeConnect.registry 配置
    • 或项目内存在 .figma-registry.json 文件(通过 glob 搜索发现)
    • 组件库已导出注册表文件
  3. 强烈推荐:Figma API Token(用于获取完整组件属性)
    • 环境变量 FIGMA_TOKEN 或 CLI --figma-token
    • 或项目 .env 文件中定义 FIGMA_TOKEN=figd_xxx
    • 没有 Token 时约 60% 的组件 props 会为空,严重影响代码准确性
    • MCP 不返回组件 variant/boolean 属性值,REST API 能补全

何时使用

digraph {
    rankdir=TB;
    
    start [label="收到 Figma URL" shape=oval];
    use [label="使用此 Skill" shape=box style=filled fillcolor=lightgreen];
    skip [label="不需要此 Skill" shape=box];
    
    start -> use [label="要求生成代码"];
    start -> skip [label="只是查看设计"];
}

流程概览

digraph {
    rankdir=TB;

    s1 [label="Step 1\n读取项目上下文" shape=box];
    q1 [label="有 localCodeConnect\n配置?" shape=diamond];
    s2 [label="Step 2\n获取设计稿" shape=box];
    s3 [label="Step 3\n修复 MCP Code" shape=box];
    s4 [label="Step 4\nCLI transform" shape=box style=filled fillcolor=lightyellow];
    s5 [label="Step 5\n下载 MCP 资产" shape=box style=filled fillcolor=lightblue];
    s6a [label="Step 6\n根据 JSON + 注册表\n生成代码" shape=box];
    s6b [label="Step 6\n根据 MCP 代码\n生成代码" shape=box];
    s7 [label="Step 7\n验证" shape=box];

    s1 -> q1;
    q1 -> s2 [label="是"];
    q1 -> s2 [label="否"];
    s2 -> s3;
    s3 -> s4 [label="有组件库"];
    s3 -> s5 [label="无组件库"];
    s4 -> s5;
    s5 -> s6a [label="有组件库"];
    s5 -> s6b [label="无组件库"];
    s6a -> s7;
    s6b -> s7;
}

标注说明:

  • 黄色:Step 4 仅在有组件库时执行
  • 蓝色:Step 5 下载资产是必须步骤,所有流程都要执行

流程

必须按顺序执行,不允许跳过任何步骤。

Step 1: 读取项目上下文

在调用任何 Figma MCP 之前:

1a. 发现组件注册表

按优先级依次检查,任一方式找到即可:

  1. 读取 package.json,检查 localCodeConnect.registry 配置
  2. 如果第 1 步未找到:用 glob 搜索项目内的 **/.figma-registry.json 文件
  3. 如果找到注册表:读取它,了解可用组件及其 props
// package.json 配置示例(可选,但推荐)
{
  "localCodeConnect": {
    "registry": "./node_modules/@xrs/vue/dist/.figma-registry.json"
  }
}

Read the full file on GitHub · 481 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 481 lines · 97 tokens per session scan A c1ee7d599b13

Subscribe to this mod's changes

figma-to-code is a skill published in the GitHub repository XRenSiu/claude-code-forge (2 stars, last pushed 29d ago), licensed MIT. It adds 97 tokens to every session and 5,602 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.

Related

Other skills, from other repositories

anti-slop-design

Autonomous Principal Design Technologist. Cures vibe-coded software from AI frontend slop using curated token archetypes and 7-axis quality gating.

sickn33/agentic-awesome-skills · 34 tokens

chakra-ui-builder

Build responsive, accessible UI components and layouts using Chakra UI v3, install or configure Chakra UI in new and existing projects, and design scalable themes using tokens, semantic tokens, recipes, and slot recipes. Use this skill whenever a user asks to build, create, or generate any UI component, page, form…

chakra-ui/chakra-ui · 214 tokens

visual-ralph

Visual Ralph orchestration for frontend UI from generated references, static references, or live URL targets, using $ultragoal with built-in visual verdict and pixel-diff evidence until the implementation matches and leaves a reproducible design system.

Yeachan-Heo/oh-my-codex · 52 tokens

frontend-ui-dark-ts

Build dark-themed React applications using Tailwind CSS with custom theming, glassmorphism effects, and Framer Motion animations. Use when creating dashboards, admin panels, or data-rich interfaces with a refined dark aesthetic.

microsoft/skills · 48 tokens

open-design-setup

Prepare or repair a project's prototyping environment so open-design can build prototypes with the project's own component library and render them through the project's toolchain. Use when the library target is needed and docs/design/prototyping.md is missing, stale, or failing; excludes HTML-only design work and…

compozy/compozy · 67 tokens

frontend-visual-qa

Audits rendered UI and specific task/object-link handoffs; excludes ordinary source citations alone. Audits already-rendered UI and Markdown/Obsidian image layout — web app, deck/slide, dashboard, design-system, or Electron/native app — via real-browser/native-app journeys and a Playwright sweep. Use after UI…

daymade/claude-code-skills · 125 tokens