agentleFS
sushi-killersushi-killer/sushiAI/.agents/skills/figma-to-code/SKILL.md

figma-to-code

Skill2 starsChanged 24 days agoMITView on GitHub

Turn a Figma concept frame into exact code metrics and check the built screen against it: export a node dump to a snapshot, generate token-only CSS, measure the running app and compare, with a pass/fail table. Use whenever a screen must match a Figma frame 1:1, when the owner says a screen must look like the concept, or before design-critic reviews a converted screen.

  • Reads credentials

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

Files
SKILL.md

Figma to code

A PNG is a picture, not a spec. This loop reads the numbers out of Figma and checks the built app against them, so "matches the concept" is an exit code.

The figma-console MCP is available only to the lead session. The lead extracts dumps; an implementer works from the saved files. Everything under concepts/figma/export/ is gitignored and holds real concept names: never copy its strings into a committed file, test or doc.

Loop

  1. Extract (lead). For each frame call figma_get_component_for_development_deep with the frame node id and save the tool-result JSON as concepts/figma/export/raw/R<n>.json. Done when: the file parses and its top node is the 1380x864 window frame.
  2. Snapshot. node scripts/figma-export.mjs concepts/figma/export/raw/R1.json writes concepts/figma/export/snapshots/R1.json: layer tree with boxes relative to the content root, layout, radius, stroke, fill and text metrics. The root is found by stripping the shell (title bar, sidebar); pass --root <layer name> when it picks wrong. Done when: the printed root is the area under test and every UNMAPPED/UNBOUND/DRIFT line is either understood or handed to the owner as a vocabulary item (a Figma variable with no token in src/styles/tokens.css).
  3. Codegen or hand-apply. node scripts/figma-codegen.mjs <snapshot> writes token-only CSS classes and a role to class map under concepts/figma/export/generated/. It is a helper: copy the values into the real component styles, in src/styles/components/, reusing existing classes ($sushiai-ui). It never becomes a runtime dependency. Done when: the component CSS spends tokens only and no fx- class ships.
  4. Parity. Build (npm run build), copy the ui-evidence driver, and add the three lines from .agents/skills/ui-evidence/scripts/measure.mjs (or run the template with --measure) to write artifacts/<name>.measure.json. Then node scripts/figma-parity.mjs <snapshot> artifacts/<name>.measure.json. Tolerances: 2px position, 3% text width, exact font size, weight and colour token. Text is the anchor; an unmatched Figma text is a FAIL, an extra app text is listed only. Done when: the exit code is 0, or every FAIL is fixed in the code or recorded as a decision for the owner (Figma wrong vs app wrong).
  5. Look. Screenshot the screen and give it with the parity table to design-critic. Numbers do not replace looking.

Rules

  • The fix goes into the app code or the Figma file, never into the tolerance.
  • A Figma colour with no token is a question for the owner: add the token to src/styles/tokens.css for everyone, or change the design.
  • Positions come from auto-layout; a layer inside a frame without auto-layout has no position in the dump and is marked approx. Do not trust its x/y.
  • Extract only through the Desktop Bridge tools (figma_get_component_for_development_deep, figma_take_screenshot). figma_get_file_data is a REST tool and fails without a FIGMA_ACCESS_TOKEN; that is not a bridge failure. A dump too big for the reply is saved to a file: copy it from the tool-result path into concepts/figma/export/raw/.
  • A dialog or overlay frame needs its own root: find the layer name (for example dialog) in the dump and pass --root <name>, or the exporter picks the page behind it.

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.