Loading...
Loading...
Work with Figma .fig design files and the running OpenPencil editor — inspect structure, query nodes, analyze design tokens, export images/SVG/JSX, and modify designs programmatically. Use when asked to open, inspect, export, analyze, or edit .fig files, or to control the running OpenPencil app.
npx skill4agent add open-pencil/skills open-pencil# App mode — operates on the document open in the editor
bun open-pencil tree
# Headless mode — operates on a .fig file
bun open-pencil tree design.fighttp://127.0.0.1:7600# Document overview — pages, node counts, fonts
bun open-pencil info design.fig
# Node tree — shows hierarchy with types and sizes
bun open-pencil tree design.fig
bun open-pencil tree --page "Components" --depth 3 # app mode, specific page
# List pages
bun open-pencil pages design.fig
# Detailed node properties — fills, strokes, effects, layout, text
bun open-pencil node design.fig --id 1:23
bun open-pencil node --id 1:23 # app mode
# List design variables and collections
bun open-pencil variables design.fig
bun open-pencil variables --collection "Colors" --type COLOR# Find by name (partial match, case-insensitive)
bun open-pencil find design.fig --name "Button"
# Find by type
bun open-pencil find --type FRAME # app mode
bun open-pencil find design.fig --type TEXT --page "Home"
# Combine filters
bun open-pencil find design.fig --name "Card" --type COMPONENT --limit 50FRAMETEXTRECTANGLEELLIPSEVECTORGROUPCOMPONENTCOMPONENT_SETINSTANCESECTIONLINESTARPOLYGONSLICEBOOLEAN_OPERATION# PNG (default)
bun open-pencil export design.fig -o hero.png
bun open-pencil export -o hero.png # app mode — exports from running editor
# Specific node at 2x
bun open-pencil export design.fig --node 1:23 -s 2 -o button@2x.png
# JPG with quality
bun open-pencil export design.fig -f jpg -q 85 -o preview.jpg
# SVG
bun open-pencil export design.fig -f svg --node 1:23 -o icon.svg
# JSX (OpenPencil format — renderable back into .fig)
bun open-pencil export design.fig -f jsx -o component.jsx
# JSX (Tailwind — React component with Tailwind classes)
bun open-pencil export design.fig -f jsx --style tailwind -o component.tsx
# Page thumbnail
bun open-pencil export design.fig --thumbnail --width 1920 --height 1080
# Specific page
bun open-pencil export --page "Components" -o components.png# Color palette — usage frequency, similar colors
bun open-pencil analyze colors design.fig
bun open-pencil analyze colors --similar --threshold 10 # app mode
# Typography — font families, sizes, weights
bun open-pencil analyze typography design.fig --group-by size
# Spacing — gap and padding values, grid compliance
bun open-pencil analyze spacing design.fig --grid 8
# Clusters — repeated patterns that could be components
bun open-pencil analyze clusters design.fig --min-count 3# Read-only — query the document
bun open-pencil eval design.fig -c 'figma.currentPage.findAll(n => n.type === "TEXT").length'
# App mode — modifies the live document in the editor
bun open-pencil eval -c '
const buttons = figma.currentPage.findAll(n => n.name === "Button");
buttons.forEach(b => { b.cornerRadius = 8 });
buttons.length + " buttons updated"
'
# Modify and save to file
bun open-pencil eval design.fig -w -c '
const texts = figma.currentPage.findAll(n => n.type === "TEXT");
texts.forEach(t => { t.fontSize = 16 });
'
# Save to a different file
bun open-pencil eval design.fig -o modified.fig -c '...'
# Read code from stdin
echo 'figma.currentPage.children.map(n => n.name)' | bun open-pencil eval design.fig --stdinfigmafigma.currentPagefigma.createFrame()figma.createText()figma.getNodeById()--jsonbun open-pencil info design.fig --json
bun open-pencil find --name "Button" --json # app mode
bun open-pencil analyze colors design.fig --json{
"mcpServers": {
"open-pencil": {
"command": "npx",
"args": ["openpencil-mcp"]
}
}
}export PORT=3100
export OPENPENCIL_MCP_AUTH_TOKEN=secret # optional auth
export OPENPENCIL_MCP_CORS_ORIGIN="*" # optional CORS
export OPENPENCIL_MCP_ROOT=/path/to/files # restrict file access
npx openpencil-mcp-httpopen_file { path: "/path/to/design.fig" }new_document {}get_page_treefind_nodesget_nodelist_pagesrenderset_fillset_layoutcreate_shapesave_file { path: "/path/to/output.fig" }get_selectionget_page_treeget_nodefind_nodesget_componentslist_pagesswitch_pageget_current_pagepage_boundsselect_nodeslist_fontscreate_shaperendercreate_componentcreate_instancecreate_pagecreate_vectorcreate_sliceset_fillset_strokeset_effectsupdate_nodeset_layoutset_constraintsset_rotationset_opacityset_radiusset_min_maxset_textset_fontset_font_rangeset_text_resizeset_visibleset_blendset_lockedset_stroke_alignset_text_propertiesset_layout_childdelete_nodeclone_noderename_nodereparent_nodegroup_nodesungroup_nodeflatten_nodesnode_to_componentnode_boundsnode_movenode_resizenode_ancestorsnode_childrennode_treenode_bindingsnode_replace_witharrange_nodeslist_variableslist_collectionsget_variablefind_variablescreate_variableset_variabledelete_variablebind_variableget_collectioncreate_collectiondelete_collectionboolean_unionboolean_subtractboolean_intersectboolean_excludepath_getpath_setpath_scalepath_flippath_moveviewport_getviewport_setviewport_zoom_to_fitexport_svgexport_imageanalyze_colorsanalyze_typographyanalyze_spacinganalyze_clustersdiff_creatediff_showevalopen_filesave_filenew_documentrendereval<Frame name="Card" w={320} h="hug" flex="col" gap={16} p={24} bg="#FFF" rounded={16}>
<Text size={18} weight="bold">Title</Text>
<Text size={14} color="#666">Description text</Text>
<Frame flex="row" gap={8}>
<Frame w={80} h={36} bg="#3B82F6" rounded={8} justify="center" items="center">
<Text size={14} color="#FFF" weight="600">Action</Text>
</Frame>
</Frame>
</Frame>FrameRectangleEllipseTextLineStarPolygonVectorGroupInstance| Prop | Meaning |
|---|---|
| Width, height (number or |
| |
| Item spacing |
| Padding |
| |
| |
| Fill color (hex) |
| Corner radius |
| Stroke color and weight |
| 0–1 |
| Text properties |
session:local1:23findtreenodeinfotree --depth 2find --type COMPONENTanalyze colors --similar--nodeeval--jsoneval