Loading...
Loading...
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.
npx skill4agent add figma/mcp-server-guide figma-specwhoamifigma.spec.*specs_enabled: truewhoamispecs_enabledSPEC_BLOCKnode-idfigma.getNodeByIdAsynctype === "SPEC_BLOCK"specBlockType === "DOCUMENT"findAllWithCriteria({ types: ['SPEC_BLOCK'] })specBlockType === "DOCUMENT"figma.spec.getContentpage.loadAsync()specNodeId// 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')
}titlecontent''title# H1content// 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.' }],
})
const after = await figma.spec.getContent({ specNodeId: before.specNodeId })
if (!after.markdown.includes('Edited first paragraph.')) {
throw new Error('The targeted Figma spec edit was not applied')
}getContentspecNodeIdeditContentsetContenteditContentoldTextBufferatob()figma.spec.*[comment:<uuid>]…[/comment:<uuid>]localhost<ins><ins>**bold and underlined**</ins><u>setContenteditContentgetContenthttps://<host>/spec/<fileKey>/image/<sha>?w=<width>&h=<height>figma.spec.comments.*const comment = await figma.spec.comments.create({
specNodeId: before.specNodeId,
anchorText: 'the exact rendered text to anchor to', // MUST appear exactly once
contextText: 'a longer unique substring containing anchorText', // optional; disambiguates repeats
message: 'Comment body (markdown).',
})
const { root, replies, hasMore } = await figma.spec.comments.getThread({ uuid: comment.uuid })
await figma.spec.comments.reply({ uuid: comment.uuid, message: 'A reply.' })anchorTextcontextTextgetThreadreply[comment:<uuid>]reply