openai/skills

figma-use

按Plugin API规则精确操作Figma节点

  • SKILL.md 已保存
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

figma-use 是什么?

通过use_figma在Figma文件上下文执行JavaScript,读取或创建修改页面、节点、变量和组件。它提供Plugin API调用与状态管理规则,重点处理字体加载、颜色范围、页面切换、布局顺序和真实节点ID返回。

中文说明由本站依据来源整理;英文原文保留在页面下方。

适合用在

  • 工作需要在 Figma 文件上下文中调用 Plugin API 读取或写入节点、变量、样式、组件,且将由 use_figma 工具执行 JavaScript。

这些情况不适合

  • 未接通 Figma MCP,却希望单靠安装 Skill 访问或修改 Figma 文件;Skill 提供调用规范,不提供账号和工具连接。
按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 figma-use,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 figma-use

请在 Codex 的当前工作环境中安装并检查 figma-use 这个 Skill。

项目身份:openai/skills / figma-use
来源:https://github.com/openai/skills/blob/49f948faa9258a0c61caceaf225e179651397431/skills/.curated/figma-use/SKILL.md
已定位的源文件:skills/.curated/figma-use/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 可调用use_figma的MCP与实际文件权限;明确只读检查还是改哪些对象,先读本版本API索引和相关类型/模式参考。

会得到什么

  • 实际查询数据或受影响节点ID,以及结构和视觉核对结果。

实际使用顺序

  1. 先只读盘点现有页面、组件和命名,定位真实节点;每次调用重新选择实际目标页面。
  2. 小步写脚本,await异步API,用return返回结构化数据与所有受影响ID;颜色用0到1、文字先加载字体,FILL等布局在挂到父节点后设置。
  3. 每步用metadata与截图分别核对结构和视觉;错误先理解再修改脚本,恢复时重新发现对象,不猜测节点ID。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

教学示例:用figma-use只读列出我指定Figma文件各页面的组件与组件集名称和ID。先读API索引,逐页await切换并返回有限数据,不创建节点、不detach实例、不修改变量;不能依赖console.log作为返回结果。
预期结果

预期得到带真实ID的结构清单;本站未调用Figma。

使用前先看这些限制

使用条件与边界

  • 这是特定use_figma运行环境的规则,不代表任意Figma插件都具备相同限制;源称失败调用原子性,本站未在当前服务验证该保证。
针对这个 Skill 的疑问

常见问题

为什么第二次调用找错页面?

来源说明每次调用页面上下文重置,应在每次脚本开始明确切换目标页。

用console.log能返回结果吗?

这份来源要求return数据;console.log不作为Agent可见结果,创建或修改后还必须返回对象ID。

需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

skills/.curated/figma-use/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

**MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context — e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically.

查看源文件章节 / Source sections
  • 原文:use_figma — Figma Plugin API Skill
  • 原文:1. Critical Rules
  • 原文:2. Page Rules (Critical)
  • 原文:Switching pages
  • 原文:Across script runs
  • 原文:3. `return` Is Your Output Channel
  • 原文:4. Editor Mode
  • 原文:5. Incremental Workflow (How to Avoid Bugs)
  • 原文:The pattern
  • 原文:Suggested step order for complex tasks
  • 原文:What to validate at each step
  • 原文:6. Error Recovery & Self-Correction
  • 原文:When `use_figma` returns an error
  • 原文:Common self-correction patterns
  • 原文:When the script succeeds but the result looks wrong
  • 原文:7. Pre-Flight Checklist
  • 原文:8. Discover Conventions Before Creating
  • 原文:Quick inspection scripts
  • 原文:9. Reference Docs
  • 原文:10. Snippet examples
原文:use_figma — Figma Plugin API Skill

Use `use_figma` MCP to execute JavaScript in Figma files via the Plugin API. All detailed reference docs live in `references/`. **Always pass `skillNames: "figma-use"` when calling `use_figma`.** This is a logging parameter used to track skill usage — it does not affect execution. **If the task involves building or updating a full page, screen, or multi-section layout in Figma from code**, also load [figma-generate-design](../figma-generate-design/SKILL.md). It provides the workflow for discovering design system components via `search_design_system`, importing them, and assembling screens incrementally. Both skills work together: this one for the API rules, that one for the screen-building workflow. Before anything, load [plugin-api-standalone.index.md](references/plugin-api-standalone.index.md) to understand what is possible. When you are asked to write plugin API code, use this context to grep [plugin-api-standalone.d.ts](references/plugin-api-standalone.d.ts) for relevant types, methods, and properties. This is the definitive source of truth for the API surface. It is a large typings file, so do not load it all at once, grep for relevant sections as needed. IMPORTANT: Whenever you work with design systems, start with [working-with-design-systems/wwds.md](references/working-with-design-systems/wwds.md) to understand the key concepts, processes, and guidelines for working with design systems in Figma. Then load the more specific references for components, variables, text styles, and effect styles as needed.

原文:1. Critical Rules

1. **Use `return` to send data back.** The return value is JSON-serialized automatically (objects, arrays, strings, numbers). Do NOT call `figma.closePlugin()` or wrap code in an async IIFE — this is handled for you. 2. **Write plain JavaScript with top-level `await` and `return`.** Code is automatically wrapped in an async context. Do NOT wrap in `(async () => { ... })()`. 3. `figma.notify()` **throws "not implemented"** — never use it 3a. `getPluginData()` / `setPluginData()` are **not supported** in `use_figma` — do not use them. Use `getSharedPluginData()` / `setSharedPluginData()` instead (these ARE supported), or track node IDs by returning them and passing them to subsequent calls. 4. `console.log()` is NOT returned — use `return` for output 5. **Work incrementally in small steps.** Break large operations into multiple `use_figma` calls. Validate after each step. This is the single most important practice for avoiding bugs. 6. Colors are **0–1 range** (not 0–255): `{r: 1, g: 0, b: 0}` = red 7. Fills/strokes are **read-only arrays** — clone, modify, reassign 8. Font **MUST** be loaded before any text operation: `await figma.loadFontAsync({family, style})` 9. **Pages load incrementally** — use `await figma.setCurrentPageAsync(page)` to switch pages and load their content (see Page Rules below) 10. `setBoundVariableForPaint` returns a **NEW** paint — must capture and reassign 11. `createVariable` accepts collection **object or ID string** (object preferred) 12. **`layoutSizingHorizontal/Vertical = 'FILL'` MUST be set AFTER `parent.appendChild(child)`** — setting before append throws. Same applies to `'HUG'` on non-auto-layout nodes. 13. **Position new top-level nodes away from (0,0).** Nodes appended directly to the page default to (0,0). Scan `figma.currentPage.children` to find a clear position (e.g., to the right of the rightmost node). This only applies to page-level nodes — nodes nested inside other frames or auto-layout containers are positioned by their parent. See [Gotchas](references/gotchas.md). 14. **On `use_figma` error, STOP. Do NOT immediately retry.** Failed scripts are **atomic** — if a script errors, it is not executed at all and no

本段为节选,完整内容见源文件。

原文:2. Page Rules (Critical)

**Page context resets between `use_figma` calls** — `figma.currentPage` starts on the first page each time.

原文:Switching pages

Use `await figma.setCurrentPageAsync(page)` to switch pages and load their content. The sync setter `figma.currentPage = page` **throws an error** in `use_figma` runtimes. ```js // Switch to a specific page (loads its content) const targetPage = figma.root.children.find((p) => p.name === "My Page"); await figma.setCurrentPageAsync(targetPage); // targetPage.children is now populated // Iterate over all pages for (const page of figma.root.children) { await figma.setCurrentPageAsync(page); // page.children is now loaded — read or modify them here } ```

原文:Across script runs

`figma.currentPage` resets to the **first page** at the start of each `use_figma` call. If your workflow spans multiple calls and targets a non-default page, call `await figma.setCurrentPageAsync(page)` at the start of each invocation. You can call `use_figma` multiple times to incrementally build on the file state, or to retrieve information before writing another script. For example, write a script to get metadata about existing nodes, `return` that data, then use it in a subsequent script to modify those nodes.

原文:3. `return` Is Your Output Channel

The agent sees **ONLY** the value you `return`. Everything else is invisible. - **Returning IDs (CRITICAL)**: Every script that creates or mutates canvas nodes **MUST** return all affected node IDs — e.g. `return { createdNodeIds: [...], mutatedNodeIds: [...] }`. This is a hard requirement, not optional. - **Progress reporting**: `return { createdNodeIds: [...], count: 5, errors: [] }` - **Error info**: Thrown errors are automatically captured and returned — just let them propagate or `throw` explicitly. - `console.log()` output is **never** returned to the agent - Always return actionable data (IDs, counts, status) so subsequent calls can reference created objects

文件 SHA256:afa9c4ae068a18b93e4914b2d224180ace113db7713dd66f4df397f16ba9c4b4

仓库许可证记录:未提供;not-established,查看来源。

SKILL.md原文description · 2026-11-16T12:36:35.145Z

**MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context — e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically.

查看历史简介来源

历史收录数据

来源仓库openai/skills
Skill源路径skills/.curated/figma-use/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源