home / skills / openclaw / skills / figma-sync
This skill reads Figma files, extracts design tokens, generates React Native Expo TS or Web React + Tailwind code, and diffs patches.
npx playbooks add skill openclaw/skills --skill figma-syncReview the files below or copy the command above to add this skill to your agents.
---
name: figma-sync
description: |
Read Figma files, extract design tokens, generate React Native Expo TS or Web React + Tailwind code,
write back to Figma, and diff local models against Figma for minimal patches.
Triggers: "pull figma", "sync figma", "figma to code", "push to figma", "diff figma",
"extract design tokens", "generate from figma", "preview figma changes"
---
# figma-sync
Bidirectional Figma ↔ Code synchronization skill.
## Setup
```bash
export FIGMA_TOKEN="your-personal-access-token"
```
Get a token at https://www.figma.com/developers/api#access-tokens
## Commands
### Pull (Read + Generate Code)
```bash
python3 scripts/figma_pull.py --file-key <KEY> --platform rn-expo --output-dir ./out
python3 scripts/figma_pull.py --file-key <KEY> --node-ids 1:2,3:4 --platform web-react --output-dir ./out
```
Outputs: `designModel.json`, `tokens.json`, `codePlan.json`, and generated component files.
### Push (Write Back)
```bash
python3 scripts/figma_push.py --file-key <KEY> --patch-spec patch.json
python3 scripts/figma_push.py --file-key <KEY> --patch-spec patch.json --execute # actually apply
```
Dry-run by default. Pass `--execute` to apply changes.
### Diff
```bash
python3 scripts/figma_diff.py --file-key <KEY> --local-model designModel.json
```
Outputs changes and a patchSpec to sync.
### Preview
```bash
python3 scripts/figma_preview.py --file-key <KEY> --operations ops.json
```
Shows what would change without touching anything.
## Platforms
- **rn-expo**: React Native + Expo + TypeScript (primary)
- **web-react**: React + Tailwind CSS (secondary)
## Rate Limits
Uses exponential backoff, ETag caching, and respects Figma's rate limits (~30 req/min).
Cache stored in `.figma-cache/` directory.
## References
- [DesignSpec Schema](references/design-spec-schema.json)
- [API Guide](references/api-guide.md)
This skill synchronizes Figma files with local code and design models, enabling bidirectional updates between Figma and generated React/React Native projects. It extracts design tokens and component structure, generates TypeScript code for RN-Expo or Web React + Tailwind, and can write minimal patches back to Figma. The tool supports dry-run previews, diffs, and respects Figma rate limits with caching and backoff.
The skill reads a Figma file using a personal access token and builds a structured designModel and tokens.json. It generates a codePlan and source files for the selected platform (rn-expo or web-react), and can compute diffs between the local model and the live Figma file to produce a minimal patchSpec. Push operations are dry-run by default and require an explicit execute flag to apply changes back to Figma. Caching, ETag checks, and exponential backoff reduce API usage and collisions.
How do I authorize access to Figma?
Export a personal access token from Figma and set FIGMA_TOKEN in your environment before running commands.
Are pushes destructive?
Pushes are dry-run by default; pass --execute to apply the generated patchSpec to Figma.
Which platforms are supported?
Supported targets are rn-expo (React Native + Expo + TypeScript) and web-react (React + Tailwind CSS).