code-to-figma
Skill5 starsChanged 46 days agoMITView on GitHub
Sync code tokens and page structure to Figma via a CI + Gist pipeline. Use when asked to \"set up a Figma sync pipeline\", \"sync code to Figma\", \"export design tokens to Figma\", \"update the page walker\", or \"wire up the tokens-sync-to-figma plugin\"; when paths include `figma-sync.config.json`, `figma-export.json`, `scripts/tokens-to-figma/`, or `.github/workflows/figma-sync.yml`; or when checking figma-sync Gist or CI status. Not for agent-driven, one-off Figma writes such as creating variables or editing nodes (use `figma-use`) or generating screens (use `figma-generate-design`).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Mesteriis/Engineering-Bible-AItheir own version, first seen Jun 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Mesteriis/Engineering-Bible-AI★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-memorySkill
- discord-harvestSkill
- eleventy-nunjucksSkill
- figma-to-codeSkill
- init-rulebookSkill
- localhost-screenshotsSkill
- skill-architectSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Read in this order before generating anything:
- Distinctive: line 47
Ask one focused question if two genuinely different walker shapes are possible (e.g.
- Very specific: line 61
Keep the core boundary visible: CI produces figma-export.json and checks the committed <project>-tokens.w3c.json.
- Very specific: line 75
Delete figma-export.tmp.json when done, then report sections and nodes exported, the Gist URL, and the separate Figma verification status.
- Distinctive: line 81
Use this when the framework output, token naming convention, section selectors, or CSS build paths changed enough that the existing walker …
- Very specific: line 84
Update walk-<site>.mjs, convert-to-dtcg.mjs, figma-sync.config.json, and CI paths together so tokenPath(), explicit token types, and file …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code to Figma
Generate a project-specific Figma export pipeline: a walker that reads compiled HTML and CSS, resolves class → token bindings, and pushes a structured JSON artifact to a GitHub Gist that the tokens-sync-to-figma Figma plugin consumes.
The pipeline is intentionally one-directional and CI-anchored. During setup, assess the project once, generate scripts, and wire CI. After that, every push that touches configured token or template paths automatically updates the Gist without a Figma API key. The bundled plugin rebuilds page structure using existing Figma variables; token-value changes require a separate collection update and readback before Figma parity can be claimed.
Commands
| Command | Use when | Outcome |
/code-to-figma setup | First time; no scripts exist yet | Walker + token scripts generated, Gist created, CI wired, config saved |
/code-to-figma sync | Scripts exist; push current state to Gist | figma-export.json built and patched to Gist |
/code-to-figma update | Stack or token naming changed significantly | Scripts regenerated, CI and config updated |
/code-to-figma status | Check pipeline health | Gist age, CI status, script presence, config validity |
For an unqualified setup/sync request, default to /code-to-figma setup when no figma-sync.config.json or walker scripts are found. Preserve explicit read-only status requests: report a missing pipeline rather than creating one.
/code-to-figma setup
1 — Assess the project
Read in this order before generating anything:
- Package manifest —
package.json,pyproject.toml, etc. Identify the framework (Next.js, Eleventy, SolidJS, plain HTML) and package manager. - CSS / token files — find the compiled output, not the source. Common paths:
- Tailwind v4:
out/assets/css/tailwind.cssor equivalent build output - Custom CSS: look for a file with
--token-name: value;custom property declarations - Style Dictionary:
tokens.json,variables.css, or generated output indist/
- Tailwind v4:
- Component CSS — look for a
components.cssorutilities.cssalongside the main CSS file - Built HTML — the compiled output page, not source templates. Common paths:
out/index.html,dist/index.html,_site/index.html. Next.js: a default build emits no single HTML file; requireoutput: 'export'(yieldsout/index.html) before proceeding — see the Next.js note inreferences/walker-patterns.md. If no static HTML artifact can be produced, stop and tell the user rather than guessing a path. - Token naming convention — read the CSS custom property names, extract the prefix-to-group mapping (e.g.
beige-*→palette/beige/,fs-*→typography/scale/) - Section structure — scan the HTML for how sections are delimited:
<section id="...">,[data-section],<article>, header/footer landmarks, etc.
Ask one focused question if two genuinely different walker shapes are possible (e.g. sections identified by ID vs by class). Otherwise infer and state the choice.
2 — Generate and verify the scaffold
Create or update the project-specific walker, DTCG 2025.10 token converter, generic Gist pusher, figma-sync.config.json, package scripts, GitHub Actions workflow, Gist, secrets, first sync, and Figma plugin connection. Load references/setup-scaffold.md for the file specifications and references/ci-and-gist-setup.md for the canonical Gist, secret, CI, and plugin setup commands.
Required local checks before relying on CI:
node scripts/tokens-to-figma/convert-to-dtcg.mjs
git status --short -- scripts/tokens-to-figma/*.w3c.json
node scripts/figma-export/walk-<site>.mjs | jq -e '.sections | type == "array"'Keep the core boundary visible: CI produces figma-export.json and checks the committed <project>-tokens.w3c.json; the tokens-sync-to-figma plugin consumes only figma-export.json. Use the DTCG artifact separately to maintain Figma variables. Do not require a Figma API key in CI.
Setup is complete when the generated scripts run, the Gist contains the validated export, CI is wired, and the user has verified the plugin connection and variable values through collection reconciliation. If Figma access or manual steps are pending, report pipeline setup separately from Figma verification.
/code-to-figma sync
- Confirm
figma-sync.config.jsonexists and the walker path is valid. - Build the current site with the project's build command, regenerate
node scripts/tokens-to-figma/convert-to-dtcg.mjs, and review the.w3c.jsondiff, including changes to existing values and aliases. Then runnode <walker> > figma-export.tmp.json. - Validate:
jq -e '.sections | type == "array"' figma-export.tmp.jsonmust exit 0; stop on failure. - Confirm
GIST_TOKENis already exported from a secret manager per references/ci-and-gist-setup.md; never type the PAT on the command line. - Push:
node scripts/tokens-to-figma/push-to-figma.mjs < figma-export.tmp.json - Reconcile token changes with the Figma collection using the reconciliation procedure. Gist authorization does not authorize writes inside Figma. Report export uploaded and Figma token parity verified/unverified as separate statuses; without authorized Figma access or a manual readback, parity is unverified and the pending deltas are listed.
- Delete
figma-export.tmp.jsonwhen done, then report sections and nodes exported, the Gist URL, and the separate Figma verification status. Claim Figma parity only after collection values and the plugin result are verified.
/code-to-figma update
Use this when the framework output, token naming convention, section selectors, or CSS build paths changed enough that the existing walker may be stale.
- Re-run the setup assessment against current compiled HTML/CSS and token files.
- Update
walk-<site>.mjs,convert-to-dtcg.mjs,figma-sync.config.json, and CI paths together sotokenPath(), explicit token types, and file paths stay aligned. - Regenerate the DTCG token artifact:
node scripts/tokens-to-figma/convert-to-dtcg.mjs. - Validate the walker output:
node <walker> > figma-export.tmp.json && jq -e '.sections | type == "array"' figma-export.tmp.json. - Push through
/code-to-figma syncor CI after reviewing the script and.w3c.jsondiffs, then reconcile collection changes and report export and Figma parity separately.
/code-to-figma status
Report:
| Check | How |
| Walker script | Does figma-sync.config.json exist? Does the walker file exist? |
| Gist freshness | gh api gists/<id> --jq '.updated_at' — report how old the Gist is |
| CI wiring | Does figma-sync.yml exist? Does it have workflow_dispatch? |
| Secrets | gh secret list --repo <org>/<repo> — confirm GIST_TOKEN and FIGMA_EXPORT_GIST_ID are present |
| Last run | gh run list --workflow=figma-sync.yml --limit=1 |
| Figma token parity | Compare the current .w3c.json with an available collection readback; report unverified when Figma access/readback is unavailable. Gist freshness alone is insufficient. |
Skill Boundaries
| User intent | Use |
| Export code tokens and page structure → Figma | This skill |
| Import a Figma design → code | figma-to-code skill |
| Agent-driven, one-off Figma write: create or edit variables, collections, nodes, or components in a file during an agent session | Official figma-use skill with the use_figma MCP tool (plus figma-generate-library for reusable variable/token collections) — not this skill |
| Generate a one-off screen or design in Figma from code, HTML, or a live page | Official figma-generate-design skill or Figma MCP write tools (generate_figma_design, html_to_figma, send_code_to_figma) (Figma MCP tools, checked 2026-10-21) — not this skill |
| Sync an existing Gist manually | /code-to-figma sync |
This skill does not edit Figma files. The plugin (tokens-sync-to-figma) is the Figma-side consumer — this skill produces the artifact it reads. The plugin binds to an existing Design Tokens collection; creating that collection once is a prerequisite, and its optional agent path hands off to figma-use (see references/ci-and-gist-setup.md).
Behavioral evals
Authors/reviewers only: use the scenario catalog when explicitly evaluating this skill; skip it during normal task execution. It holds description-only routing prompts and isolated sync/readback fixtures; withhold labels and assertions from the executing agent. The catalog is not evidence of a passing run, and synthetic readbacks do not verify live Figma integration. Converter behavior is fixture-tested by tests/walker-patterns-snippets.test.mjs.
Reference Files
| File | Load when |
| references/walker-patterns.md | Generating or updating the walker, DTCG converter, or generic Gist pusher; adapting tokenPath(), explicit token taxonomy, section detection, or Next.js static-export constraints |
| references/setup-scaffold.md | Generating setup files, package scripts, Gist commands, GitHub secrets, first sync, or plugin-side contract details |
| references/figma-export-contract.md | Validating walker JSON output shape (meta, sections, nodes, token references) |
| references/ci-and-gist-setup.md | Wiring figma-sync.yml, GitHub secrets, first Gist push, or tokens-sync-to-figma plugin setup |
| references/benchmarks.md | Comparing peer skills on skills.sh or positioning this pipeline vs alternatives |
Operating Principles
- Read the compiled output, not the source. Token bindings only become resolvable in built HTML+CSS. Source templates may use variables that haven't been substituted yet.
tokenPath()and explicit$typemappings are the contract. The walker and DTCG converter must use the same path function, and every exported token must have an intentional DTCG type. Never infer$typefrom the raw CSS value; fail on unknown taxonomy or non-conforming values.- Walker is project-specific; pusher is generic. The walker understands the project's HTML shape; the pusher only knows the Gist API. Keep them separate.
- Commit the DTCG JSON. The
.w3c.jsonfile is the human-readable diff surface for token changes. It belongs in the repo, not in.gitignore. nodenotpnpmin CI. pnpm writes a script header to stdout when running a lifecycle script, which corrupts a> file.jsonredirect. Always invoke the walker withnodedirectly in CI steps.
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
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.

