Loading...
Loading...
Capture a rendered local web page or app screen into the clipboard for pasting into Figma using the official html-to-design capture.js flow. Use when the user invokes /figma-capture, asks to copy the current browser page to Figma, asks for a dev-only Figma capture button, or asks whether figma_key/captureId is needed for Figma HTML capture.
npx skill4agent add djalmajr/skills figma-capture$ARGUMENTSbodyhttps://mcp.figma.com/mcp/html-to-design/capture.jsawait window.figma.captureForDesign({
delayMs: 250,
selector: "body",
})figma_keycaptureIdendpointselector"body"CLAUDE.mdAGENTS.md| Decision point | Why structured | Suggested options |
|---|---|---|
| Capture target when ambiguous | Affects what enters the clipboard | current page · provided URL · provided selector |
| Add persistent project UI | Writes app code | one-off console capture · dev-only button |
bodybodycapture.jswindow.figma?.captureForDesignwindow.figma.captureForDesign({ selector, delayMs: 250 })await new Promise((resolve, reject) => {
if (window.figma?.captureForDesign) {
resolve()
return
}
const script = document.createElement("script")
script.src = "https://mcp.figma.com/mcp/html-to-design/capture.js"
script.onload = resolve
script.onerror = () => reject(new Error("Failed to load Figma capture script"))
document.head.appendChild(script)
})
await window.figma.captureForDesign({
delayMs: 250,
selector: "body",
})capture.jswindow.figma.captureForDesign({ selector: "body", delayMs: 250 })localStoragefigma_keyconst FIGMA_CAPTURE_SCRIPT_ID = "figma-capture-script"
const FIGMA_CAPTURE_SCRIPT_SRC =
"https://mcp.figma.com/mcp/html-to-design/capture.js"
async function loadFigmaCaptureScript() {
if (window.figma?.captureForDesign) {
return
}
const existingScript = document.getElementById(FIGMA_CAPTURE_SCRIPT_ID)
if (existingScript) {
await new Promise((resolve, reject) => {
existingScript.addEventListener("load", resolve, { once: true })
existingScript.addEventListener("error", reject, { once: true })
})
return
}
await new Promise((resolve, reject) => {
const script = document.createElement("script")
script.id = FIGMA_CAPTURE_SCRIPT_ID
script.src = FIGMA_CAPTURE_SCRIPT_SRC
script.onload = resolve
script.onerror = () => reject(new Error("Failed to load Figma capture script"))
document.head.appendChild(script)
})
}
async function captureForFigma() {
await loadFigmaCaptureScript()
await window.figma?.captureForDesign?.({
delayMs: 250,
selector: "body",
})
}Windowdeclare global {
interface Window {
figma?: {
captureForDesign?: (options: {
delayMs?: number
selector?: string
verbose?: boolean
}) => Promise<{ error?: string; success?: boolean } | void>
}
}
}#figmacapture=...&figmaselector=...endpointcaptureIddelayMs: 500