LLM Export — Figma plugin
Extracts the current selection from a Figma file into an LLM-ready
payload: compact node JSON (geometry, text, fills, strokes, auto-layout,
component props, variables inlined on each value) plus a rendered image
of each element — PNG, or SVG markup for vectors/icons. Pick which crops and
which variable collections to include, then copy the payload or download the
bundle and feed it to any agent. Wiring a direct "send to agent" call is one
handler away (see Sending to an LLM).
Why — stop pasting screenshots and guessing. An agent doing design-to-code,
design QA, or component work gets the real structure: exact sizes, the design
token behind each value (not just the resolved number), the styled text
runs, the effects, and the cropped visuals — all in one JSON it can actually
reason over.
Payload shape
{
"source": "figma",
"exportedAt": "2026-06-24T…Z",
"file": "My File",
"page": "Page 1",
"selectionCount": 2,
"nodes": [ { "id", "name", "type", "width", "height", "characters", "fills", "strokes",
"effects", "layout", "layoutSizing", "constraints", "cornerRadius",
"lineHeight", "letterSpacing", "textCase", "mainComponent", … } ],
"images": [ { "id", "name", "type", "mimeType": "image/png", "scale": 2, "base64": "iVBORw0K…" } ]
}
Per-element crops
Each meaningful element gets its own image cropped to its bounds (the tree
is walked recursively), so an agent can look at pieces, not just the whole frame.
Tick Icons → SVG in the toolbar to export vectors and icon-sized elements
(longer edge ≤ 64px) as SVG markup instead of PNG — an agent reads <path>
data far better than a blurry raster. PNG crops carry base64; SVG crops carry
the raw markup string. The toggle is persisted across reloads.
To avoid a flood of useless slivers, child elements are skipped when they
are text/vectors or smaller than a threshold — the layers you explicitly select
are always exported regardless. Tunable at the top of src/code.ts:
| const | default | meaning |
|---|
MIN_EXPORT_DIM | 24 | default min crop size — editable live in the UI (Min crop size field), persisted across reloads via clientStorage |
SKIP_EXPORT_TYPES | TEXT, VECTOR, LINE, SLICE | types never cropped standalone |
NO_RECURSE_EXPORT | INSTANCE | treated as one atomic block, no crops of internals |
MAX_EXPORTS | 80 | hard cap per run (meta.truncated flags when hit) |
PNG_SCALE | 2 | export resolution |
The Min crop size field in the plugin re-exports on change and remembers
your value. Elements smaller than it (either dimension) are skipped — except
the layers you explicitly selected, which always export.
The images[].base64 is drop-in for Anthropic's multimodal content blocks
({"type":"image","source":{"type":"base64","media_type":"image/png","data": …}}).
Bound variables (inlined)
Variable bindings are inlined on the value itself. An unbound property is a
plain value; a bound one becomes { value, variable: "Collection/name" }. This
covers radii (incl. per-corner), colors (fills/strokes), stroke weights,
padding, item spacing, opacity, size, and fontSize:
"cornerRadius": {
"topLeft": { "value": 12, "variable": "Theme/radius/card-radius" },
"topRight": { "value": 12, "variable": "Theme/radius/card-radius" },
"bottomRight": 0,
"bottomLeft": 0
},
"fills": [ { "type": "SOLID", "visible": true,
"color": { "value": "#181818", "variable": "Theme/card-background" } } ]
Variables export
Every variable the selection references (following alias chains, so it's
self-contained) is also dumped under variables, with its type, collection,
and per-mode values (colors as hex, aliases as { alias: "Collection/name" }):
"variables": [
{ "id": "VariableID:…", "name": "radius/card-radius", "type": "FLOAT",
"collection": "Theme", "valuesByMode": { "Dark": 12, "Light": 12 } },
{ "id": "VariableID:…", "name": "card-background", "type": "COLOR",
"collection": "Theme", "valuesByMode": { "Dark": "#181818", "Light": "#ffffff" } }
]
Only referenced variables are exported by default.
Full collection dump (pick collections)