Developer tooling · 2026
Figma Agent Context
Shorten the distance between design and code.
I built Figma Agent Context to make design handoffs more explicit for coding agents. A screenshot shows the intended appearance, but leaves measurements, asset boundaries and layout relationships open to interpretation. The plugin exports those details as versioned JSON, alongside downloadable artwork and a reference render.
I used the output with AI coding agents to implement nearly all of Pebbler Telegram’s HolyWheel screen, its bundle offer dialogs, and most of its career page. The tool grew out of that implementation work: making the decisions behind a design easier to carry into React and SCSS.
The tool in use
The TypeScript plugin reads the selected Figma subtree, extracts its geometry and styles, then builds a semantic record for React, TSX and co-located SCSS. It resolves actual variable bindings and referenced styles, and keeps implementation warnings alongside the output. The default contract is the bridge.figma-react-scss-context schema, version 3: implementation context for an agent to interpret.
For this HolyWheel frame, I marked artwork with [asset] layer names so it could be downloaded separately. The resulting export contains 48 context nodes, with 33 assets ready for download and 14 asset subtrees omitted. The panel shows 193 KB and roughly 49,000 estimated tokens. Hidden layers and asset/vector internals are still enabled here, but explicitly marked asset descendants remain excluded from the JSON.
Extraction runs locally in Figma; the plugin’s manifest blocks network access, and I choose when to copy the context into an agent conversation. The default handoff also omits unmarked asset/vector internals and hidden layers to keep the record focused on implementation.
Turning geometry into implementation context
Figma’s layer hierarchy does not always map directly to the DOM. A group may exist only to organise artwork, while React needs a different component structure. Each measurable node therefore retains both parent-local coordinates in box.local and flattened coordinates in box.selection, relative to the selected frame. If a parent group disappears during implementation, the agent can use selection-space positions without mixing measurements from different coordinate systems.
Authored scale is explicit too. With a confirmed @4x design, 80 Figma units become 20 CSS pixels. The exporter preserves the unrounded source values and adds derived cssBaseline measurements for geometry, spacing, typography, strokes and effects. An unknown scale remains a question to resolve rather than silently assuming one Figma unit equals one CSS pixel.
Authored Auto Layout is kept distinct from inferred layoutHints. Conservative geometry checks can suggest flex alignment, padding or gap when text sits inside a visual container; overlapping artwork can remain positioned separately. These hints carry confidence and provenance. They guide implementation, while responsive behaviour beyond the reference viewport still requires judgment.
{
"box": {
"local": {
"x": 80,
"y": 40,
"width": 320,
"height": 160,
"relativeTo": "PARENT_AXIS_ALIGNED_BOUNDS"
}
},
"cssBaseline": {
"unit": "CSS_PX_AT_TARGET_VIEWPORT",
"derived": true,
"box": {
"local": {
"x": 20,
"y": 10,
"width": 80,
"height": 40
}
}
}
}Illustrative node excerpt with a user-confirmed @4x authored scale. Every source length is divided by four for the CSS baseline; other node fields are omitted here.
Keeping artwork separate—and checking the result
Explicit layer names such as [asset] coin.svg and [asset] portrait@2x.png define downloadable asset boundaries. The semantic tree keeps the asset’s geometry and filename, while its vector descendants stay out of the context. Repeated filenames produce one logical export with multiple usages; the PNG scale suffix controls export density without changing the display size.
Ready assets are authoritative: the context tells the agent to import the exact downloaded file and report a missing asset instead of approximating it. This keeps detailed game artwork out of generated CSS and makes the handoff easier to inspect.
The Assets panel makes that boundary visible. In this frame, Download ready collects 33 marked assets, while individual files such as wheel-middle.svg can be previewed and downloaded separately. The artwork is never embedded in the agent-context JSON; the agent receives the files alongside their geometry and filename references.
A separate reference PNG closes the loop. I give the agent structured context, the exported assets and a visual target, then compare the rendered implementation at the intended CSS viewport. Compilation and linting cannot establish visual fidelity. The plugin supplies the reference image; it does not perform an automatic pixel diff or infer every responsive state.
Used in production work
HolyWheel and the bundle dialogs provide concrete examples of the design-to-code workflow in the Pebbler application.




