Author a canvas
Dry-run, fix analyzer warnings, commit with the echoed specHash. Preview URL on the web app.
Dry-run, fix analyzer warnings, commit with the echoed specHash. Preview URL on the web app. This is the first write call in the canonical sequence.
The flow
- Write your HTML (use design-system classes, fire both completion calls).
- Call
canvas_createwithdryRun: true. - Check the response for analyzer warnings and errors. Fix any
severity: "error"issues. - Open the
previewUrlin a browser. Verify the canvas looks right. - Call
canvas_createagain withdryRun: falseand the echoedspecHash. - Store the returned
canvasIdforskill_write.
Shell
# Step 1: dry-run
canvas_create({
name: "Evening reflection",
html: "<!doctype html><html>...</html>",
dryRun: true
})
# Returns: { specHash: "abc123...", previewUrl: "https://...", issues: [...] }
# Step 2: commit with the echoed specHash
canvas_create({
name: "Evening reflection",
html: "<!doctype html><html>...</html>",
dryRun: false,
specHash: "abc123..."
})
# Returns: { canvasId: "757c5bb0-...", previewUrl: "https://..." }Analyzer warnings
The dry-run response includes an issues array. Common ones:
- Missing SproutBridge.postMessage (error): the dual-completion wart. Add the legacy bridge call.
- Hardcoded hex color (warning): use design-system tokens instead.
- External script reference (error): CSP blocks it. Inline everything.
- Canvas too large (error): 1MB limit. Compress images or simplify.
Always read
sprout://canvas/sdk before writing canvas HTML. The SDK reference has the latest completion call signatures and signal types.
Further reading
Was this page helpful?
Wrap a skill