Sync figma token

From lightspeedwp/.github · View interactive version

Sync figma token is an AI agent skill from the GitHub repository lightspeedwp/.github. Sync design tokens between code and Figma variables with strict drift reporting, mandatory approval gate, safe delta apply, and persisted reports.

How to use this skill

Skill file

sync-figma-token

Use this skill for token parity workflows (code tokens vs Figma variables).

MANDATORY prerequisite: load figma-use before every use_figma call.

Non-negotiable safety rule

After producing dry-run output, you MUST STOP and ask for approval.

Standard source formats (required)

Prefer real token sources in this order:

  1. Design Tokens JSON (tokens.json, tokens/*.json, DTCG-style)
  2. Style Dictionary input JSON
  3. Platform theme sources (Compose/Kotlin/TS) only when JSON source is unavailable

If source format is non-standard, explicitly state assumptions in dry-run output.

Required policies before writes

Never delete by default. Deletion requires explicit user instruction.

Normalization rules

Normalize both sides to canonical rows:

Name normalization examples:

Value validation (required)

Dry-run must validate values, not only presence/type.

Drift categories

Each drift item must include one of:

Dry-run output format

Always return:

1) Headline summary:

{
  "create": 0,
  "update": 0,
  "aliasFix": 0,
  "scopeFix": 0,
  "syntaxFix": 0,
  "archive": 0,
  "delete": 0
}

1) Detailed drift list with token keys and before/after values.

Then ask:

Dry-run complete. Apply these changes? (yes/no)

Report persistence (required)

Persist report JSON every run:

If file persistence fails, mention that explicitly in output.

Conflict handling

When conflicting data is found (type/mode/alias ambiguity):

Apply order

Apply deltas in this order:

  1. Ensure collections/modes
  2. Create missing primitives
  3. Create/update semantic aliases
  4. Apply value updates
  5. Apply scopes and code syntax
  6. Archive stale tokens per deletePolicy

Never parallelize write use_figma calls.

Success condition

After apply, run a fresh diff.

Success = unresolved drift is zero, or only explicitly approved exceptions remain.

Have questions? Ping us on GitHub! 🐙 Made with 💚 by LightSpeedWP

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.