Brand

Figma

The CLI prepares Figma work for an agent with the Figma MCP tools. It never calls Figma itself: each action writes files and prints the tool calls to make, in order.

Actions

Files go to figma/ (--out changes it). --file <key> works in an existing file and skips the create-file steps. Add --json for the steps as data.

tokens

Every token as a Figma variable in one collection with the Dark and Light modes, typed, scoped to the properties it belongs to and linked to its CSS variable. Writes tokens.json and use_figma scripts, each under the tool's size limit and safe to rerun. On a plan with one mode per collection the script makes one collection per mode.

npx spyglass-ds figma tokens

push

An illustration, an image or slide (any SVG, PNG or JPEG the CLI wrote), a library component preview or a page. A small SVG becomes a use_figma script that imports it as editable layers, its text as text layers in the brand fonts; anything bigger goes through upload_assets; components and pages become self-contained HTML for html_to_figma.

npx spyglass-ds figma push illustration pattern --variant corner

pull

The read steps for a frame: create_session, get_variable_defs and get_design_context, and where to save each result.

npx spyglass-ds figma pull "https://figma.com/design/<fileKey>/<name>?node-id=1-2"

check

Every color, font, text size, radius and spacing in the saved results checked against the tokens. Off-brand values are listed with the nearest token, and the command exits 1 while there are any.

npx spyglass-ds figma check figma/variables-1-2.json figma/design-1-2.txt

A round trip

From the brand into a Figma file and back, with the checks in between.

  1. npx spyglass-ds figma tokens, then run its scripts with use_figma: the file has the brand variables.
  2. npx spyglass-ds image --template post-offer --format svg --out post.svg and npx spyglass-ds figma push asset post.svg: the post arrives as editable layers.
  3. After edits in Figma, npx spyglass-ds figma pull <frame url> names the reads to make and where to save them.
  4. npx spyglass-ds figma check <saved files> lists anything off brand with the nearest token; build with library items and tokens, never the raw values.

Before the first call

The Figma tools want their skills loaded first; the printed steps say which.

  • figma-use before any use_figma call, with figma-generate-library for variables or figma-generate-design for frames.
  • figma-design-to-code before get_design_context.
  • create_session first on every file, its sessionId passed on every later call.