figma-spec
БесплатноБез исполняемых скриптовНе проверенThis skill is required to create, read, edit, review, or comment on Figma specs. You must read it when working on a PRD, brief, RFC or any kind of document in…
от figma★ 2 252 звезды на GitHubОб этом скилле
Work with a Figma spec
Check that figma.spec is defined in your first use_figma script; it exists only when the file’s plan has Specs enabled. If it is undefined, explain that Specs is not enabled for this file’s plan and stop the workflow. To create a new standalone Figma spec file, call whoami to choose a destination plan, then call create_new_file with editorType: "figspec" and that plan's key as planKey. If it reports that Figma Specs is not available on that plan, offer the user's other plans or stop.
A native Figma spec is GitHub-Flavored Markdown (GFM) under a SPEC_BLOCK node. A standalone Figma spec is just one spec; a FigJam or Design file can contain several embedded specs.
Discover and choose the Figma spec
Resolve a supplied URL node-id when present with figma.getNodeByIdAsync and require type === "SPEC_BLOCK" plus specBlockType === "DOCUMENT". Otherwise, search the current page with findAllWithCriteria({ types: ['SPEC_BLOCK'] }), filtering for specBlockType === "DOCUMENT" (and examine content with figma.spec.getContent if needed) until you find your target. If it's not on the current page, load other pages one at a time with page.loadAsync() and repeat your query, stopping once the target is resolved.
Pass the resolved root ID to every content call. Omit specNodeId only when the file is known to contain exactly one Figma spec; omission throws otherwise. Never edit ordinary canvas text nodes as a fallback.
Create a Figma spec on a canvas
// Creates an embedded Figma spec on a Design or FigJam canvas (not a standalone Figma spec file).
const { specNodeId } = await figma.spec.createOnCanvasAsync({
title: 'Untitled spec',
content: '# Title\n\nA paragraph.\n',
})
const specNode = await figma.getNodeByIdAsync(specNodeId)
if (!specNode) throw new Error('The created Figma spec could not be resolved')
const after = await figma.spec.getContent({ specNodeId })
if (!after.markdown.includes('A paragraph.')) {
throw new Error('The new Figma spec content was not applied')
}
Always pass a non-empty title and a content string ('' is allowed). title names the root; include any desired # H1 in content.
Content methods
// READ — returns specNodeId, markdown, title, etc.
// The body is `markdown`, not `content`.
const before = await figma.spec.getContent({ specNodeId: chosenSpec.id })
const page = await figma.spec.getContent({
specNodeId: before.specNodeId,
offset: 100,
maxLines: 50,
})
// REPLACE — clears + recreates the document; use only for an empty first draft.
await figma.spec.setContent({
specNodeId: before.specNodeId,
content: '# Title\n\nA paragraph.\n',
})
// EDIT — find/replace; each oldText must match exactly once.
await figma.spec.editContent({
specNodeId: before.specNodeId,
edits: [{ oldText: 'First paragraph.', newText: 'Edited first paragraph.' }],
})
// PATTERN EDIT — a regex literal; with `g` it replaces every match, without `g` exactly one.
await figma.spec.editContent({
specNodeId: before.specNodeId,
edits: [{ pattern: '/^### /gm', newText: '## ' }],
})
const after = await figma.spec.getContent({ specNodeId: before.specNodeId })
return { applied: after.markdown.includes('Edited first paragraph.') }
- Use
getContentwith the samespecNodeIdbefore edits and to verify writes; DON'T rely on screenshots. - Default to multiplayer-safe, surgical
editContent. - Use destructive
setContentonly for an empty first draft or an explicit whole-document replacement.
Critical rules
- Change every match with one
gpattern. For "all"/"every" requests, use a singlepatternedit with thegflag instead of anoldTextper target, then confirm none of the old pattern remains. - Each
oldText, and eachpatternwithoutg, must match exactly once. Zero or multiple matches fail without changes; add surrounding context to make it unique. Apatternwithgmust match at least once. Each edit hasoldTextorpattern, plusnewText. - Pass Markdown as plain strings. Never encode it with
Buffer/base64 or decode it withatob(). Base64 is only for image data URLs inside Markdown. - Keep Markdown and traversal separate.
figma.spec.*handles content; node traversal exposes only document roots and embedded-canvas branches. - Preserve comment markers. Keep overlapping
[comment:<uuid>]…[/comment:<uuid>]pairs unchanged around the same text, or the thread may detach or disappear. When in doubt copy the marked span exactly and edit around it. - Use portable references. Shared Figma specs must use links such as GitHub permalinks, never machine-local paths or
localhostURLs.
Edit patterns
- Verify within the edited section, since removed words often appear elsewhere. Return the check's result instead of throwing; a throw discards the edit.
- Tables: replace the whole table in one edit and copy the header cells you keep exact
Установить figma-spec в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл figma-spec?
This skill is required to create, read, edit, review, or comment on Figma specs. You must read it when working on a PRD, brief, RFC or any kind of document in either a standalone Figma spec or a Figma spec embedded in a Figma Design or Figjam file.
Как установить скилл figma-spec?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл figma-spec запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic