figma-handoff
Figma to code handoff using UDS tokens. Align Figma variables with design-tokens.json, naming conventions, Dev Mode, and token sync.
- License 许可
- MIT
- 最近更新
- 2026-05-21
- Stars
- ★ 5
- Forks
- 1
01 前言 Front Matter
- name
- figma-handoff
- version
- 0.6.0
- triggers
- [ "figma to code", "design handoff", "dev mode", "figma tokens", "design to code", "Figma variables", "Tokens Studio", "design specs", "figma handoff", "design specs for dev" ]
- description
- Figma to code handoff using UDS tokens. Align Figma variables with design-tokens.json, naming conventions, Dev Mode, and token sync.
02 资源文件 1
- 脚本scripts/onboard-client.py9.1 KB
03 SKILL.md 正文
Figma Handoff — UDS Skill
Use this skill when the user needs design-to-code handoff or Figma alignment with the Universal Design System. UDS provides W3C DTCG design tokens, a Figma-compatible token file, and a token writer for custom palettes.
When to Use
- User wants to sync Figma with code (tokens, variables, Dev Mode).
- User is setting up Figma Variables or Tokens Studio to match the codebase.
- User needs naming conventions so developers see token names (e.g.
color.primary) instead of raw hex in Dev Mode. - User wants to keep
tokens/design-tokens.jsonand Figma in sync.
Source of Truth
- Code/tokens:
tokens/design-tokens.json— W3C DTCG format, 3-tier (primitive → semantic → palette overrides). This is the single source of truth for the build. - Figma:
tokens/figma-tokens.json— Figma Tokens Studio compatible. Must stay in sync with design-tokens.json for consistent handoff. - Validation:
scripts/validate-tokens.py— validates DTCG structure and cross-file sync between design tokens and Figma tokens. Run after any token change.
Naming Conventions for Handoff
So developers see token names in Figma Dev Mode (not just raw values):
- Colors: Use semantic names, e.g.
color.primary,color.background,color.text.primary, with modes for Light/Dark. - Spacing: Align with UDS scale:
space.4,space.8,space.16, etc. (4px base). - Typography:
type.heading.lg,type.body.md, etc., matching UDS typography scale. - Radius:
radius.sm,radius.md,radius.lg— per-palette in UDS. - Collections and modes: Use Figma variable collections with modes (e.g. Light/Dark) so Dev Mode shows the right values per theme.
Sync Workflow
- Change tokens in one place: Prefer editing
tokens/design-tokens.json(and running the build) so CSS/JS outputs stay correct. - Update Figma tokens: Use
src/scripts/token_writer.pyto generate Figma token entries for custom palettes; for the core system, ensuretokens/figma-tokens.jsonis updated to match design-tokens.json (structure and values). - Run validation:
npm run validate(orpython scripts/validate-tokens.py) to check DTCG format and cross-file sync. - Build:
npm run buildruns Style Dictionary and produces platform outputs (CSS, JS, iOS, Android) from design-tokens.json.
Figma Dev Mode Tips
- Designers: Use Figma Variables (native) or Tokens Studio; avoid local styles for colors/spacing/typography so Dev Mode can show token names.
- Dev handoff page: Include a short note on naming (e.g. "Colors use semantic tokens; see design-tokens.json"). Link to component docs or Storybook if available.
- Developer notes: Add annotations in Figma pointing to
design-tokens.jsonor the docs so developers know where to read token values and usage.
Token Writer (Custom Palettes)
For custom palettes derived from UDS (e.g. palette.py create "my-palette" --base corporate), the token writer can generate Figma token entries matching tokens/figma-tokens.json format. Use this to keep custom brand tokens in sync with Figma.
Quick Reference
| Asset | Purpose |
|---|---|
tokens/design-tokens.json |
Source of truth; DTCG format; used by Style Dictionary build |
tokens/figma-tokens.json |
Figma Tokens Studio compatible; keep in sync with design-tokens.json |
scripts/validate-tokens.py |
Validates structure and cross-file sync |
src/scripts/token_writer.py |
Generates Figma token entries for custom palettes |
npm run build |
Builds CSS/JS/iOS/Android from design-tokens.json |
04 同仓库更多 Skills
universal-design-system
MAIN skill — Intelligent design system generation. Domain detection, BM25 search, rule engine, palette selection, token resolution, Tailwind/React/Vue/Svelte output. Use when the user wants to build, design, or implement any UI (landing page, dashboard, app, component set, style guide).
ui-styling-assistant
Focused CSS/styling helper that answers specific styling questions using Universal Design System tokens. Provides copy-paste CSS snippets with dark mode variants and responsive breakpoints.
ui-spec-prd
暂无简介
uds-getting-started
Explains how to use the installed Universal Design System skills, pick which ones to use, and add or customize skills in your project. Use when the user asks about getting started with UDS or which skill to use.
slides-design-system
Generates presentation design systems with consistent slide templates, typography rules, and color schemes mapped to Universal Design System palettes. Use when the user asks for slide design, presentation design, or deck templates.
pre-pr-review
Performs deep review and testing of all code changes before creating a PR. Catches TypeScript errors, lint regressions, SonarCloud code smells, test failures, and output correctness issues that would fail CI. Use when the user asks for pre-PR review, deep review, or CI simulation.