Figma Generative Plugins

作者 figmaf0493295acf5无许可证2K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库3天前更新

**MANDATORY prerequisite** — load this skill before calling `create_generative_plugin` or `update_generative_plugin`. Use when the user asks to create, author, change, fix, or extend a reusable generative Figma plugin.

AI 生成的概览

指导通过创建与更新插件工具来编写和更新可复用的生成式 Figma 插件。

功能
该技能定义了创建或修改生成式 Figma 插件的工作流:确认请求适用于 Figma Design 编辑器环境、解析 planKey、创建脚手架、读取脚手架源码、用完整的自编文件替换它,并通过更新工具提交结果。它还涵盖更新处理、编写规则(如 UI 要求与密钥处理),以及包含在新 Design 文件中试用插件链接的完成报告。最终产出是一个可运行的插件,包含 TypeScript 入口文件以及可选的 UI 文件。
适用场景
在调用创建或更新生成式插件工具之前使用,或在用户要求创建、编写、更改、修复或扩展可复用的生成式 Figma 插件时使用。它也适用于用所需的插件行为和 UI 替换生成的脚手架。
运行要求
需要 Figma 插件编写工具(create、get、update、list 和 whoami)以及 planKey。它不附带脚本,但引用了一份随附的编写文档。插件在 Figma Design 编辑器中运行,且不得嵌入 API 密钥或令牌等机密信息。

Create and update generative Figma plugins

Load this skill before every create_generative_plugin or update_generative_plugin call. In user-facing language, call the result a “plugin.” The “generative” qualifier only distinguishes this account-library tool from other plugin systems.

Preflight

Before authoring, confirm the request fits this surface:

  • Plugins run in the Figma Design editor.
  • Every plugin must provide functional UI for its core workflow. A plugin with no configurable inputs still needs a clear primary action and useful status or validation feedback.
  • Never embed API keys, OAuth tokens, signed URLs, or other secrets. Plugin source is readable by people who can access it. For authenticated integrations, stop and offer a static dataset, a public no-auth endpoint, or a different architecture.

Create workflow

  1. Resolve the requested workflow and its useful controls. Ask a concise question only if required inputs or behavior are genuinely ambiguous.
  2. Resolve planKey. Reuse one supplied by the user; otherwise call whoami. Use the sole eligible plan automatically, or ask the user to choose when several materially different plans are available.
  3. Call create_generative_plugin once with a concise name, description, and planKey. This creates a runnable square-drawing scaffold, not the requested final plugin.
  4. Call get_generative_plugin with the returned id, then read every source URI. This establishes the scaffold's manifest, UI message contract, and current TypeScript entrypoint.
  5. Replace the scaffold with complete authored files for the requested behavior and UI.
  6. Call update_generative_plugin with the returned id, a files array containing complete replacements for code.ts and, when the UI changes, ui.html, plus a specific commitMessage. Use metadata when changing the name or description.

Never stop after create_generative_plugin: the starter must be replaced with the requested experience.

Update workflow

  1. Identify the plugin. If needed, call list_generative_plugins, then get_generative_plugin.
  2. Read every source URI returned by the get tool before editing. Treat those files as the current source of truth.
  3. Preserve existing UI, controls, relaunch behavior, validation, and user-visible affordances unless the user asks to change them.
  4. Call update_generative_plugin with complete replacement content for every changed existing file. Use { path: "code.ts", content: "..." } for the entrypoint and { path: "ui.html", content: "..." } for the UI. Unspecified files are preserved.

Authoring rules

  • Before writing replacement files, read Plugin source authoring [blocked]. It covers the file replacement contract, UI/message lifecycle, PropsKit controls, dynamic-page compatibility, fonts, relaunch behavior, bounded work, geometry, and Plugin API gotchas.
  • Keep the plugin’s primary action obvious and make invalid selection or input states understandable.
  • update_generative_plugin can replace existing code.ts and ui.html files, but cannot replace manifest.json or create new files. Keep figma.showUI(__html__, ...) in code.ts and replace ui.html when the requested workflow needs different controls.
  • Avoid destructive canvas changes unless they are the explicit purpose of the plugin and the UI makes that clear.
  • Do not close before asynchronous work and UI messages have completed.
  • Treat a non-error update_generative_plugin result as success. Record the returned version when present; a successful response may omit it.
  • On a build error, use the returned compiler output to make the smallest source correction and retry once. If it still fails, surface the error instead of repeatedly rewriting the plugin.

Completion

Report the plugin name and id, plus the returned version when present and a short description of its UI and primary action. Construct and include a clickable URL that opens a new Design file with the unpublished plugin ready to try, using the exact plugin id as try-tool-resource-content-id:

https://www.figma.com/file/new?try-tool-resource-content-id=<id>&try-tool-resource-type=gen_tool&type=design&mode=design

After presenting the new-file link, ask whether the user wants to open the plugin in an existing Figma Design file instead. If yes, reuse a file URL already provided or ask for one, then add the same try-tool-resource-content-id and try-tool-resource-type query parameters to that URL. Never guess the file URL.

来源与署名

来源:figma/mcp-server-guide位于skills/figma-generative-plugins提交f049329

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架