figma-use
Control Figma from the command line. Full read/write access for AI agents — create shapes, text, components, set styles, export images. 100+ commands.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
Its scripts were only partly scanned.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/dannote/figma-use with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/dannote/figma-use'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/dannote--figma-use)HTML
<a href="/listings/dannote--figma-use"><img src="/api/listings/dannote--figma-use/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
npm install -g figma-use
Or run directly without installing:
npx figma-use status
Start Figma with remote debugging enabled:
# macOS open -a Figma --args --remote-debugging-port=9222 # Windows "%LOCALAPPDATA%\Figma\Figma.exe" --remote-debugging-port=9222 # Linux figma --remote-debugging-port=9222
Check connection:
figma-use status
That's it. No plugins to install.
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 674 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- ---
- name: figma-use
- description: Control Figma via CLI — create shapes, frames, text, components, set styles, layout, variables, export images. Use when asked to create/modify Figma designs or automate design tasks.
- ---
- # figma-use
- CLI for Figma. Two modes: commands and JSX.
- ```bash
- # Commands
- figma-use create frame --width 400 --height 300 --fill "#FFF" --layout VERTICAL --gap 16
- figma-use create icon mdi:home --size 32 --color "#3B82F6"
- figma-use set fill 1:23 "$Colors/Primary"
- # JSX (props directly on elements, NOT style={{}})
- echo '<Frame p={24} bg="#3B82F6" rounded={12}>
- <Text size={18} color="#FFF">Hello</Text>
- </Frame>' | figma-use render --stdin --x 100 --y 100
- ```
- ## Before You Start
- ```bash
- figma-use status # Check connection
- ```
- If not connected — start Figma with remote debugging:
- ```bash
- # macOS
- open -a Figma --args --remote-debugging-port=9222
- # Windows
- "%LOCALAPPDATA%\Figma\Figma.exe" --remote-debugging-port=9222
- # Linux
- figma --remote-debugging-port=9222
- ```
- > Figma 126+ blocks remote debugging. Run `figma-use patch` once to fix, then restart Figma. Click **Always Allow** on the keychain prompt. Re-run after Figma updates.
- >
- > **Can't patch?** Use `figma-use daemon start --pipe` — launches Figma with debug pipe, no patching needed.
- Start Figma with `--remote-debugging-port=9222` and you're ready.
- > **Non-default port?** If Figma is on another port, pass `--port <N>` to any command (or set the `FIGMA_PORT` env var). Errors will show the correct port.
- > ```bash
- > open -a Figma --args --remote-debugging-port=9333
- > figma-use get components --port 9333
- > ```
- ## Two Modes
- **Imperative** — single operations:
- ```bash
- figma-use create frame --width 400 --height 300 --fill "#FFF" --radius 12
- figma-use set fill <id> "#FF0000"
- figma-use node move <id> --x 100 --y 200
- ```
- **Declarative** — render JSX trees:
- ```bash
- echo '<Frame p={24} gap={16} flex="col" bg="#FFF" rounded={12}>
- <Text size={24} weight="bold" color="#000">Title</Text>
- <Text size={14} color="#666">Description</Text>
- </Frame>' | figma-use render --stdin --x 100 --y 200
- ```
- stdin supports both pure JSX and full module syntax with imports:
- ```tsx
- import { Frame, Text, defineComponent } from 'figma-use/render'
- const Button = defineComponent(
- 'Button',
- <Frame bg="#3B82F6" p={12} rounded={6}>
- <Text color="#FFF">Click</Text>
- </Frame>
- )
- export default () => (
- <Frame flex="row" gap={8}>
- <Button />
- <Button />
- </Frame>
- )
- ```
- **Elements:** `Frame`, `Rectangle`, `Ellipse`, `Text`, `Line`, `Star`, `Polygon`, `Vector`, `Group`, `Icon`, `Image`, `Instance`
- Use `<Instance>` to create component instances:
- ```tsx
- <Frame flex="row" gap={8}>
- <Instance component="59763:10626" />
- <Instance component="59763:10629" />
- </Frame>
- ```
- ⚠️ **Always use `--x` and `--y`** to position renders. Don't stack everything at (0, 0).
- ## Icons
- 150k+ icons from Iconify by name:
- ```bash
- figma-use create icon mdi:home
- figma-use create icon lucide:star --size 48 --color "#F59E0B"
- figma-use create icon heroicons:bell-solid --component # as Figma component
- ```
- In JSX:
- ```tsx
- <Icon name="mdi:home" size={24} color="#3B82F6" />
- ```
- ## Images
- Load images from URL:
- ```tsx
- <Image src="https://example.com/photo.jpg" w={200} h={150} />
- ```
- ## Export JSX
- Convert Figma nodes back to JSX code:
- ```bash
- figma-use export jsx <id> # Minified
- figma-use export jsx <id> --pretty # Formatted
- # Format options
- figma-use export jsx <id> --pretty --semi --tabs
- # Match vector shapes to Iconify icons (requires: npm i whaticon)
- figma-use export jsx <id> --match-icons
- figma-use export jsx <id> --match-icons --icon-threshold 0.85 --prefer-icons lucide,tabler
- ```
- Round-trip workflow:
- ```bash
- # Export → edit → re-render
- figma-use export jsx <id> --pretty > component.tsx
- # ... edit the file ...
- figma-use render component.tsx --x 500 --y 0
- ```
- Compare two nodes as JSX:
- ```bash
- figma-use diff jsx <from-id> <to-id>
- ```
- ## Export Storybook (Experimental)
- Export all components on current page as Storybook stories:
- ```bash
- figma-use export storybook # Output to ./stories/
- figma-use export storybook --out ./src/stories # Custom output dir
- figma-use export storybook --match-icons # Match vectors to Iconify icons
- figma-use export storybook --no-semantic-html # Disable semantic HTML conversion
- ```
- **Semantic HTML:** By default, components are converted to semantic HTML elements based on their names:
- - `Input/*`, `TextField/*` → `<input type="text">`
- - `Textarea/*` → `<textarea>`
- - `Checkbox/*` → `<input type="checkbox">`
- - `Radio/*` → `<input type="radio">`
- - `Button/*` → `<button>`
- - `Select/*`, `Dropdown/*` → `<select>`
- Use `--no-semantic-html` to disable this and keep `<Frame>` elements.
- Generates `.stories.tsx` files:
- - **ComponentSets** → React component with props + stories with args
- - **VARIANT properties** → Union type props (`variant?: 'Primary' | 'Secondary'`)
- - **TEXT properties** → Editable string props (`label?: string`)
- - Components grouped by `/` prefix → `Button/Primary`, `Button/Secondary` → `Button.stories.tsx`
- Example output for Button with variant and label:
- ```tsx
- // Button.tsx
- export interface ButtonProps {
- label?: string
- variant?: 'Primary' | 'Secondary'
- }
- export function Button({ label, variant }: ButtonProps) {
- if (variant === 'Primary')
- return (
- <Frame>
- <Text>{label}</Text>
- </Frame>
- )
- // ...
- }
- // Button.stories.tsx
- export const Primary: StoryObj<typeof Button> = {
- args: { label: 'Click', variant: 'Primary' }
- }
- ```
- ## Variables as Tokens
- Reference Figma variables in any color option with `var:Name` or `$Name`:
- ```bash
- figma-use create rect --width 100 --height 100 --fill 'var:Colors/Primary'
- figma-use set fill <id> '$Brand/Accent'
- ```
- In JSX:
- ```tsx
- <Frame bg="$Colors/Primary" />
- <Text color="var:Text/Primary">Hello</Text>
- ```
- ## Style Shorthands
- **Size & Position:**
- | Short | Full | Values |
- |-------|------|--------|
- | `w`, `h` | width, height | number or `"fill"` |
- | `minW`, `maxW` | minWidth, maxWidth | number |
- | `minH`, `maxH` | minHeight, maxHeight | number |
- | `x`, `y` | position | number |
- **Layout:**
- | Short | Full | Values |
- |-------|------|--------|
- | `flex` | flexDirection | `"row"`, `"col"` |
- | `gap` | spacing | number |
- | `wrap` | layoutWrap | `true` |
- | `justify` | justifyContent | `"start"`, `"center"`, `"end"`, `"between"` |
- | `items` | alignItems | `"start"`, `"center"`, `"end"` |
- | `p`, `px`, `py` | padding | number |
- | `pt`, `pr`, `pb`, `pl` | padding sides | number |
- | `position` | layoutPositioning | `"absolute"` |
- | `grow` | layoutGrow | number |
- | `stretch` | layoutAlign | `true` → STRETCH |
- **Appearance:**
- | Short | Full | Values |
- |-------|------|--------|
- | `bg` | fill | hex or `$Variable` |
- | `stroke` | strokeColor | hex |
- | `strokeWidth` | strokeWeight | number |
- | `strokeAlign` | strokeAlign | `"inside"`, `"outside"` |
- | `opacity` | opacity | 0..1 |
- | `blendMode` | blendMode | `"multiply"`, etc. |
- **Corners:**
- | Short | Full | Values |
- |-------|------|--------|
- | `rounded` | cornerRadius | number |
- | `roundedTL/TR/BL/BR` | individual corners | number |
- | `cornerSmoothing` | squircle smoothing | 0..1 (iOS style) |
- **Effects:**
- | Short | Full | Values |
- |-------|------|--------|
- | `shadow` | dropShadow | `"0px 4px 8px rgba(0,0,0,0.25)"` |
- | `blur` | layerBlur | number |
- | `overflow` | clipsContent | `"hidden"` |
- | `rotate` | rotation | degrees |
- **Text:**
- | Short | Full | Values |
- |-------|------|--------|
- | `size` | fontSize | number |
- | `weight` | fontWeight | `"bold"`, number |
- | `font` | fontFamily | string |
- | `color` | textColor | hex |
- **Grid (CSS Grid layout):**
- | Short | Full | Values |
- |-------|------|--------|
- | `display` | layoutMode | `"grid"` |
- | `cols` | gridTemplateColumns | `"100px 1fr auto"` |
- | `rows` | gridTemplateRows | `"auto auto"` |
- | `colGap` | columnGap | number |
- | `rowGap` | rowGap | number |
- ## Components (via .figma.tsx)
- First call creates master, rest create instances:
- ```tsx
- import { defineComponent, Frame, Text } from 'figma-use/render'
- const Card = defineComponent(
- 'Card',
- <Frame p={24} bg="#FFF" rounded={12}>
- <Text size={18} color="#000">
- Card
- </Text>
- </Frame>
- )
- export default () => (
- <Frame gap={16} flex="row">
- <Card />
- <Card />
- </Frame>
- )
- ```
- ```bash
- figma-use render ./Card.figma.tsx --x 100 --y 200
- figma-use render --examples # Full API reference
- ```
- ## Variants (ComponentSet)
- ```tsx
- import { defineComponentSet, Frame, Text } from 'figma-use/render'
- const Button = defineComponentSet(
- 'Button',
- {
- variant: ['Primary', 'Secondary'] as const,
- size: ['Small', 'Large'] as const
- },
- ({ variant, size }) => (
- <Frame
- p={size === 'Large' ? 16 : 8}
- bg={variant === 'Primary' ? '#3B82F6' : '#E5E7EB'}
- rounded={8}
- >
- <Text color={variant === 'Primary' ? '#FFF' : '#111'}>
- {variant} {size}
- </Text>
- </Frame>
- )
- )
- ```
- Creates real ComponentSet with all combinations.
- ## Diffs
- Compare frames and generate patch:
- ```bash
- figma-use diff create --from <id1> --to <id2>
- ```
- ```diff
- --- /Card/Header #123:457
- +++ /Card/Header #789:013
- type: FRAME
- size: 200 50
- -fill: #FFFFFF
- +fill: #F0F0F0
- ```
- ⚠️ Context lines need space prefix: ` size: 200 50` not `size: 200 50`
- Apply with validation:
- ```bash
- figma-use diff apply patch.diff # Fails if old values don't match
- figma-use diff apply patch.diff --dry-run # Preview
- figma-use diff apply patch.diff --force # Skip validation
- ```
- Visual diff (red = changed pixels):
- ```bash
- figma-use diff visual --from <id1> --to <id2> --output diff.png
- ```
- ⚠️ **After initial render, use diffs or direct commands.** Don't re-render full JSX trees.
- ## Query (XPath)
- Find nodes using XPath selectors:
- ```bash
- figma-use query "//FRAME" # All frames
- figma-use query "//FRAME[@width < 300]" # Frames narrower than 300px
- figma-use query "//COMPONENT[starts-with(@name, 'Button')]" # Name starts with
- figma-use query "//FRAME[contains(@name, 'Card')]" # Name contains
- figma-use query "//SECTION/FRAME" # Direct children
- figma-use query "//SECTION//TEXT" # All descendants
- figma-use query "//*[@cornerRadius > 0]" # Any node with radius
- figma-use query "//FRAME[@width > 100 and @width < 500]" # Range
- ```
- Attributes: `name`, `width`, `height`, `x`, `y`, `cornerRadius`, `opacity`, `visible`, `characters`, `fontSize`, `layoutMode`, `itemSpacing`
- XPath functions: `contains()`, `starts-with()`, `string-length()`, `not()`, `and`, `or`
- ## Common Commands
- ```bash
- # Create
- figma-use create frame --width 400 --height 300 --fill "#FFF" --layout VERTICAL --gap 16
- figma-use create text --text "Hello" --font-size 24 --fill "#000"
- figma-use create rect --width 100 --height 50 --fill "#F00" --radius 8
- # Find
- figma-use query "//FRAME[@name = 'Header']"
- figma-use find --name "Button"
- figma-use find --type FRAME
- figma-use selection get
- # Explore
- figma-use node ancestors <id> # Get parent chain (useful for navigation)
- figma-use node bindings <id> # Get variable bindings for fills/strokes
- figma-use page bounds # Find free space for new objects
- figma-use variable find "Text/Neutral" # Search variables by name
- # Modify
- figma-use set fill <id> "#FF0000"
- figma-use set radius <id> 12
- figma-use set text <id> "New text"
- figma-use set text-resize <id> height # Wrap text (height auto, fixed width)
- figma-use set layout <id> --mode VERTICAL --gap 12 --padding 16
- figma-use set layout <id> --mode GRID --cols "1fr 1fr 1fr" --rows "auto" --gap 16
- figma-use node move <id> --x 100 --y 200
- figma-use node resize <id> --width 300 --height 200
- figma-use node delete <id> [id2...]
- figma-use arrange # Tidy up overlapping frames on canvas
- figma-use node to-component <id>
- # Export
- figma-use export node <id> --output design.png
- figma-use export screenshot --output viewport.png
- # Navigate
- figma-use page list
- figma-use page set "Page Name"
- figma-use viewport zoom-to-fit <id>
- # Daemon (faster sequential commands)
- figma-use daemon start # Background daemon
- figma-use daemon start --pipe # Launch Figma with debug pipe (no patching)
- figma-use daemon stop
- figma-use daemon status
- ```
- Full reference: [REFERENCE.md](https://github.com/dannote/figma-use/blob/master/REFERENCE.md)
- ## Analyze
- Discovery tools for understanding design systems:
- ```bash
- # Repeated patterns — potential components
- figma-use analyze clusters
- figma-use analyze clusters --min-count 5
- # Color palette
- figma-use analyze colors # Usage frequency
- figma-use analyze colors --show-similar # Find similar colors to merge
- # Typography
- figma-use analyze typography # All font combinations
- figma-use analyze typography --group-by size
- # Spacing
- figma-use analyze spacing --grid 8 # Check 8px grid compliance
- # Accessibility snapshot — extract interactive elements
- figma-use analyze snapshot # Full page
- figma-use analyze snapshot <id> -i # Interactive only (buttons, inputs, etc.)
- figma-use analyze snapshot --depth 6 # Limit depth
- ```
- **Use cases:**
- - **Component extraction** — find copy-pasted elements that should be components
- - **Design audit** — identify inconsistencies, similar-but-different elements
- - **Design system creation** — discover existing colors, typography, spacing patterns
- - **Onboarding** — understand structure of unfamiliar design files
- Output shows counts, examples, and warnings (e.g., off-grid spacing, hardcoded colors).
- ## Lint (Experimental)
- Check designs for consistency and accessibility issues:
- ```bash
- figma-use lint # Recommended preset
- figma-use lint --page "Components" # Lint specific page
- figma-use lint --preset strict # Stricter rules
- figma-use lint --preset accessibility # A11y only (contrast, touch targets)
- figma-use lint --rule color-contrast # Single rule
- figma-use lint -v # With fix suggestions
- figma-use lint --json # For CI/CD
- figma-use lint --list-rules # Show all rules
- ```
- **Presets:** `recommended`, `strict`, `accessibility`, `design-system`
- **17 rules:**
- - Design tokens: `no-hardcoded-colors`, `consistent-spacing`, `consistent-radius`, `effect-style-required`
- - Layout: `prefer-auto-layout`, `pixel-perfect`
- - Typography: `text-style-required`, `min-text-size`, `no-mixed-styles`
- - Accessibility: `color-contrast`, `touch-target-size`
- - Structure: `no-default-names`, `no-hidden-layers`, `no-deeply-nested`, `no-empty-frames`, `no-groups`
- - Components: `no-detached-instances`
- Exit code 1 if errors found — use in CI pipelines.
- ## Output
- Human-readable by default — **prefer this to save tokens**. Use `--json` only when you need to parse specific fields programmatically.
- ## Node IDs
- Format: `session:local` (e.g., `1:23`). Inside instances: `I<instance-id>;<internal-id>`.
- Get IDs from `figma-use selection get` or `figma-use node tree`.
- ## Colors
- Hex: `#RGB`, `#RRGGBB`, `#RRGGBBAA`
- Variables: `var:Colors/Primary` or `$Colors/Primary`
- ---
- ## Best Practices
- ### Always verify visually
- ```bash
- figma-use export node <id> --output /tmp/check.png
- ```
- ### Always zoom after creating
- ```bash
- figma-use viewport zoom-to-fit <id>
- ```
- ### Position multiple renders separately
- ```bash
- echo '...' | figma-use render --stdin --x 0 --y 0
- echo '...' | figma-use render --stdin --x 500 --y 0 # Not at same position!
- ```
- ### Arrange after batch creation
- After creating multiple frames/sections, run `arrange` to spread them out:
- ```bash
- figma-use arrange --mode grid --gap 60 # Grid layout (default)
- figma-use arrange --mode squarify --gap 60 # Smart packing for mixed sizes
- ```
- ### Copy between pages
- ```bash
- figma-use node clone <id> [id2...] --json | jq -r '.[].id'
- figma-use node set-parent <new-id> --parent <target-page-id>
- figma-use node move <new-id> --x 50 --y 50
- ```
- ### Replace node
- ```bash
- # Replace with component (creates instance)
- figma-use node replace-with <id> --target <component-id>
- # Replace with JSX from stdin
- echo '<Icon name="lucide:x" size={16} />' | figma-use node replace-with <id> --stdin
- ```
- ### Convert to component
- ```bash
- figma-use node to-component <id>
- figma-use node to-component "1:2 1:3 1:4" # Multiple
- ```
- ### Instance internal IDs
- ```bash
- figma-use set text "I123:456;789:10" "New text" # I<instance>;<internal>
- ```
- ### Row layout needs width
- ```bash
- # ❌ Collapses to 1×1
- <Frame flex="row" gap={8}>
- # ✅ Explicit width
- <Frame w={300} flex="row" gap={8}>
- ```
- ### Sections
- ```bash
- figma-use create section --name "Buttons" --x 0 --y 0 --width 600 --height 200
- figma-use node set-parent <id> --parent <section-id>
- ```
- ⚠️ Deleting section deletes all children!
- ### Comment-driven workflow
- Wait for designer feedback and react:
- ```bash
- figma-use comment watch --json
- ```
- Output when comment arrives:
- ```json
- {
- "id": "123456",
- "message": "Make this button bigger",
- "user": { "handle": "designer" },
- "client_meta": { "node_id": "1:23" }
- }
- ```
- Agent workflow — run once per comment, then restart:
- 1. `figma-use comment watch --json` — blocks until new comment
- 2. Parse the JSON, get `message` and `target_node` (exact element under comment)
- 3. Process the request (modify design, etc.)
- 4. Reply: `figma-use comment add "Done!" --reply <comment-id>`
- 5. Resolve: `figma-use comment resolve <comment-id>`
- 6. Exit. External runner restarts for next comment.
- Options:
- - `--timeout 60` — exit after 60s if no comment (returns `{"timeout":true}`)
- - `--interval 5` — poll every 5s (default: 3s)
- ### Vector paths — iterative workflow
- Draw, screenshot, adjust, repeat — like a designer tweaking Bezier curves:
- ```bash
- # 1. Draw initial shape
- figma-use create vector --path "M 50 0 L 100 100 L 0 100 Z" --fill "#F00"
- # 2. Check result
- figma-use export node <id> --output /tmp/shape.png
- # 3. Adjust: scale, move, flip
- figma-use path scale <id> --factor 0.8
- figma-use path move <id> --dx 20 --dy -10
- figma-use path flip <id> --axis x
- # 4. Or replace path entirely
- figma-use path set <id> "M 50 0 C 80 30 80 70 50 100 C 20 70 20 30 50 0 Z"
- # 5. Screenshot again, repeat until good
- figma-use export node <id> --output /tmp/shape.png
- ```
- For complex illustrations, import SVG:
- ```bash
- figma-use import --svg "$(cat icon.svg)"
- ```
README.md · README · 562 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- # figma-use
- > **⚠️ Figma 126+ blocks remote debugging.** figma-use still works via `figma-use daemon start --pipe`. Or skip Figma entirely with **[OpenPencil](https://github.com/open-pencil/open-pencil)** — an open-source design editor that reads and writes .fig files, with built-in AI and P2P collaboration.
- CLI for Figma. Control it from the terminal — with commands or JSX.
- ```bash
- # Create and style
- figma-use create frame --width 400 --height 300 --fill "#FFF" --layout VERTICAL --gap 16
- figma-use create icon mdi:home --size 32 --color "#3B82F6"
- figma-use set layout 1:23 --mode GRID --cols "1fr 1fr 1fr" --gap 16
- # Or render JSX
- echo '<Frame style={{display: "grid", cols: "1fr 1fr", gap: 16}}>
- <Frame style={{bg: "#3B82F6", h: 100}} />
- <Frame style={{bg: "#10B981", h: 100}} />
- </Frame>' | figma-use render --stdin --x 100 --y 100
- ```
- ## Why
- Figma's official MCP plugin can read files but can't modify them. This one can.
- LLMs know CLI. LLMs know React. This combines both.
- CLI commands are compact — easy to read, easy to generate, easy to chain. When a task involves dozens of operations, every saved token matters.
- JSX is how LLMs already think about UI. They've seen millions of React components. Describing a Figma layout as `<Frame><Text>` is natural for them — no special training, no verbose schemas.
- ## Demo
- <table>
- <tr>
- <td width="50%">
- <a href="https://youtu.be/9eSYVZRle7o">
- <img src="https://img.youtube.com/vi/9eSYVZRle7o/maxresdefault.jpg" alt="Button components demo" width="100%">
- </a>
- <p align="center"><b>▶️ Button components</b></p>
- </td>
- <td width="50%">
- <a href="https://youtu.be/efJWp2Drzb4">
- <img src="https://img.youtube.com/vi/efJWp2Drzb4/maxresdefault.jpg" alt="Calendar demo" width="100%">
- </a>
- <p align="center"><b>▶️ Tailwind UI calendar</b></p>
- </td>
- </tr>
- </table>
- ## Installation
- ```bash
- npm install -g figma-use
- ```
- Or run directly without installing:
- ```bash
- npx figma-use status
- ```
- Start Figma with remote debugging enabled:
- ```bash
- # macOS
- open -a Figma --args --remote-debugging-port=9222
- # Windows
- "%LOCALAPPDATA%\Figma\Figma.exe" --remote-debugging-port=9222
- # Linux
- figma --remote-debugging-port=9222
- ```
- Check connection:
- ```bash
- figma-use status
- ```
- That's it. No plugins to install.
- ## Two Modes
- Imperative — one command at a time:
- ```bash
- figma-use create frame --width 400 --height 300 --fill "#FFF" --radius 12 --layout VERTICAL --gap 16
- ```
- Or declaratively — describe the structure in JSX and render it:
- ```bash
- echo '<Frame style={{p: 24, gap: 16, flex: "col", bg: "#FFF", rounded: 12}}>
- <Text style={{size: 24, weight: "bold", color: "#000"}}>Card Title</Text>
- <Text style={{size: 14, color: "#666"}}>Description</Text>
- </Frame>' | figma-use render --stdin --x 100 --y 200
- ```
- The stdin mode accepts pure JSX only — no variables, no logic. For components, variants, and conditions, use `.figma.tsx` files.
- **Elements:** `Frame`, `Rectangle`, `Ellipse`, `Text`, `Line`, `Star`, `Polygon`, `Vector`, `Group`, `Icon`, `Image`
- ## Examples
- ### Icons
- Insert any icon from Iconify by name. No downloading, no importing, no cleanup.
- ```bash
- figma-use create icon mdi:home
- figma-use create icon lucide:star --size 48 --color "#F59E0B"
- ```
- In JSX:
- ```tsx
- <Frame style={{ flex: 'row', gap: 8 }}>
- <Icon icon="mdi:home" size={24} color="#3B82F6" />
- <Icon icon="lucide:star" size={32} color="#F59E0B" />
- </Frame>
- ```
- Browse 150k+ icons: [icon-sets.iconify.design](https://icon-sets.iconify.design/)
- ### Images
- Load images from URL:
- ```tsx
- <Image src="https://example.com/photo.jpg" w={200} h={150} />
- ```
- ### Export to JSX
- Convert any Figma node back to JSX:
- ```bash
- figma-use export jsx 123:456 --pretty
- ```
- Output:
- ```tsx
- import { Frame, Icon, Text } from 'figma-use/render'
- export default function SaveButton() {
- return (
- <Frame name="SaveButton" w={120} h={44} bg="#1FAFBB" rounded={8} flex="row" gap={8}>
- <Icon name="lucide:save" size={18} color="#FFFFFF" />
- <Text size={16} color="#FFFFFF">
- Save
- </Text>
- </Frame>
- )
- }
- ```
- Match vector shapes to Iconify icons automatically:
- ```bash
- npm install whaticon # Optional dependency
- figma-use export jsx 123:456 --match-icons --prefer-icons lucide
- ```
- Compare two nodes as JSX diff:
- ```bash
- figma-use diff jsx 123:456 789:012
- ```
- ### Export to Storybook (Experimental)
- Export components as Storybook stories:
- ```bash
- figma-use export storybook --out ./stories
- figma-use export storybook --out ./stories --match-icons --prefer-icons lucide
- ```
- Generates `.stories.tsx` with typed props from component properties.
- ### Components
- In a `.figma.tsx` file you can define components. First call creates the master, the rest create instances:
- ```tsx
- import { defineComponent, Frame, Text } from 'figma-use/render'
- const Card = defineComponent(
- 'Card',
- <Frame style={{ p: 24, bg: '#FFF', rounded: 12 }}>
- <Text style={{ size: 18, color: '#000' }}>Card</Text>
- </Frame>
- )
- export default () => (
- <Frame style={{ gap: 16, flex: 'row' }}>
- <Card />
- <Card />
- <Card />
- </Frame>
- )
- ```
- ### Variants
- ComponentSet with all combinations:
- ```tsx
- import { defineComponentSet, Frame, Text } from 'figma-use/render'
- const Button = defineComponentSet(
- 'Button',
- {
- variant: ['Primary', 'Secondary'] as const,
- size: ['Small', 'Large'] as const
- },
- ({ variant, size }) => (
- <Frame
- style={{
- p: size === 'Large' ? 16 : 8,
- bg: variant === 'Primary' ? '#3B82F6' : '#E5E7EB',
- rounded: 8
- }}
- >
- <Text style={{ color: variant === 'Primary' ? '#FFF' : '#111' }}>
- {variant} {size}
- </Text>
- </Frame>
- )
- )
- export default () => (
- <Frame style={{ gap: 16, flex: 'col' }}>
- <Button variant="Primary" size="Large" />
- <Button variant="Secondary" size="Small" />
- </Frame>
- )
- ```
- This creates a real ComponentSet in Figma with all 4 variants, not just 4 separate buttons.
- ### Grid Layout
- CSS Grid for 2D layouts — calendars, dashboards, galleries:
- ```tsx
- <Frame
- style={{
- display: 'grid',
- cols: '1fr 1fr 1fr', // 3 equal columns
- rows: 'auto auto', // 2 rows
- gap: 16
- }}
- >
- <Frame style={{ bg: '#FF6B6B' }} />
- <Frame style={{ bg: '#4ECDC4' }} />
- <Frame style={{ bg: '#45B7D1' }} />
- <Frame style={{ bg: '#96CEB4' }} />
- <Frame style={{ bg: '#FFEAA7' }} />
- <Frame style={{ bg: '#DDA0DD' }} />
- </Frame>
- ```
- Supports `px`, `fr`, and `auto`/`hug`. Separate gaps with `colGap` and `rowGap`.
- In CLI:
- ```bash
- figma-use set layout <id> --mode GRID --cols "100px 1fr 100px" --rows "auto" --gap 16
- ```
- ### Variables as Tokens
- Bind colors to Figma variables by name. The hex value is a fallback:
- ```tsx
- import { defineVars, Frame, Text } from 'figma-use/render'
- const colors = defineVars({
- bg: { name: 'Colors/Gray/50', value: '#F8FAFC' },
- text: { name: 'Colors/Gray/900', value: '#0F172A' }
- })
- export default () => (
- <Frame style={{ bg: colors.bg }}>
- <Text style={{ color: colors.text }}>Bound to variables</Text>
- </Frame>
- )
- ```
- In CLI, use `var:Colors/Primary` or `$Colors/Primary` in any color option.
- ### Diffs
- Compare two frames and get a patch:
- ```bash
- figma-use diff create --from 123:456 --to 789:012
- ```
- ```diff
- --- /Card/Header #123:457
- +++ /Card/Header #789:013
- @@ -1,5 +1,5 @@
- type: FRAME
- size: 200 50
- pos: 0 0
- -fill: #FFFFFF
- +fill: #F0F0F0
- -opacity: 0.8
- +opacity: 1
- ```
- Apply the patch to the original frame. On apply, current state is validated against expected — if they don't match, it fails.
- Visual diff highlights changed pixels in red:
- ```bash
- figma-use diff visual --from 49:275096 --to 49:280802 --output diff.png
- ```
- | Before | After | Diff |
- | --------------------------------- | ------------------------------- | ------------------------------- |
- |  |  |  |
- ### Inspection
- Page tree in readable form:
- ```
- $ figma-use node tree
- [0] frame "Card" (1:23)
- 400×300 at (0, 0) | fill: #FFFFFF | layout: col gap=16
- [0] text "Title" (1:24)
- "Hello World" | 24px Inter Bold
- ```
- Export any node or screenshot with one command.
- ### Arrange
- Tidy up canvas layout — especially useful after agents create multiple frames at the same position:
- ```bash
- figma-use arrange # Grid-arrange all top-level nodes
- figma-use arrange --mode row --gap 60 # Horizontal row
- figma-use arrange --mode squarify --gap 60 # Smart packing for mixed sizes
- ```
- Uses d3-hierarchy treemap for `squarify` and `binary` modes — size-aware rectangle packing.
- ### Vectors
- Import SVG or work with paths directly — read, modify, translate, scale, flip:
- ```bash
- figma-use path get <id>
- figma-use path set <id> "M 0 0 L 100 100 Z"
- figma-use path scale <id> --factor 1.5
- figma-use path flip <id> --axis x
- ```
- ### Query
- Find nodes using XPath selectors:
- ```bash
- figma-use query "//FRAME" # All frames
- figma-use query "//FRAME[@width < 300]" # Narrower than 300px
- figma-use query "//COMPONENT[starts-with(@name, 'Button')]" # Name starts with
- figma-use query "//FRAME[contains(@name, 'Card')]" # Name contains
- figma-use query "//SECTION/FRAME" # Direct children
- figma-use query "//SECTION//TEXT" # All descendants
- figma-use query "//*[@cornerRadius > 0]" # Any node with radius
- ```
- Full XPath 3.1 support — predicates, functions, arithmetic, axes.
- ### Analyze
- Discovery tools for understanding design systems:
- ```bash
- # Find repeated patterns (potential components)
- figma-use analyze clusters
- # Color palette — usage frequency, variables vs hardcoded
- figma-use analyze colors
- figma-use analyze colors --show-similar # Find colors to merge
- # Typography — all font combinations
- figma-use analyze typography
- figma-use analyze typography --group-by size
- # Spacing — gap/padding values, grid compliance
- figma-use analyze spacing --grid 8
- # Accessibility snapshot — extract interactive elements tree
- figma-use analyze snapshot # Full page
- figma-use analyze snapshot <id> -i # Interactive elements only
- ```
- Example output:
- ```
- [0] 48× frame "Header" pattern (100% match)
- 1280×56 | Frame > [Frame×2, Text]
- examples: 53171:21628, 53171:21704
- #303030 ████████████████████ 1840× (var)
- #E5E5E5 ████████████████████ 1726× (var)
- #000000 ████████ 238×
- ```
- ### Lint (Experimental)
- Check designs for consistency, accessibility, and best practices:
- ```bash
- figma-use lint # Recommended rules
- figma-use lint --page "Components" # Lint specific page
- figma-use lint --preset strict # Stricter for production
- figma-use lint --preset accessibility # A11y checks only
- figma-use lint -v # With fix suggestions
- ```
- Output:
- ```
- ✖ Header/Title (1:234)
- ✖ Contrast ratio 2.1:1 is below AA threshold (4.5:1) color-contrast
- ⚠ Touch target 32x32 is below minimum 44x44 touch-target-size
- ⚠ Card/Body (1:567)
- ⚠ Hardcoded fill color #1A1A1A no-hardcoded-colors
- ℹ Frame with 3 children doesn't use Auto Layout prefer-auto-layout
- ────────────────────────────────────────────────────────────────
- ✖ 1 error ⚠ 3 warnings ℹ 1 info
- ```
- **17 rules** across 6 categories:
- | Category | Rules |
- | ------------- | ------------------------------------------------------------------------------------------ |
- | Design Tokens | `no-hardcoded-colors`, `consistent-spacing`, `consistent-radius`, `effect-style-required` |
- | Layout | `prefer-auto-layout`, `pixel-perfect` |
- | Typography | `text-style-required`, `min-text-size`, `no-mixed-styles` |
- | Accessibility | `color-contrast`, `touch-target-size` |
- | Structure | `no-default-names`, `no-hidden-layers`, `no-deeply-nested`, `no-empty-frames`, `no-groups` |
- | Components | `no-detached-instances` |
- JSON output for CI/CD:
- ```bash
- figma-use lint --json > report.json
- ```
- ### Comment-Driven Workflow (Experimental)
- AI agents can wait for Figma comments and respond:
- ```bash
- figma-use comment watch --json # Blocks until new comment
- figma-use comment resolve <id> # Mark as done
- ```
- Returns comment text, author, and `target_node` — the exact element under the comment pin. Agent processes the request, resolves the comment, then runs `watch` again for the next one.
- ## Full Command Reference
- See [REFERENCE.md](./REFERENCE.md) for the complete list of 100+ commands.
- ## MCP Server
- For AI agents that support Model Context Protocol:
- ```bash
- figma-use mcp serve
- ```
- Exposes 90+ tools. See [MCP.md](./MCP.md) for setup.
- ## Configuration
- For Storybook export and linting, create a config file:
- ```bash
- figma-use init
- ```
- Creates `.figma-use.json`:
- ```json
- {
- "storybook": {
- "page": "Components",
- "out": "./stories",
- "matchIcons": true,
- "preferIcons": ["lucide", "tabler"]
- },
- "lint": {
- "preset": "recommended"
- },
- "format": {
- "pretty": true,
- "semi": false,
- "singleQuote": true
- }
- }
- ```
- CLI arguments override config values.
- ## For AI Agents
- Includes [SKILL.md](./SKILL.md) — a reference for Claude Code, Cursor, and other agents.
- ## How It Works
- ```
- ┌─────────────┐ ┌─────────────┐
- │ Terminal │────CDP────▶│ Figma │
- │ figma-use │ port 9222 │ │
- └─────────────┘ └─────────────┘
- ```
- figma-use communicates directly with Figma via Chrome DevTools Protocol (CDP). Just start Figma with `--remote-debugging-port=9222` and you're ready.
- > **Non-default port?** Pass `--port <N>` to any command, or set the `FIGMA_PORT` env var:
- > ```bash
- > open -a Figma --args --remote-debugging-port=9333
- > figma-use get components --port 9333
- > # or
- > FIGMA_PORT=9333 figma-use get components
- > ```
- Commands are executed via `Runtime.evaluate` in Figma's JavaScript context, with full access to the Plugin API.
- ### Daemon
- Optional daemon keeps the CDP connection warm for faster sequential commands:
- ```bash
- figma-use daemon start # Background daemon (~25% faster commands)
- figma-use daemon stop # Stop daemon
- figma-use daemon status # Check if running
- ```
- ### Pipe Transport
- For Figma 126+ without admin access to patch, the daemon can launch Figma with `--remote-debugging-pipe` instead:
- ```bash
- figma-use daemon start --pipe # Launches Figma, connects via stdio pipes
- ```
- Set `FIGMA_BIN` for custom binary locations. The daemon holds the pipe connection — all commands route through it automatically.
- ## License
- MIT
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.