Skip to content
Skillpedia
Interfaces (UI/UX)9.5k Β· #12225

open-pencil

What it does

This skill lets your AI work with .fig design files and the OpenPencil editor, including reading the structure, exporting images and changing designs. It is for designers and developers who work with these files.

When to use it

  • βœ“When you ask your AI to open or inspect a .fig design file.
  • βœ“When you want a design exported as PNG, SVG, PDF or JSX.
  • βœ“When you want design tokens analyzed or a design changed from a script.

Skill link

https://github.com/open-pencil/open-pencil/blob/master/skills/open-pencil/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/open-pencil/open-pencil/blob/master/skills/open-pencil/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œExport the Login frame from this design file as an SVG.”

5 new skills a week. 1 minute to read.

How it works

The skill works in two ways. It can connect to the OpenPencil app that is already open, or it can work directly on a .fig file you name. It uses the OpenPencil command line tool and its MCP server to read and change the design.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

OpenPencil

OpenPencil provides a CLI and MCP server for .fig design files and the running OpenPencil editor.

Use two modes:

  • App mode β€” connect to the running OpenPencil editor by omitting the file argument.
  • Headless mode β€” work with .fig files directly by passing a file path.
# App mode β€” operates on the document open in the editor
openpencil tree

# Headless mode β€” operates on a .fig file
openpencil tree design.fig

Use openpencil --help, per-command help, and the connected MCP server’s tool schemas to check the installed version’s capabilities. See the CLI reference and MCP guide for current documentation.

Variable formulas

Inside eval, use openpencil.setVariableFormula('Spacing', 'large', '{base} * 2') for numeric formulas or openpencil.setVariableFormula('State', 'visible', '{viewport} > 1024 and not {loading}') for Boolean formulas, which use and, or, not and number comparisons. Collections and variables must already exist. An optional fourth argument selects a mode by name; otherwise the default mode is edited. The call validates before mutation and returns the resolved value. Length formulas use stored pixels. The CSS stylesheet writes number formulas as calc(); design-token files hold the result with the formula in $extensions.

Variables follow Figma's plugin API: figma.variables.getLocalVariables(), createVariable(name, collection, type), variable.setValueForMode(modeId, value), and node.setBoundVariable(field, variable) with Figma's field names (characters, width, paddingLeft) and types; paint colours bind through figma.variables.setBoundVariableForPaint. To bind as the layer panel does, use openpencil.bindVariable(node, field, variable) and openpencil.unbindVariable(node, field) with OpenPencil names (text, visible, opacity, fills/0/color): text content takes a text or number variable, shown as text; visibility a boolean or text one. openpencil also sets layout and text direction (setLayoutDirection, setTextDirection), OkHCL paint colors (setFillOkHCL, setStrokeOkHCL), writes styled text from Markdown (setTextMarkdown(text, markdown), or set_text with markdown: true), exposes instance swaps (exposeInstanceSwap), and reports font availability (getFontStatus()); booleans and flattening are Figma's figma.union, subtract, intersect, exclude and figma.flatten.

Requirements

# CLI
bun add -g @open-pencil/cli

# MCP server used by the desktop app and external MCP clients
bun add -g @open-pencil/mcp

The desktop app starts openpencil-mcp-http automatically in production Tauri builds when @open-pencil/mcp is installed globally and exposes automation on:

  • HTTP/RPC: http://127.0.0.1:7600
  • WebSocket bridge: ws://127.0.0.1:7601
  • MCP Streamable HTTP: http://127.0.0.1:7600/mcp

CLI Commands

openpencil --help

Common commands:

  • info β€” document overview: pages, node counts, fonts
  • tree β€” print hierarchy with types and sizes
  • pages β€” list pages
  • node β€” detailed node properties by ID
  • selection β€” current selection from the running app
  • find β€” find nodes by name/type
  • query β€” XPath selectors for node search
  • variables β€” list variables and collections
  • tokens β€” variables as a CSS custom-property stylesheet, a Tailwind v4 theme, or W3C design token files (--format dtcg --out <folder>)
  • export β€” export PNG/JPG/WEBP/SVG/PDF/JSX/.fig
  • convert β€” convert between supported document formats
  • analyze β€” colors, typography, spacing, repeated clusters
  • lint β€” consistency, structure, and accessibility checks
  • formats β€” supported document/export formats
  • eval β€” execute JavaScript with the Figma Plugin API
  • tool β€” list, describe, and call any MCP tool from the shell, in app or headless mode
  • documents β€” list, open, create, save, close, and activate documents in the running app
  • undo / redo β€” step back through your own (automation) changes in the running app
  • settings β€” read and change editor settings in the running app

Inspect

openpencil info design.fig
openpencil tree design.fig
openpencil tree --page "Components" --depth 3  # app mode
openpencil pages design.fig
openpencil node design.fig --id 1:23
openpencil node --id 1:23  # app mode
openpencil selection --json
openpencil variables design.fig
openpencil variables --
FAQ

Do I need the app open?

No. You can pass a file path to work on the file directly, or leave it out to use the open app.

Can it change my design?

Yes. It can modify designs programmatically, so check the result after changes.

Where can I learn the commands?

The skill points to the OpenPencil command line help and reference for the version you have installed.

Details

Original description by the author

Work with Figma .fig design files and the running OpenPencil editor β€” inspect structure, query nodes, analyze design tokens, export PNG/SVG/PDF/JSX, and modify designs programmatically. Use when asked to open, inspect, export, analyze, or edit .fig files, or to control the running OpenPencil app.

repo: open-pencil/open-pencil

Popularity

GitHub stars
9.5k
Ranking position
#12225
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

Similar skills