Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/awdr74100/figwright/figma-codegennpx skills add awdr74100/figwright --skill figma-codegengit clone --depth 1 https://github.com/awdr74100/figwrightWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00145 | $0.03652 |
| Opus 5 | $0.00072 | $0.01826 |
| Sonnet 5 | $0.00029 | $0.00730 |
| Haiku 4.5 | $0.00015 | $0.00365 |
Grade A, and why
figma-codegen scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.
figma-codegen
Turn a Figma selection into code that looks like the rest of the project: reuse the components and
tokens that already exist, only build what's genuinely missing. The grounded tools do the heavy
lifting so you are not guessing from a screenshot. This file is the router; deep detail lives in
references/ — load a reference when its step is in play.
When to use
- The user pastes a Figma URL/selection and asks for code ("code this", "build this component").
- The user wants to extend an existing component to match a Figma frame.
Workflow
Run the grounded tools against the selection, then generate — trust them over the rendered image.
-
get_design_context(detailfull,dedupeComponents: true) → the structural tree with tokens resolved to names (Primary/500,spacing/4), styles deduped intoglobalVars, and each instance'smainComponent/componentProperties. This is the layout + binding source of truth. KeepdedupeComponents: trueand don't depth-limit a subtree you'll build from. → How to read the tree, the per-node fidelity catalog (effects, per-side borders, stroke align, per-corner radius, blend, masks, gradients, image-fit, auto-layout/grid, aspect-ratio, scroll/sticky, stack & stroke-space), Dev Mode annotations as ground truth, and grounding a page too big for one call:references/grounding.md. -
component_map→ every Figma component grouped to a local code component with astatus(high / medium / low / unmapped),candidate.filePath, andmatchedProps.high/medium: reuse that component (import fromcandidate.filePath), don't regenerate. Never invent a component namecomponent_mapdidn't report.candidate.ambiguousWith(a capped list of{ name, filePath }): the Figma name matched two or more code components nearly equally and the join couldn't confidently pick — a verify-me pick, not a confident reuse (the analogue oftoken_map'sambiguousWith). Check which of the winningcandidate+ these runner-ups is the right component for this context before importing (a wrong reuse is a silent visual bug), then record the confirmed one in the map file so the next run is certain. Absent when the pick was unambiguous.- Wire each entry's
instances[].props(resolved variant / boolean / text values) onto the reused component — one element per instance, with its own props. candidate.unmatchedProps: Figma axes the component has no prop for (a leading icon, arequiredflag, an active state) → surface as component-extension TODOs, never fake them with ad-hoc markup.unmapped: build it new in the project's style. For a repeated unmapped component (instanceCount > 1), build from its first instance's subtree; if that came backdeduped/truncated, drillget_design_contextoninstances[0].nodeIdonce — don't rebuild a repeated component by eye.- When you're emitting a component's own definition (its prop types, not just rendering it),
get_component_apion the component/instance returns the full property API — every VARIANT option and each BOOLEAN/TEXT/INSTANCE_SWAP prop with its default — so the prop space is grounded, not inferred from the instances you happened to see.
What ships with it
6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 194 lines · 145 tokens per session scan A b1acd5cb8e96
figma-codegen is a skill published in the GitHub repository awdr74100/figwright (633 stars, last pushed 3d ago), licensed MIT. It adds 145 tokens to every session and 3,652 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
favicon-exporter
Prepare and export favicon assets from Figma in common web sizes and formats.
component-builder
Build reusable Figma components and variants with consistent auto layout and properties.
icon-exporter
Export consistent icon assets from Figma with useful names and formats.
padding-maker
Normalize spacing and padding in Figma layouts using auto layout where appropriate.
accessibility
Audit and improve Figma designs for accessible contrast, typography, touch targets, and structure.
design-tokens
Create and maintain coherent Figma variables and design-token systems.