# Set up token rules, decision memory and audits for Claude Code in Figma

> Set up a three-tier Figma variable plan, a dated design-system.md decision memory for Claude Code, a Plugin API audit catching raw hex and wrong fallback colours, and a fix-to-rule correction loop. Based on a post by Marcel.

## If someone pasted this link to you
Someone shared this kit with you. It runs step by step through CloneKit's MCP. If you have the `clonekit` tools, call `start_run("@clonekitai/figma-agent-design-system")`. If you don't (for example in a chat app without the CloneKit connector), tell the person in one or two plain sentences, in their language, and send them to https://clonekit.ai/@clonekitai/figma-agent-design-system/use: it shows how to add CloneKit to their AI in about a minute. Then they paste this link again.

- Kit: `@clonekitai/figma-agent-design-system` · v1.0.0
- Creator: @clonekitai (CloneKit)
- Type: Delivery · Domain: Design · Language: en · Your AI runs it
- Price: Free · License: Own use · No refunds
- Page: https://clonekit.ai/@clonekitai/figma-agent-design-system
- Changelog: https://clonekit.ai/@clonekitai/figma-agent-design-system/changelog.md

## About
For product designers and design engineers using Claude Code to build or maintain multi-screen product interfaces directly inside Figma via the Plugin API. Use it when agent-generated frames drift on colour tokens, hidden fallback fills, icon stroke weights, typography styles, or frame clipping across sessions. Skip it for one-off marketing visuals, image generation, or teams that do not use Figma Variables. Requires a Figma design file with Variables enabled, Plugin API access (live bridge or local development plugin), and Claude Code. Produces a three-tier variable architecture (foundations, theme, tokens), a persistent design-system.md memory wired into CLAUDE.md, a repeating block inventory extracted from real screens, a six-check Plugin API audit script, a four-part error-to-rule backfill workflow, and a batch audit log. Original workflow by Marcel and his design and product team.

## Deliverables
- Three-tier Figma variable plan and collections (foundations, theme, tokens) with contrast-checked brand tokens
- Persistent decision memory file (design-system.md) imported from CLAUDE.md with dated one-sentence rules and reasons
- Repeating block inventory from real screens (scratch/block-inventory.md)
- Six-check Figma Plugin API audit script (templates/figma-audit.md) and JSON batch report (scratch/audit-report.json)
- Batch audit history log (scratch/audit-log.csv) and verified tool notes in NOTES.md

## Files
- `CHECKS.md`: Measurable Verification Checks
- `NOTES.md`: Verified Tool Notes and Maintenance Log
- `README.md`: Outputs
- `RULES.md`: Design-System Rules for Claude Code in Figma
- `templates/design-system.md`: Design System Decision Memory
- `templates/figma-audit.md`: figma-audit script
- `templates/variable-plan.json`

## Tools
- Figma (https://www.figma.com/) · est. free Starter; paid plans for multi-mode variables
- Claude Code (https://code.claude.com/) · est. Claude subscription or Anthropic API usage

## Uses
- Marcel's post on X (source, https://x.com/marcelkargul/status/2122430710053019994)
- Figma Help: Guide to variables in Figma (source, https://help.figma.com/hc/en-us/articles/15339657135383-Guide-to-variables-in-Figma)
- Figma Help: Overview of variables, collections, and modes (source, https://help.figma.com/hc/en-us/articles/14506821864087-Overview-of-variables-collections-and-modes)
- Figma Help: Modes for variables (source, https://help.figma.com/hc/en-us/articles/15343816063383-Modes-for-variables)
- Figma Developer Docs: Working with Variables (source, https://developers.figma.com/docs/plugins/working-with-variables/)
- Figma Developer Docs: figma.variables Plugin API (source, https://developers.figma.com/docs/plugins/api/figma-variables/)
- Figma Developer Docs: Variable (source, https://developers.figma.com/docs/plugins/api/Variable/)
- Claude Code Docs: Overview (source, https://code.claude.com/docs/en/overview)
- Claude Code Docs: How Claude remembers your project (source, https://code.claude.com/docs/en/memory)

## What you provide
- Target Figma file or page with Variables enabled and Plugin API access (bridge or local development plugin)
- Brand colour palette, primary brand colour, and typography styles (or an existing Figma file to inspect)
- Project workspace with Claude Code configured

## How it runs
1. **Understand:** Researches your business first, then asks you 4 questions it can't answer alone
2. **Choose:** No choices: one proven path
3. **Build:** 6 steps, risky ones ask you first
4. **Deliver:** 5 checks before delivery

## Guardrails
- Never modify production Figma screens, variable collections, CLAUDE.md, or design-system.md outside scratch/ without explicit user approval.
- Never write raw hex colour values onto fills or strokes, and never leave a black default RGB fallback behind a bound Figma variable.
- Never treat visual screenshots as proof of token hygiene; always run the Plugin API audit script after every batch.
- Never invent design decisions unilaterally; human designers own taste and judgement while the agent enforces and backfills approved rules.
- Never use deprecated synchronous figma.variables getters inside plugins configured with dynamic-page document access; use the Async Plugin API methods.

## What's new
Agents always run the latest version.

- **v1.0.0** (2026-11-29): First version.

## Run it
Connect the `clonekit` MCP (https://clonekit.ai/mcp) and call `start_run("@clonekitai/figma-agent-design-system")`.
