Sync Figma Design Tokens Locally

VerifiedSafe

Extract design tokens and component definitions from a Figma file via the Figma MCP server and save them as local JSON files for use by hp-gen.

Sby Skills Guide Bot
DevelopmentIntermediate
9/15/2026
Claude Code
#figma#design-tokens#mcp#design-system#json

Recommended for

Automated summary

Extracts design tokens and component definitions from a Figma file through the Figma MCP server and saves them as local JSON files for hp-gen.

Strengths

  • Actually tests the MCP connection with a get_metadata call before extracting, and gives detailed troubleshooting messages on failure
  • Handles both design system library files and page-based website design files with sections
  • Writes the Figma file key back into the config so the URL isn't needed on later runs
  • Communicates in the language set by defaultLocale (ko, en, vi)

Limitations

  • Requires a Figma MCP server that is installed, authenticated and reachable; otherwise the skill exits
  • Depends on a plugin-specific config file (.claude/homepage-plugin.json), so it is not easily reusable outside that plugin
  • Only produces local JSON files — generating components is left to hp-gen
When to use it

Use it when you need to pull the latest tokens and component definitions from a Figma file into local JSON before running hp-gen.

When not to use it

Avoid it for simply browsing a Figma file, or when no Figma MCP server is set up and accessible.

Security analysis

Safe
Quality score92/100

The skill reads and writes local configuration and JSON files, and interacts with the official Figma MCP server to retrieve design data. It does not instruct destructive commands, exfiltration, obfuscation, or disabling of safety. The allowed tools include Bash and Agent, but the skill text does not use Bash for shell execution; Agent is used to call MCP tools for legitimate purposes.

No concerns found

How this analysis is made

Examples

Sync from a file URL
Sync the design tokens from https://www.figma.com/design/abc123XYZ/My-Site into local JSON files so I can run hp-gen.
Re-sync using saved config
Refresh the design tokens for my homepage plugin from Figma — the file key is already in .claude/homepage-plugin.json.
Target a single page
Pull just the Home page sections from this Figma link: https://www.figma.com/design/abc123XYZ/My-Site?node-id=12-345

name: hp-design-sync description: "Sync design tokens and component definitions from Figma into local JSON files. Requires Figma MCP." argument-hint: "[figma-file-url]" user-invocable: true allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent

Sync Design Tokens from Figma

Extract design tokens and component definitions from a Figma file via the official Figma MCP server, saving them as local JSON files for use by hp-gen.

Supports both design system library files and page-based design files (where each Figma page represents a website page with sections as child frames).

Instructions

Step 0: Read Configuration

Read .claude/homepage-plugin.json. Extract defaultLocale for communication language.

Language mapping:

  • ko → Korean
  • en → English
  • vi → Vietnamese

Step 1: Resolve Figma File Key

Determine the Figma file key from one of these sources (in priority order):

  1. Skill argument — if [figma-file-url] was provided, extract the file key using regex: figma\.com/(file|design)/([a-zA-Z0-9]+)
  2. Configuration — read figmaFileKey from .claude/homepage-plugin.json
  3. User prompt — if neither is available, ask the user for a Figma file URL

Also extract nodeId from URL if present (query param node-id). This allows targeting a specific page or frame.

Once resolved, if figmaFileKey is not already in .claude/homepage-plugin.json, update the config file to add figmaFileKey and figmaFileUrl fields.

Step 2: Verify Figma MCP Connection

2.1 Tool Discovery

Check that Figma MCP tools are available. Look for tools matching any of these patterns:

  • mcp__figma__*
  • mcp__figma_desktop__*
  • mcp__Figma__*

If no Figma MCP tools are found, display an error message with setup instructions:

Figma MCP not connected.

To set up the Figma MCP server:

  1. Remote (recommended): Add https://mcp.figma.com/mcp as an MCP server
  2. Or install the Figma desktop MCP plugin

See: https://developers.figma.com/docs/figma-mcp-server/

Then exit.

Identify the exact tool name prefix (e.g., mcp__figma__ or mcp__figma_desktop__) for passing to the agent.

2.2 Connectivity Test

After identifying the tool prefix, perform an actual MCP call to verify the connection works:

Call {mcpToolPrefix}get_metadata with the fileKey from Step 1.

  • Success: The tool returns file metadata (page names, node structure). Proceed to Step 3 using this response (avoids a redundant call).
  • Failure / Error / Timeout: Display an error:

Figma MCP connection failed.

Tools with prefix {mcpToolPrefix} were found but the connection test failed. Error: {error message}

Possible causes:

  1. The MCP server is not running or unreachable
  2. The Figma file key is invalid: {fileKey}
  3. You don't have access to this Figma file
  4. The MCP server needs re-authentication

Try restarting the MCP server or re-adding it.

Then exit. Do NOT proceed to the agent if the connectivity test fails.

Step 3: Discover File Structure and Classify Pages

Use the get_metadata response from Step 2.2 (do not call again — reuse the connectivity test result).

3.1 Determine File Structure

Analyze the result to determine the file structure:

  • Page-based: The file contains pages with names like "Home", "About", "Services", etc. Each page has child frames representing sections (hero, features, etc.). This is the common case for website design files.
  • Library-based: The file contains pages with names like "Components", "Styles", "Tokens", "Primitives". This is a design system library.

3.2 Classify Pages

For page-based files, classify each page into one of four categories using name pattern matching:

| Category | Name Patterns (case-insensitive) | Purpose | |---|---|---| | website | "Home", "About", "Services", "Pricing", "Contact", "Blog", "FAQ", "Landing", "Portfolio" and other website page names | Website pages with sections | | layout | "Layout", "Shared", "Common", "Global", "Navigation" | Header/Footer/Nav definitions | | icons | "Icons", "Iconography", "Icon Set", "Icon Library" | Icon component library | | components | "Components", "Design System", "Library", "UI Kit", "Atoms", "Molecules" | Additional UI components |

Pages that do not match any non-website pattern default to website.

Viewport detection: For website pages, detect if multiple viewport variants exist. Common patterns:

  • Same page name with viewport suffix: "Home - Desktop", "Home - Mobile", "Home - Tablet"
  • Same page name with size suffix: "Home 1440", "Home 375", "Home 768"
  • Separate pages named "Mobile", "Tablet", "Responsive"
  • Frames within a page with different widths (check via get_metadata child frame dimensions)

If multiple viewports are detected, group them by page and record the viewport info in selectedPages:

{ "name": "Home", "nodeId": "0:1", "pageType": "website", "viewport": "desktop", "viewportWidth": 1440 }
{ "name": "Home - Mobile", "nodeId": "0:4", "pageType": "website-mobile", "viewport": "mobile", "viewportWidth": 375, "desktopPageName": "Home" }

If no mobile/tablet variants are found, this is normal — the section generator will apply responsive breakpoint inference rules.

For library-based files, all pages default to components category.

3.3 User Confirmation

Display the classified pages with their detected categories to the user:

Detected pages:
  [website]     Home (5 sections)
  [website]     About (3 sections)
  [layout]      Layout (Header, Footer)
  [icons]       Icons (24 components)
  [components]  Components (Card, Badge, Avatar, ...)

Ask:

"Which pages should we extract? You can also change page categories if the auto-detection is wrong. (Enter page names or 'all')"

The user can:

  • Select which pages to extract
  • Override a page's category (e.g., reclassify a page auto-detected as components to website)

If a nodeId was extracted from the URL in Step 1, pre-select the corresponding page.

Step 4: Check Existing Design System

Read docs/design-system/design-tokens.json if it exists.

  • If it exists, show the last sync time (extractedAt field) and ask: "Update existing tokens or replace entirely?"
    • Update — agent merges new values with existing ones
    • Replace — agent overwrites completely
  • If it does not exist, proceed with fresh extraction.

Step 5: Launch Design Token Extractor Agent

Launch the design-token-extractor agent with the following parameters:

  • fileKey — the Figma file key from Step 1
  • mcpToolPrefix — the MCP tool name prefix identified in Step 2
  • selectedPages — list of { name, nodeId, pageType } objects selected by the user in Step 3. pageType is one of "website", "website-mobile", "website-tablet", "layout", "icons", "components"
  • fileStructure — "page-based" or "library-based" (from Step 3)
  • projectRoot — current working directory
  • outputDir — docs/design-system/
  • mode — "update" or "replace" (from Step 4, default "replace" for fresh extraction)
  • figmaAccessToken — (optional) read from .claude/homepage-plugin.json. If present, enables REST API image export fallback. If absent, omit this parameter.

Step 6: Validate Output

After the agent completes, first check for extraction failure:

6.0 Check for total failure:

  • If docs/design-system/extraction-error.json exists, read it and display the error:

    Design token extraction failed. {error message from the file}

    No design tokens were extracted. Check your Figma MCP connection and try again. Then exit without proceeding to Step 7.

6.1 Structural validation — verify the output files exist and are well-formed:

  1. docs/design-system/design-tokens.json must exist and contain:

    • $schema field equal to "design-tokens-v1"
    • colors object with at least primary, background, foreground
    • cssVariables object with :root containing at least 10 CSS variable entries
    • typography object with fontFamily
    • extractionStats object
  2. docs/design-system/component-map.json must exist and contain:

    • $schema field equal to "component-map-v1"
    • pages object with at least one page entry (for page-based files) OR globalComponents object (for library-based files)
    • extractionStats object

If structural validation fails, report which fields are missing and suggest re-running.

6.2 Extraction coverage validation — verify that meaningful data was extracted from Figma:

Read extractionStats.overallCoverage from design-tokens.json.

  • Coverage >= 0.5 (50%+) → proceed normally
  • Coverage < 0.5 but > 0 → display a warning:

    Low extraction coverage ({coverage*100}%). Most design tokens are using default values, not values from your Figma file. This may indicate that the Figma file has non-standard variable naming, or that some MCP tool calls failed during extraction.

    You can:

    1. Proceed with the current tokens (defaults will be used for missing values)
    2. Re-run /homepage-plugin:hp-design-sync to retry extraction
    Ask the user whether to proceed or retry.
  • Coverage == 0 → display an error:

    No tokens were extracted from Figma. All values in the output are defaults. This likely means the Figma MCP connection failed silently during extraction.

    Please verify your Figma MCP connection and re-run /homepage-plugin:hp-design-sync. Then exit.

6.3 Content image validation (page-based files only):

Read component-map.json and check sections that have contentImages:

  1. For each section with contentImages.status !== "none":

    • Verify that files referenced in contentImages.images[].path actually exist at {projectRoot}/src/assets/{path}
    • Count total extracted vs failed
  2. If any images have extracted: false, collect all manualExport entries and display a single actionable guide:

    The following images need to be exported manually from Figma:

    | # | Figma Layer | Section | Save To | |---|---|---|---| | 1 | {manualExport.figmaNodeName} | {sectionType} | {manualExport.saveTo} | | 2 | ... | ... | ... |

    Export steps:

    1. Open the Figma file
    2. Select the layer listed above
    3. In the right panel, click "Export" → Format: PNG, Scale: 2x
    4. Save to the path shown in "Save To" (relative to project root)

    After placing the files, proceed with /homepage-plugin:hp-plan. Missing images will use placeholder values during code generation — optional image props will be omitted, required ones will get a TODO comment.

  3. If contentImages.extractionSummary shows total: 0 across all sections but image-bearing section types exist (HeroSection, TeamSection, etc.), display a note:

    No content images were found in the Figma sections.

    This is common when logos or illustrations are drawn as vector shapes rather than placed as image files. Figma MCP cannot export vector-only nodes as files.

    You can add images after running /homepage-plugin:hp-plan by exporting from Figma (Select layer → right panel "Export" → PNG @2x) and placing them in src/assets/images/{pageName}/{sectionType}/.

6.4 Layout validation (if any selected page had pageType: "layout", or component-map.json contains sharedComponents):

  1. If component-map.json has sharedComponents.Header or sharedComponents.Footer:
    • Verify docs/pages/_shared/layout-plan.json exists
    • Verify screenshot files referenced in sharedComponents[].screenshotRef exist under docs/design-system/
  2. If layout pages were selected but sharedComponents is empty or missing, display a warning:

    No layout components were detected in the layout page(s).

    The page was classified as a layout page but no Header or Footer frames were found. You can define the layout manually during /homepage-plugin:hp-plan.

6.5 Icon map validation (if any selected page had pageType: "icons"):

  1. Verify iconMap exists in component-map.json

  2. If iconMap.unmappedCount > 0, display a warning:

    {unmappedCount} icon(s) could not be mapped to Lucide icons.

    Unmapped icons:

    • {figmaName} — no Lucide match (custom SVG path saved)
    • ...

    These will use inline SVG rendering during code generation.

  3. If iconMap.totalCount === 0, display a note:

    No icon components were found in the icon page(s).

6.6 Additional components validation (if any selected page had pageType: "components"):

  1. Verify additionalComponents exists in component-map.json
  2. Display the list of discovered additional components:

    Additional components extracted: {count} {ComponentName1}, {ComponentName2}, ...

  3. If additionalComponents is empty, display a note:

    No additional components found beyond the standard 7 UI components.

Step 7: Display Summary

Show extraction results:

  • File structure detected (page-based / library-based)
  • Pages extracted by category:
    • Website pages (with section counts per page)
    • Layout pages (Header/Footer extracted: Y/N)
    • Icon pages (mapped/total icons)
    • Component pages (additional component count)
  • Number of color tokens extracted
  • Number of typography scales
  • Number of sections discovered and mapped
  • Number of UI components identified (Button, Input, etc.)
  • Content images extracted: {extracted} / {total} across {sectionsWithImages} sections
  • If any images failed: list failed images by section type
  • Layout components: Header (Y/N), Footer (Y/N) — if extracted
  • Layout plan pre-populated: layout-plan.json (Y/N) — if layout extracted
  • Icons: {mapped}/{total} mapped to Lucide, {unmapped} custom — if icons extracted
  • Additional components: {count} discovered — if component pages extracted

Show next step guidance:

  • If layout was extracted: "Layout pre-populated from Figma. Run /homepage-plugin:hp-plan to review and customize header/footer definitions."
  • If layout was NOT extracted: "Run /homepage-plugin:hp-plan to define pages, sections, and layout."
  • If icons were extracted: "Icon mappings saved. Section generator will use matched Lucide icons during /homepage-plugin:hp-gen."
  • "Run /homepage-plugin:hp-design-sync again to re-sync after Figma updates."

Communication Language

Use the defaultLocale from the configuration for all user-facing output:

  • ko → Korean
  • en → English
  • vi → Vietnamese

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/sync-figma-design-tokens-locally-mu26hb73/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/sync-figma-design-tokens-locally-mu26hb73' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/sync-figma-design-tokens-locally-mu26hb73/download' --output '.skill-downloads/sync-figma-design-tokens-locally-mu26hb73/SKILL.md.part' && mv '.skill-downloads/sync-figma-design-tokens-locally-mu26hb73/SKILL.md.part' '.skill-downloads/sync-figma-design-tokens-locally-mu26hb73/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Write, Edit, Glob, Grep, Bash, Agent

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/sync-figma-design-tokens-locally-mu26hb73/SKILL.md' && test -s '.skill-downloads/sync-figma-design-tokens-locally-mu26hb73/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/hp-design-sync' && cp -R '.skill-downloads/sync-figma-design-tokens-locally-mu26hb73' '.claude/skills/hp-design-sync'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/sync-figma-design-tokens-locally-mu26hb73'

openskills read 'sync-figma-design-tokens-locally-mu26hb73'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/sync-figma-design-tokens-locally-mu26hb73/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills