agentleFS
bedomaxbedomax/webdesigner-agent/.claude/skills/figma-to-code/SKILL.md

figma-to-code

Skill1 starsChanged 4 months agoMITView on GitHub

Connect to Figma and implement UI code that faithfully matches the design. Use whenever a Figma link/file is provided, when a design must be translated into components, or when verifying that implemented UI matches the source design pixel by pixel.

18 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use systematic-debugging, mcp-builder and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    systematic-debugging

    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    Also in 3 projects that use this

  • MicrosoftSkill

    mcp-builder

    Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

    Also in 3 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the Figma MCP server (official Figma Dev Mode MCP).

    line 12
  2. Distinctive:

    If the MCP server is not available, ask the user to enable the Figma MCP server or share the design as exported assets + values.

    line 29
  3. Distinctive:

    Check for mapped components: if Code Connect returns a codebase component, use it as-is with the right props.

    line 34
  4. Distinctive:

    Compare against the screenshot: before finishing: spacing, font sizes/weights, line heights, colors, border radii, shadows, icon sizes.

    line 38
  5. Distinctive:

    Icons: use the same icon at the same size.

    line 49

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Figma to Code

Translate Figma designs into production code with high fidelity. The design is the contract — the implementation must match it in spacing, typography, color, and behavior.

Connecting to Figma

Use the Figma MCP server (official Figma Dev Mode MCP). Main tools:

  • get_design_context — primary tool: returns reference code (React + Tailwind), a screenshot, and design hints for a node. Always start here.
  • get_screenshot — visual reference of the exact node; keep it open while implementing.
  • get_metadata — node structure, sizes, and positions when you need the layout tree.
  • get_variable_defs — design tokens (colors, spacing, typography variables) defined in the file.
  • get_code_connect_map — checks if Figma components are already mapped to codebase components; if a mapping exists, USE the mapped component instead of writing new code.

Parsing Figma URLs

figma.com/design/:fileKey/:fileName?node-id=:nodeId
  • Extract fileKey from the path and nodeId from the query (convert - to : — e.g. 123-456 → 123:456).
  • Branch URLs (/branch/:branchKey/): use the branchKey as fileKey.

If the MCP server is not available, ask the user to enable the Figma MCP server or share the design as exported assets + values.

Design-to-Code Workflow

  1. Fetch context: get_design_context for the target node; also get_screenshot for the visual reference.
  2. Check for mapped components: if Code Connect returns a codebase component, use it as-is with the right props.
  3. Extract tokens, not values: map Figma variables to the project's token system (Tailwind theme / CSS custom properties). Never hardcode a hex value that exists as a token.
  4. Reuse project components for buttons, inputs, cards, etc. Only build new primitives when nothing matches.
  5. Implement structurally: recreate the layout with proper semantics and flexbox/grid — never absolute positioning copied from Figma coordinates (Figma's absolute layout is a rendering artifact, not the design intent).
  6. Compare against the screenshot before finishing: spacing, font sizes/weights, line heights, colors, border radii, shadows, icon sizes.

Fidelity Rules (the detail checklist)

Match EXACTLY, do not approximate:

  • Spacing: paddings, gaps, and margins to the pixel (mapped to the nearest token on the project scale — if the design says 24px, use the 24px token, not 20 or 32).
  • Typography: family, size, weight, line-height, letter-spacing, and text color per text style.
  • Color: exact token/hex including opacity. Check fills AND strokes.
  • Borders & radii: width, color, and per-corner radius.
  • Shadows: x, y, blur, spread, color with alpha — copy the exact values.
  • Icons: use the same icon at the same size; export from Figma if not in the project's icon set.
  • States: implement hover/focus/active/disabled variants if designed; if not designed, derive them consistently from the design system and note it in the spec.

What Figma Doesn't Tell You (fill the gaps deliberately)

  • Responsive behavior: Figma frames are fixed-width. Decide how the layout adapts at each breakpoint and document it in the spec. When mobile/desktop frames both exist, implement both and interpolate between them.
  • Interactions: transitions, loading, empty, and error states usually aren't designed — derive them from the design system and list them in the spec.
  • Real content: designs use ideal content. Verify the layout survives long text, missing images, and translations (no overflow, truncation rules defined).
  • Accessibility: Figma doesn't encode semantics. Add proper elements, alt text, labels, and focus order yourself.

Verification

  • Side-by-side comparison: rendered implementation vs get_screenshot output at the same viewport width.
  • Overlay check when precision matters: screenshot the implementation and diff against the Figma export.
  • Ship only when a designer could not tell the implementation from the mock.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.