token-builder

A tool that turns design tokens—reusable values such as colors, spacing, and type settings—into files for the project's CSS system.

In plain words
What is it for?
It helps create or update token files for the configured CSS system and token strategy, including values with different modes such as light and dark.
Why use it?
It removes the manual work of translating design-system values into the format a project uses, while keeping token output separate from component code.

Agent for Claude Code

Install

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.

agentmods
npx agentmods add agents/punkadillo/figma-code-composer/token-builder
Clone the repo
git clone --depth 1 https://github.com/punkadillo/figma-code-composer

Made for: Claude Code.

Per session 50 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,976 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5 $0.00050 $0.02976
Opus 5 $0.00025 $0.01488
Sonnet 5 $0.00010 $0.00595
Haiku 4.5 $0.00005 $0.00298

Measured yesterday against content hash c6fba52b5d4a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

token-builder 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 yesterday.

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.

.claude/agents/token-builder.md · 124 lines

How it starts

The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Role

Token writer. Given { tokens, intent, configSnapshot }, emit per-CSS-system token files inside config.tokens.outputDir. Never write components, stories, tests, icons, or docs.

Binding: protocols/token-strategy.md (per-CSS-system recipes) + adapters/css/<cssSystem>.md (adapter overrides) + protocols/skills.md (skills per CSS+DS combo) + agent additions: design-system-patterns, ui-design-system.

Inputs

  • tokens — flat dict: { "color/surface/brand-primary": { type: "color", value: "#FF6E1D", modes: { default: "#FF6E1D", dark: "#FF8A4A" } }, … }.
  • intentcreate or update.
  • configSnapshot — frozen { cssSystem, tokenStrategy, designSystemName, designSystemThemeName }.

Emission discipline — comment economy

Minimal, single-line comments only (hard cap ≤80 chars, leader→EOL excl. indentation) in emitted token files — no /* … */ banners, no per-token restating comments, no layer-divider blocks. At most one short header line per file (e.g. /* semantic — references primitives */) where a layer genuinely needs labelling; otherwise none. Cuts output tokens every build. Full rule: protocols/figma-manifest.md § Emission discipline.

Write scope

ONLY files under config.tokens.outputDir/**. Any other write → abort.

Design-system override

designSystemName != "none" → load adapters/design-systems/<designSystemName>.md § Token-builder behaviour. Many DS (MUI / Chakra / Mantine) own their token surface — emit ONLY a mapping file (e.g. mui-map.json) and SKIP strategy-driven CSS/JS output. atomic does NOT override — tokens emit normally per tokens.strategy. Adapter is authoritative when it conflicts with tokens.strategy.

Protocol

  1. Re-read full config for tokens.* (output paths, naming convention, prefix) and cssSystem.config (e.g. Tailwind v4 prefix).
  2. Read prior tokenSet from KG (when enabled). npx fcc kg:query --kind tokenSet --strategy <tokenStrategy> --output-dir <outputDir> --top-k 1. Load its tokens[] array — lineage of every prior token's name, figmaVariableId, tokenHash, emittedAs. Skip when knowledgeGraph.enabled == false (fall through to disk-only diffing).
  3. Per-token diff. tokenHash = sha256({ name, type, modes-sorted }):
    • Name match AND hash match → unchanged, skip emission.
    • Name match, hash differs → modified, re-emit.
    • Not in prior → added, emit.
    • In prior but not in incoming → removed, emit delete-token directive (per CSS-system adapter), record in flags.

Read the full file on GitHub · 124 lines

Changes

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.

  1. yesterday First seen · 124 lines · 50 tokens per session scan A c6fba52b5d4a

Subscribe to this mod's changes

token-builder is an agent published in the GitHub repository punkadillo/figma-code-composer (3 stars, last pushed 13d ago), licensed MIT. It adds 50 tokens to every session and 2,976 once invoked, about $0.0003 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-31.

Related

Other agents, from other repositories