
Figma Code Connect
Create and maintain Figma Code Connect `.figma.ts` templates that map published library components to real code snippets via the Figma MCP.
Overview
figma-code-connect is an agent skill for the Build phase that creates and maintains Figma Code Connect `.figma.ts` templates mapping published components to code via the Figma MCP.
Install
npx skills add https://github.com/figma/mcp-server-guide --skill figma-code-connectWhat is this skill?
- Author `.figma.ts` Code Connect template files (MCP-driven context fetch—not CLI-only `figma.connect()` parser flows alo
- Requires Figma MCP tools such as get_code_connect_suggestions before proceeding
- Stops with guidance if components are unpublished or plan is below Organization/Enterprise
- Figma URL must include node-id query parameter
- TypeScript types via @figma/code-connect/figma-types for editor autocomplete
Adoption & trust: 1.4k installs on skills.sh; 1.6k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Figma design system and frontend components are out of sync and manually writing Code Connect mappings from screenshots is error-prone.
Who is it for?
Indie builders on Org/Enterprise Figma with a published library who already run the Figma MCP in Claude Code or Cursor.
Skip if: Free/Professional Figma plans, unpublished components, or teams that only need static design export without Code Connect maintenance.
When should I use this skill?
User mentions Code Connect, Figma component mapping, design-to-code translation, or asks to create/update .figma.ts or .figma.js files.
What do I get? / Deliverables
Updated or new `.figma.ts` template files that map the specified Figma node to code snippets with MCP-fetched component context.
- .figma.ts Code Connect template files
- Mapped code snippets per Figma component
Recommended Skills
Journey fit
How it compares
MCP-guided template authoring skill—not the same as shipping parser-based `.figma.tsx` via the Code Connect CLI alone.
Common Questions / FAQ
Who is figma-code-connect for?
Solo frontend builders and tiny teams aligning React (or similar) code with a published Figma design system using agent-assisted Code Connect templates.
When should I use figma-code-connect?
During Build frontend when you have a Figma URL with node-id and need to create or update Code Connect mapping files after MCP verification.
Is figma-code-connect safe to install?
See the Security Audits panel on this Prism page; enabling Figma MCP exposes design metadata to the agent—confirm team sharing boundaries before connecting.
SKILL.md
READMESKILL.md - Figma Code Connect
# Code Connect ## Overview Create Code Connect template files (`.figma.ts`) that map Figma components to code snippets. Given a Figma URL, follow the steps below to create a template. > **Note:** This project may also contain parser-based `.figma.tsx` files (using `figma.connect()`, published via CLI). This skill covers **templates files only** — `.figma.ts` files that use the MCP tools to fetch component context from Figma. ## Prerequisites - **Figma MCP server must be connected** — verify that Figma MCP tools (e.g., `get_code_connect_suggestions`) are available before proceeding. If not, guide the user to enable the Figma MCP server and restart their MCP client. - **Components must be published** — Code Connect only works with components published to a Figma team library. If a component is not published, inform the user and stop. - **Organization or Enterprise plan required** — Code Connect is not available on Free or Professional plans. - **URL must include `node-id`** — the Figma URL must contain the `node-id` query parameter. - **TypeScript types** — for editor autocomplete and type checking in `.figma.ts` files `@figma/code-connect/figma-types` must be added to `types` in `tsconfig.json`: ```json { "compilerOptions": { "types": ["@figma/code-connect/figma-types"] } } ``` ## Step 1: Parse the Figma URL Extract `fileKey` and `nodeId` from the URL: | URL Format | fileKey | nodeId | |---|---|---| | `figma.com/design/:fileKey/:name?node-id=X-Y` | `:fileKey` | `X-Y` → `X:Y` | | `figma.com/file/:fileKey/:name?node-id=X-Y` | `:fileKey` | `X-Y` → `X:Y` | | `figma.com/design/:fileKey/branch/:branchKey/:name` | use `:branchKey` | from `node-id` param | Always convert `nodeId` hyphens to colons: `1234-5678` → `1234:5678`. **Worked example:** Given: `https://www.figma.com/design/QiEF6w564ggoW8ftcLvdcu/MyDesignSystem?node-id=4185-3778` - `fileKey` = `QiEF6w564ggoW8ftcLvdcu` - `nodeId` = `4185-3778` → `4185:3778` ## Step 2: Discover Unmapped Components The user may provide a URL pointing to a frame, instance, or variant — not necessarily a component set or standalone component. Call the MCP tool `get_code_connect_suggestions` with: - `fileKey` — from Step 1 - `nodeId` — from Step 1 (colons format) - `excludeMappingPrompt` — `true` (returns a lightweight list of unmapped components) This tool identifies published components in the selection that don't yet have Code Connect mappings. **Handle the response:** - **"No published components found in this selection"** — the node contains no published components. Inform the user they need to publish the component to a team library in Figma first, then stop. - **"All component instances in this selection are already connected to code via Code Connect"** — everything is already mapped. Inform the user and stop. - **Normal response with component list** — extract the `mainComponentNodeId` for each returned component. Use these resolved node IDs (not the original from the URL) for all subsequent steps. If multiple components are returned (e.g. the user selected a frame containing several different component instances), repeat Steps 3–6 for each one. ## Step 3: Fetch Component Properties Call the MCP tool `get_context_for_code_connect` with: - `fileKey` — from Step 1 - `nodeId` — the resolved `mainComponentNodeId` from Step 2 - `clientFrameworks` — determine from `figma.config.json` `parser` field (e.g. `"react"` → `["react"]`) - `clientLanguages` — infer from project file extensions (e.g. TypeScript project → `["typescript"]`, JavaScript → `["javascript"]`) For multiple components, call the tool once per node ID. The response contains