Bidirectional Design Token Sync
Use this skill when users mention "sync design tokens", "Figma to code", "design system sync", "token drift", "keep tokens in sync", or want to synchronize design tokens between Figma and codebase bidirectionally with automatic drift detection and conflict resolution.
What this skill does
# Bidirectional Design Token Sync
## Overview
Keep design tokens synchronized between Figma and your codebase automatically. Detect drift, resolve conflicts, and maintain a single source of truth for your design system.
**Key Innovation:** Bidirectional sync means changes in Figma OR code propagate automatically with conflict detection and intelligent merging.
## When to Use This Skill
Trigger this skill when the user:
- Mentions "sync tokens with Figma" or "Figma sync"
- Wants to "export tokens from Figma" or "import tokens to Figma"
- Asks about "design token drift" or "out of sync tokens"
- Wants to "update tokens from design" or vice versa
- Mentions Style Dictionary, design tokens, or token management
- Has conflicts between design and code token values
## Core Capabilities
### 1. Figma → Code Sync
**Problem:** Designers update colors/spacing in Figma, developers manually update code
**Solution:** Automatic extraction and sync:
```
Figma Variables/Styles → Parse → Transform → Code Tokens
```
Supports:
- Colors (all formats: hex, rgb, hsl)
- Typography (font-family, size, weight, line-height, letter-spacing)
- Spacing (padding, margin, gap)
- Border radius
- Shadows/elevation
- Gradients
### 2. Code → Figma Sync
**Problem:** Developers add tokens in code, design falls out of sync
**Solution:** Push code changes back to Figma:
```
Code Tokens → Transform → Figma API → Update Variables/Styles
```
### 3. Drift Detection
Automatically detect when design and code tokens diverge:
```bash
$ npm run tokens:check
🔍 Drift detected:
Figma → Code (5 changes):
✓ primary-500: #2196F3 → #1976D2 (theme update)
✓ spacing-lg: 20px → 24px (increased)
⚠️ New token: primary-gradient (add to code)
⚠️ New token: shadow-xl (add to code)
✓ Renamed: font-body → font-sans (update)
Code → Figma (2 changes):
⚠️ success-900 exists in code but not Figma (add)
⚠️ border-radius-2xl exists in code but not Figma (add)
Apply changes? [Figma→Code] [Code→Figma] [Both] [Review]
```
### 4. Conflict Resolution
When both sides changed the same token:
```
⚠️ Conflict detected for token: primary-500
Figma: #1976D2 (updated 2 hours ago by Sarah Designer)
Code: #2196F3 (updated 1 hour ago by you in commit abc123)
Which version should we keep?
[F]igma value [C]ode value [M]erge manually [S]kip
Recommendation: Code value is newer, use Code (C)
```
## Technical Implementation
### Architecture
```
┌─────────┐ ┌──────────────┐ ┌──────┐
│ Figma │ ←─────→ │ Style │ ←─────→ │ Code │
│ API │ │ Dictionary │ │Tokens│
└─────────┘ └──────────────┘ └──────┘
↓ ↓ ↓
Variables tokens.json CSS/JS/TS
Styles src/tokens/
```
### Components
1. **Figma Plugin** (Optional)
- Runs inside Figma
- Extracts variables and styles
- Can update Figma from external source
2. **Sync CLI** (Core)
- Command-line tool for sync
- Connects to Figma API
- Uses Style Dictionary for transformation
3. **Style Dictionary Config**
- Transforms tokens to multiple formats
- CSS variables, SCSS, JS, JSON, iOS, Android
4. **Drift Detector**
- Compares Figma and code tokens
- Identifies additions, deletions, changes
- Tracks change history
### Setup
Use `/sync-design-tokens --setup` to configure:
```bash
Figma Design Token Sync Setup
==============================
1. Figma Configuration
? Figma file URL: https://figma.com/file/abc123...
? Figma access token: (input hidden)
? Token location in Figma: [Local Variables] [Shared Variables]
2. Sync Direction
? Sync direction: [Bidirectional] [Figma → Code only] [Code → Figma only]
? Auto-sync on file save: [Yes] [No]
? Sync on git commit: [Yes] [No]
3. Conflict Resolution
? On conflict: [Manual review] [Prefer Figma] [Prefer Code] [Use latest]
4. Output Formats
? Generate CSS variables: [Yes]
? Generate SCSS variables: [Yes]
? Generate TypeScript: [Yes]
? Generate JSON: [Yes]
Setting up...
✓ Installed: @figma/rest-api-client
✓ Installed: style-dictionary
✓ Created: tokens/figma-tokens.json (source of truth)
✓ Created: config/style-dictionary.config.js
✓ Created: scripts/sync-tokens.js
✓ Added NPM scripts
Setup complete! Run 'npm run tokens:sync' to sync for the first time.
```
### Workflow
#### Initial Sync (Figma → Code)
```bash
$ npm run tokens:sync
Fetching tokens from Figma...
✓ Connected to Figma file: Design System v2
✓ Found 127 color variables
✓ Found 43 typography styles
✓ Found 24 spacing tokens
✓ Found 12 shadow styles
Transforming tokens...
✓ Generated: src/tokens/colors.css
✓ Generated: src/tokens/colors.scss
✓ Generated: src/tokens/colors.ts
✓ Generated: src/tokens/typography.css
✓ Generated: src/tokens/spacing.css
Initial sync complete! 📦
Total tokens: 206
```
#### Regular Sync with Drift
```bash
$ npm run tokens:check
Checking for drift...
Changes detected:
Figma → Code: 3 changes
Code → Figma: 1 change
Would you like to review? [Yes] [Apply all] [Cancel]
User: Yes
---
Change 1 of 4: primary-600 color update
Source: Figma
Type: Color modification
Old value: #2196F3
New value: #1976D2
Last updated: 2 hours ago by Sarah Designer
Affected tokens in code: 12 references
Apply this change? [Yes] [No] [Skip all]
User: Yes
✓ Updated src/tokens/colors.css
✓ Updated src/tokens/colors.scss
✓ Updated src/tokens/colors.ts
---
Change 2 of 4: success-900 missing in Figma
Source: Code
Type: New token
Value: #1B5E20
Created: 3 days ago in commit def456
Usage: 5 components
Add to Figma? [Yes] [No] [Skip all]
User: Yes
✓ Created in Figma: success-900
✓ Added to collection: Colors/Success
---
Sync complete! Applied 4 changes.
Summary:
✓ Figma → Code: 3 changes applied
✓ Code → Figma: 1 change applied
✓ No conflicts
Run 'git status' to see updated files.
```
## Figma API Integration
### Authentication
```javascript
// scripts/sync-tokens.js
import { FigmaClient } from '@figma/rest-api-client';
const client = new FigmaClient({
personalAccessToken: process.env.FIGMA_ACCESS_TOKEN
});
const fileKey = 'abc123...'; // From Figma URL
// Get file variables
const variables = await client.getFileVariables(fileKey);
```
### Extract Variables
```javascript
async function extractTokensFromFigma(fileKey) {
const file = await client.getFile(fileKey);
const variables = await client.getFileVariables(fileKey);
const tokens = {
color: {},
typography: {},
spacing: {},
shadow: {}
};
// Extract color variables
for (const [id, variable] of Object.entries(variables.variables)) {
if (variable.resolvedType === 'COLOR') {
const name = variable.name.toLowerCase().replace(/\s+/g, '-');
const value = rgbaToHex(variable.valuesByMode.default);
tokens.color[name] = {
value,
type: 'color',
figmaId: id,
description: variable.description || ''
};
}
}
// Extract typography styles
const styles = await client.getFileStyles(fileKey);
for (const style of styles.text) {
const name = style.name.toLowerCase().replace(/\s+/g, '-');
tokens.typography[name] = {
fontFamily: style.fontFamily,
fontSize: style.fontSize,
fontWeight: style.fontWeight,
lineHeight: style.lineHeight,
letterSpacing: style.letterSpacing,
type: 'typography',
figmaId: style.id
};
}
return tokens;
}
```
### Push Updates to Figma
```javascript
async function pushTokensToFigma(tokens, fileKey) {
const updates = [];
for (const [category, categoryTokens] of Object.entries(tokens)) {
for (const [name, token] of Object.entries(categoryTokens)) {
if (!token.figmaId) {
// New token - create in Figma
updates.push(createVariable(name, token));
} else if (token.modified) {
// Modified token - update in Figma
uRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.