← 返回 Skills 市场
Figma Plugin Writer
作者
Zoe Addamssance
· GitHub ↗
· v1.0.0
· MIT-0
343
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install figma-plugin-writer
功能描述
自动生成和更新 Figma 插件的 code.js 以创建和修改设计元素,用户更新代码后需手动运行插件执行。
使用说明 (SKILL.md)
Figma Plugin Writer
Write plugin code (code.js) to automate design in Figma files. After updating the code, notify the user to run the plugin.
Prerequisites
The user must provide:
- Plugin directory — folder containing
code.jsandmanifest.json - Code file — typically
code.js - Target Figma file — optional, for context
Workflow
- Receive design requirements from the user
- Write plugin code to
code.js - Notify user:
Plugins → Development → \x3Cplugin-name> - Iterate based on feedback
API Reference
Font Loading (required before creating text)
await figma.loadFontAsync({ family: "Inter", style: "Regular" });
await figma.loadFontAsync({ family: "Inter", style: "Medium" });
await figma.loadFontAsync({ family: "Inter", style: "Semi Bold" });
await figma.loadFontAsync({ family: "Inter", style: "Bold" });
Frame (Container)
var frame = figma.createFrame();
frame.name = "MyFrame";
frame.resize(width, height);
frame.cornerRadius = 12;
frame.fills = [{ type: "SOLID", color: { r: 1, g: 1, b: 1 } }];
frame.x = 0;
frame.y = 0;
Text
var text = figma.createText();
text.characters = "Hello World";
text.fontSize = 16;
text.fontName = { family: "Inter", style: "Regular" };
text.fills = [{ type: "SOLID", color: { r: 0, g: 0, b: 0 } }];
Rectangle
var rect = figma.createRectangle();
rect.resize(100, 50);
rect.fills = [{ type: "SOLID", color: { r: 0.9, g: 0.2, b: 0.2 } }];
rect.cornerRadius = 8;
Nesting Nodes
frame.appendChild(text);
parentPage.appendChild(frame);
Drop Shadow
frame.effects = [{
type: "DROP_SHADOW",
color: { r: 0, g: 0, b: 0, a: 0.1 },
offset: { x: 0, y: 4 },
radius: 12,
spread: 0,
visible: true,
blendMode: "NORMAL",
}];
Stroke
frame.strokes = [{ type: "SOLID", color: { r: 0.8, g: 0.8, b: 0.8 } }];
frame.strokeWeight = 1;
Text Alignment
text.textAlignHorizontal = "CENTER"; // LEFT | CENTER | RIGHT | JUSTIFIED
text.textAlignVertical = "CENTER"; // TOP | CENTER | BOTTOM
Auto Layout (inside Frame)
frame.layoutMode = "VERTICAL"; // or "HORIZONTAL"
frame.primaryAxisAlignItems = "CENTER"; // MIN | CENTER | MAX | SPACE_BETWEEN
frame.counterAxisAlignItems = "CENTER";
frame.paddingTop = 16;
frame.paddingBottom = 16;
frame.paddingLeft = 16;
frame.paddingRight = 16;
frame.itemSpacing = 8;
Page Navigation
var pages = figma.root.children;
var targetPage = pages[pages.length - 1];
await figma.setCurrentPageAsync(targetPage);
Clear Page Content
var old = targetPage.children.slice();
for (var i = 0; i \x3C old.length; i++) {
old[i].remove();
}
Viewport
figma.viewport.scrollAndZoomIntoView([frame]);
Notifications
figma.notify("Done!", { timeout: 3000 });
figma.notify("ERROR: " + e.message, { timeout: 10000 });
Page Info
var pages = figma.root.children;
var count = pages.length;
var pageName = pages[0].name;
Code Template
async function main() {
try {
// 1. Load fonts
await figma.loadFontAsync({ family: "Inter", style: "Regular" });
await figma.loadFontAsync({ family: "Inter", style: "Bold" });
// 2. Get target page
var pages = figma.root.children;
var target = pages[pages.length - 1];
await figma.setCurrentPageAsync(target);
// 3. Clear old content
var old = target.children.slice();
for (var i = 0; i \x3C old.length; i++) old[i].remove();
// 4. Create design...
var frame = figma.createFrame();
frame.name = "Screen";
frame.resize(375, 812);
frame.fills = [{ type: "SOLID", color: { r: 1, g: 1, b: 1 } }];
frame.x = 0;
frame.y = 0;
target.appendChild(frame);
// 5. Done
figma.viewport.scrollAndZoomIntoView([frame]);
figma.notify("Design complete!", { timeout: 3000 });
} catch (e) {
figma.notify("ERROR: " + e.message, { timeout: 10000 });
}
}
main();
Pitfalls & Gotchas
documentAccess: "dynamic-page" Mode
If manifest.json has "documentAccess": "dynamic-page":
- ❌
figma.currentPage = page→ ✅await figma.setCurrentPageAsync(page) - ❌
figma.getNodeById()→ ✅await figma.getNodeByIdAsync() - ❌
figma.closePlugin()→ ✅await figma.closePluginAsync()
Error Handling
- Always wrap code in
try-catch - Show errors via
figma.notify("ERROR: " + e.message, { timeout: 10000 }) - Do not use emoji in text content (font may not support the glyph)
- Do not call
figma.closePlugin()automatically (let user close manually)
Free Tier Limits
- Max 3 Pages — do not create new Pages
- Work within existing Pages (clear and rebuild)
Fonts
- Default: Inter (built into Figma)
- Supported styles: "Regular", "Medium", "Semi Bold", "Bold"
- Colors use
{ r, g, b }format with 0-1 range
Iteration Pattern
On each design iteration:
- Clear old elements:
page.children.slice().forEach(c => c.remove()) - Recreate design with changes
- Notify user to re-run the plugin
安全使用建议
This skill appears to do what it says: generate code.js snippets and examples to create UI elements inside Figma. Before using: (1) review any generated code — it will clear and rebuild page content, so back up your Figma pages if you care about existing work; (2) remember you must paste the code into your plugin directory and run the plugin manually in Figma; (3) check the manifest settings (documentAccess and networkAccess) if you modify them — network access should remain restricted unless you explicitly need it; (4) do not run code from untrusted sources in production files. Overall the package is coherent and contains only example plugin code and guidance.
功能分析
Type: OpenClaw Skill
Name: figma-plugin-writer
Version: 1.0.0
The figma-plugin-writer skill bundle provides instructions and templates for generating Figma plugin code to automate UI design tasks. The SKILL.md and example JavaScript files (01-basic-screen.js, 02-design-system.js, etc.) use standard Figma API calls for UI creation and explicitly restrict the agent from performing file management or network requests. The manifest.json template further enforces security by setting network access to 'none', and no evidence of malicious intent, data exfiltration, or harmful prompt injection was found.
能力评估
Purpose & Capability
Name/description match the contents: the skill provides templates, API snippets, and examples for writing a Figma plugin's code.js. It does not request unrelated credentials, binaries, or config paths.
Instruction Scope
SKILL.md instructs writing/overwriting code.js and includes examples that clear a page's children (remove existing content) and set the current page. That is coherent with generating plugin-driven designs but is destructive to existing page content — users should expect and approve that behavior before running generated code.
Install Mechanism
Instruction-only skill with no install spec and no downloaded code; lowest-risk install posture. Example files are included as benign templates.
Credentials
No environment variables, secrets, or external credentials are requested. The manifest example sets documentAccess: dynamic-page and networkAccess allowedDomains to ["none"], consistent with the stated non-networked plugin behavior.
Persistence & Privilege
always is false and the skill does not request permanent presence or attempt to change other skills or global agent config. It only produces code the user must place and run manually.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install figma-plugin-writer - 安装完成后,直接呼叫该 Skill 的名称或使用
/figma-plugin-writer触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Major documentation overhaul for clarity and conciseness (SKILL.md rewritten in English).
- Better structure: clearer prerequisites, workflow, and explicit API/code example sections.
- Rules, best practices, and iteration patterns are now listed in a concise, step-by-step manner.
- Removed README.md; all setup and instructional info is consolidated in SKILL.md.
- No code/logic changes; examples remain, but doc organization and guidance are now much more user-friendly.
v0.1.0
- Initial release of Figma Plugin Writer skill.
- Provides workflow guidance for automating Figma designs via plugin code.
- Includes usage instructions, required user configurations, and comprehensive Figma Plugin API code snippets.
- Outlines error handling, compatibility notes, and best practices for reliable plugin code updates.
- Encourages iterative workflows based on user feedback and plugin reruns.
元数据
常见问题
Figma Plugin Writer 是什么?
自动生成和更新 Figma 插件的 code.js 以创建和修改设计元素,用户更新代码后需手动运行插件执行。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 343 次。
如何安装 Figma Plugin Writer?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install figma-plugin-writer」即可一键安装,无需额外配置。
Figma Plugin Writer 是免费的吗?
是的,Figma Plugin Writer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Figma Plugin Writer 支持哪些平台?
Figma Plugin Writer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Figma Plugin Writer?
由 Zoe Addamssance(@zerozlw)开发并维护,当前版本 v1.0.0。
推荐 Skills