understand-figma
Skill1 starsChanged 6 days agoMITView on GitHub
Map a Figma file into a design knowledge graph (pages, screens, components, component sets, variants, instances, design tokens, page layers and a tour) for the claude-dashboard Understand page, reading the file through the connected Figma connector. Use when the user types /understand-figma, or asks to map, analyze or understand a Figma file or design as a graph on the Understand page.
- Deletes or force-pushes
In this repository9 other files it gives its agents.
- godeyeSkill
- understand-chatSkill
- understand-dashboardSkill
- understand-diffSkill
- understand-domainSkill
- understand-explainSkill
- understand-knowledgeSkill
- understand-onboardSkill
- understandSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 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.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
If it does not print pipeline ok, tell the user the Understand pipeline is missing from claude-dashboard …
- Very specific: line 37
Call create_session with fileKey: $FILE_KEY and description: "Read-only: map this Figma file's pages, screens, components and design tokens …
- Very specific: line 38
Call get_metadata with fileKey and sessionId only (no nodeId): it lists the file's top-level pages (id + name).
- Very specific: line 44
If it fails, relay its stderr and STOP.
- Very specific: line 45
Start from a clean intermediate folder (the previous scan-manifest.json stays):
- Very specific: line 51
If --language was given, normalize it like /understand does (chinese → zh, japanese → ja, french → fr, arabic → ar, locale variants such as …
- Very specific: line 61
Write the page list from Phase 0 step 4 as $DATA/intermediate/figma/pages.json, every page in file order: [{"id": "0:1", "name": "Cover"}, …
- Distinctive: line 63
Run the first scan:
- Distinctive: line 67
If it exits non-zero, relay stderr and STOP.
- Distinctive: line 87
Run up to 5 batches concurrently (several Agent calls in one message).
- Very specific: line 107
Make sure claude-dashboard runs and give the link:
- Very specific: line 111
If it says the dashboard is not running, start it with the Bash tool's run_in_background: true (the command waits for the dashboard's …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
/understand-figma
Analyzes a Figma file and produces an interactive design knowledge graph (kind: "design") for the Understand page of claude-dashboard (http://127.0.0.1:3737/understand).
The design map is its own project: every file goes to its data folder $DATA (~/.claude/understand/figma-<file name>/, resolved in Phase 0), never into a code project's folder or any repo. The scripts live in {{CLAUDE_DASHBOARD}}/src/understand/scripts/; the agent prompt is ~/.claude/skills/understand/agents/design-analyzer.md. Adapted from Understand Anything's /understand-figma skill (MIT, see {{CLAUDE_DASHBOARD}}/src/understand/LICENSE-understand-anything).
Prerequisites
- The user's Figma connector (tools named
mcp__claude_ai_Figma__*). Load the ones this skill uses with ToolSearch queryselect:mcp__claude_ai_Figma__create_session,mcp__claude_ai_Figma__get_metadata,mcp__claude_ai_Figma__get_variable_defs,mcp__claude_ai_Figma__get_screenshot,mcp__claude_ai_Figma__whoami. If they do not exist, STOP and tell the user:Connect Figma first (claude.ai Settings, Connectors, Figma), then re-run /understand-figma.
- There is no Figma token: nothing is read from the environment and no credential is written anywhere.
- This skill only reads. Never call
use_figmaor any other Figma tool that creates or changes something.
Network: unlike
/understand, this skill reads the file from Figma through the connector and downloads screen thumbnails from the short-lived image links the connector returns. Tell the user this once.
Phase 0: Pre-flight
- Parse
$ARGUMENTSfor a Figma URL or bare file key (the non-flag token) and an optional--language <lang>.figma.com/design/<fileKey>/<fileName>...orfigma.com/file/<fileKey>/<fileName>...:$FILE_KEY=<fileKey>.figma.com/design/<fileKey>/branch/<branchKey>/<fileName>:$FILE_KEY=<branchKey>.figma.com/board/,/slides/or/make/links: STOP and say only Figma design files (figma.com/design/...) can be mapped.- A bare key:
$FILE_KEY= the key. $FILE_NAME= the URL's<fileName>segment, URL-decoded, dashes turned into spaces (Shop-AppgivesShop App). With a bare key, use the document name if the page list in step 4 shows one, otherwise the key.
- Check the pipeline:
If it does not printtest -f {{CLAUDE_DASHBOARD}}/src/understand/scripts/figma-scan.mjs \ && test -d {{CLAUDE_DASHBOARD}}/node_modules/zod \ && echo "pipeline ok"pipeline ok, tell the user the Understand pipeline is missing from claude-dashboard ({{CLAUDE_DASHBOARD}}/src/understand/) or its packages are not installed (runnpm installthere), and STOP. - Call
create_sessionwithfileKey: $FILE_KEYanddescription: "Read-only: map this Figma file's pages, screens, components and design tokens into a design knowledge graph shown on a local dashboard.". Keep the returned UUID as$SESSION_IDand passsessionId: $SESSION_IDon every Figma call below. - Call
get_metadatawithfileKeyandsessionIdonly (nonodeId): it lists the file's top-level pages (id + name). If a Figma call fails with an access, permission or rate-limit error, callwhoami, tell the user what it shows, and STOP. - Resolve the data folder
$DATA(the same folder for the same file key on every run, even after a rename):
If it fails, relay its stderr and STOP. Setnode {{CLAUDE_DASHBOARD}}/src/understand/scripts/data-dir.mjs --figma "$FILE_KEY" "$FILE_NAME" \ | node -e 'const j=JSON.parse(require("fs").readFileSync(0,"utf8"));console.log("DATA="+j.dataDir);console.log("KEY="+j.key)'$DATAand$KEY(used for the dashboard link) to the printed values and carry them forward: each command block may run in a fresh shell. - Start from a clean intermediate folder (the previous
scan-manifest.jsonstays):mkdir -p "$DATA/intermediate" find "$DATA/intermediate" -mindepth 1 -maxdepth 1 -not -name 'scan-manifest.json' -exec rm -rf {} + mkdir -p "$DATA/intermediate/figma" - If
--languagewas given, normalize it like/understanddoes (chinese→zh,japanese→ja,french→fr,arabic→ar, locale variants such aszh-TWkept as they are) and store$LANGUAGE_DIRECTIVE:
Without> **Language directive**: Generate all textual content (summaries, descriptions, tags, titles, languageNotes, languageLesson) in **{language}**. Maintain technical accuracy while using natural, native-level phrasing in the target language. Keep technical terms in English when no standard translation exists (e.g., "middleware", "hook", "barrel").--languagethere is no directive.
Phase 1: FETCH & PARSE (connector, then deterministic)
The connector's answers are saved as files in $DATA/intermediate/figma/, and figma-scan.mjs turns them into the same scan-manifest.json that Understand Anything's REST scan produced. Save raw tool text with the Write tool. When Claude Code saved a large tool result to a file instead of showing it, copy that file with cp (the scan reads plain text and saved JSON tool results alike).
- Write the page list from Phase 0 step 4 as
$DATA/intermediate/figma/pages.json, every page in file order:[{"id": "0:1", "name": "Cover"}, {"id": "12:3", "name": "App"}]. - For every page, call
get_metadatawithfileKey,nodeId: <page id>andsessionId(several pages per message), and save the XML exactly as returned to$DATA/intermediate/figma/page-<page id with : replaced by ->.xml(page12:3goes topage-12-3.xml). Leave out a leading "Currently selected nodes:" block if the tool adds one. Run the first scan:
node {{CLAUDE_DASHBOARD}}/src/understand/scripts/figma-scan.mjs "$DATA" "$FILE_KEY"If it exits non-zero, relay stderr and STOP.
If the scan prints
UP_TO_DATE, report "Design graph is already up to date for this Figma file version", print the dashboard link (Phase 4 step 3), and STOP. The connector gives no file version, so the scan compares a hash of the parsed structure (pages, screens, components, sets and instances, with their names and sizes): edits that only change colors, tokens or pixels do not count. To force a full rebuild, re-run withUNDERSTAND_FIGMA_FORCE=1set in the environment.Otherwise it wrote
$DATA/intermediate/figma/targets.json:variableDefs(node ids) andscreenshots({nodeId, file}pairs).- Design tokens. For each id in
variableDefs, callget_variable_defswithfileKey,nodeIdandsessionId(about 10 per message). Write all answers as one JSON file$DATA/intermediate/figma/vars.json:{"<nodeId>": {"<variable or style name>": "<value>"}}. The tool answers in a loose{'name': value}form: turn it into real JSON, keep every value's text as it is (#949494,16,Font(family: "Inter", ...),Effect(...)), and give a node with no variables{}. Skip a node whose call fails. - Screen thumbnails. Work through
screenshotsin groups of about 10: callget_screenshotwithfileKey,nodeId,maxDimension: 640andsessionIdfor the whole group in one message, then download that group in one Bash command right away (the links expire), each PNG straight to its entry'sfile($DATA/thumbnails/<safe-id>.png): use the download command the tool gives, orcurl -sSfL --max-time 60 -o "<file>" "<url>". Never setenableBase64Responseand never save images anywhere else. Skip failures: thumbnails are optional. - Run the same scan command again. It now adds the tokens (
uses_tokenedges) and the thumbnails (a download that is not a PNG is deleted; each kept screen getsfigmaMeta.thumbnailUrlpointing at the dashboard's thumbnail route), rewritesscan-manifest.json, and writes$DATA/intermediate/design-batches.json. Relay the printed counts to the user.
Phase 2: ANALYZE (LLM enrichment)
design-batches.jsonholds the batches (about 15 nodes each, grouped by page, with each node's child names and token usage) and the full list of node ids. The scan printed the batch countT.- For each batch
N(1 toT), dispatch a subagent: the Agent tool withsubagent_type: "general-purpose",description: "understand-figma: design-analyzer N/T"and the prompt below, with real paths and numbers written in. Never read or paste the agent file yourself, and pass nomodel.
followed byRead ~/.claude/skills/understand/agents/design-analyzer.md completely and follow it as your instructions. The values below fill its $DATA, $BATCH_NUM and $INTERMEDIATE_DIR. $DATA = <DATA> $BATCH_NUM = <N> $INTERMEDIATE_DIR = <DATA>/intermediate$LANGUAGE_DIRECTIVEif--languagewas provided. The agent writesanalysis-batch-<N>.json. - Run up to 5 batches concurrently (several Agent calls in one message). If a batch fails, log a warning and continue: the manifest is a solid base.
Phase 3: MERGE
node {{CLAUDE_DASHBOARD}}/src/understand/scripts/figma-merge.mjs "$DATA"It combines scan-manifest.json + analysis-batch-*.json, runs mergeDesignGraph (validates, re-attaches kind: "design", builds one layer per page plus a Design System layer, and the tour), and writes $DATA/knowledge-graph.json + $DATA/meta.json. Relay the printed stats and any non-auto-corrected issues. If it exits non-zero, relay stderr and STOP.
Phase 4: SAVE & LAUNCH
- Clean up intermediate files except
scan-manifest.json:find "$DATA/intermediate" -mindepth 1 -maxdepth 1 -not -name 'scan-manifest.json' -exec rm -rf {} + - Report a summary: project name, counts by node type, edges by type, layers, tour steps, thumbnails saved, and the path
$DATA/knowledge-graph.json. This prints them without loading the graph into the conversation:node -e 'const g=require(process.argv[1]);const c=a=>a.reduce((m,x)=>(m[x.type]=(m[x.type]||0)+1,m),{});console.log(JSON.stringify({project:g.project.name,nodes:c(g.nodes),edges:c(g.edges),layers:g.layers.map(l=>l.name),tourSteps:g.tour.length,thumbnails:g.nodes.filter(n=>n.figmaMeta&&n.figmaMeta.thumbnailUrl).length},null,1))' "$DATA/knowledge-graph.json" - Make sure claude-dashboard runs and give the link:
If it says the dashboard is not running, start it with the Bash tool'snode {{CLAUDE_DASHBOARD}}/bin/claude-dashboard.js statusrun_in_background: true(the command waits for the dashboard's transcript scan, while the server itself runs detached):
Then runnode {{CLAUDE_DASHBOARD}}/bin/claude-dashboard.js start --no-openstatusagain until it reportsRunning at ...(give up after about 20 seconds). Printhttp://127.0.0.1:3737/understand?project=$KEY. Ifstatusreports another port (3737 was taken), use that port in the link. If the dashboard does not come up, say so, give the log pathstatusorstartprinted, and still print the link.
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.

