用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cyberuni/cyber-figma --skill init-figma命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | init-figma |
| description | Use this skill when setting up cyber-figma — personal access token, team id, connection verify, and MCP wiring. |
When the user is setting up cyber-figma for the first time, or when commands fail with auth, permission, or "team id required" errors.
Before running any cyber-figma command:
npm view cyber-figma version. Use this value as <exact> for every npx cyber-figma@<exact> in this skill and all other cyber-figma skills (never @latest, never a literal placeholder).npx cyber-figma@<exact> --version (or cyber-figma --version if globally installed).If it fails (npx install prompt, command not found, or other non-zero exit):
cyber-figma from npm (no package.json change).npx --yes cyber-figma@<exact> --versionnpx cyber-figma@<exact> <subcommand> (no --yes) or cyber-figma if globally installed.cyber-figma as a devDependency instead. Note drawbacks: it modifies package.json and may need ignoring in unused-dependency tools (e.g. knip). If they decline both, skip CLI steps.Every command inherits these:
| Flag | Effect |
|---|---|
--token <pat> | override FIGMA_ACCESS_TOKEN for this invocation |
--team <id> | override FIGMA_TEAM_ID for this invocation |
--toon | TOON output — token-efficient, prefer it for agents |
--json | raw JSON |
--full | do not truncate large text fields |
Exit codes are stable; branch on them rather than on message text:
| Code | Meaning |
|---|---|
0 | ok |
1 | generic failure |
2 | usage error (unknown flag or subcommand) |
3 | auth / config problem — token missing or invalid |
4 | forbidden — no access, or an expired token |
5 | not found |
6 | rate limited (429) |
7 | plan-gated — the endpoint needs Enterprise (see step 6) |
For the exact resource commands and their flags, run cyber-figma --help and cyber-figma <resource> --help.
echo "Token set: ${FIGMA_ACCESS_TOKEN:+yes}${FIGMA_TOKEN:+ (via FIGMA_TOKEN alias)}"
echo "Team set: ${FIGMA_TEAM_ID:+yes}${FIGMA_TEAM:+ (via FIGMA_TEAM alias)}"
FIGMA_TOKEN and FIGMA_TEAM work as aliases, but new setup should use the canonical names. A value that is literally an unexpanded ${VAR} counts as absent — that is what a host config forwards when the variable is not exported, and it is reported as a missing credential rather than sent to Figma.
If not set, guide the user:
export FIGMA_ACCESS_TOKEN=... in the file their shell loads on loginOr pass per-command with --token <pat>.
Two facts to tell the user up front, because both look like bugs later:
403, not 401. If commands that used to work start failing with a permission error, suspect expiry first.A token never exceeds the user's own Figma permissions, so request the narrowest set that covers the intended work. Prefer the granular scopes over the deprecated, extremely permissive files:read.
| Work the user wants | Scopes |
|---|---|
| Verify the connection | current_user:read |
| Inspect files and nodes | file_content:read, file_metadata:read |
| Browse teams and projects | projects:read, project_metadata:read |
| Export rendered assets | file_content:read |
| Read comments | file_comments:read |
| Post or delete comments | file_comments:write |
| Published components and styles | team_library_content:read (team), library_content:read (file) |
| Version history | file_versions:read |
Ensure the CLI is available first (see Ensure cyber-figma CLI), then run:
cyber-figma user me --toon
# or, if using npx without global install:
npx cyber-figma@<exact> user me --toon
This calls GET /v1/me and prints the authenticated user. (--toon is the token-efficient format; use --json for raw JSON.)
If it fails, the token is invalid, expired, or missing the current_user:read scope.
Plan access tokens cannot call
/v1/meat all. If the user is setting up a plan access token (Organization/Enterprise only, minted by an org admin at https://www.figma.com/developers/tokens), verify with a file-metadata read against a known file instead — see step 5.
Figma provides no way to discover a team id from a token — the user must read it from a URL. Ask them to open the team in Figma and copy the segment after /team/:
https://www.figma.com/files/team/1234567890123456789/Some-Team
^^^^^^^^^^^^^^^^^^^ this
Add it to their shell profile:
export FIGMA_TEAM_ID=<team-id>
This avoids passing --team on every team-scoped command. Verify:
cyber-figma project list --toon
That lists the projects visible to the token holder in that team.
cyber-figma file meta <file-key>
The file key is the segment after /design/ (or the older /file/) in any Figma file URL. A successful metadata read confirms token, scopes, and file access together — and it is the cheapest call in the API (rate-limit tier 3), so it is the safe thing to retry with.
Three gates cause almost all confusing failures. Explain whichever applies:
GET file / GET file nodes / GET image calls per month — on every plan, including Enterprise. If the user's core flow is "read a file", a Dev or Full seat is required for it to be usable at all.429 looks wildly out of proportion, check where the file actually lives.On a 429, read the response headers rather than guessing: Retry-After (seconds), X-Figma-Plan-Tier, X-Figma-Rate-Limit-Type (low = View/Collab seat, high = Dev/Full), and X-Figma-Upgrade-Link.
For AI agents, prefer connecting the cyber-figma MCP server as an ambient, always-available session integration first — then reach for the on-demand skills as needed. Add the cyber-figma MCP server to your host (see readme — MCP Server) and set CYBER_FIGMA_MCP_FORMAT=toon in its env for token-efficient output.
The plugin ships host configs already, so in most hosts installing the plugin is enough. Those configs pass FIGMA_ACCESS_TOKEN and FIGMA_TEAM_ID through from the environment — the variables still have to be exported in step 2 and step 4.
Figma ships its own MCP server, which runs its own OAuth flow and is limited to clients in the Figma MCP Catalog. cyber-figma is not a client of it: it is a REST API wrapper using REST API credentials. The two can coexist under separate config keys.
基于 SOC 职业分类