/canvasanvil-canvas:diagram-skillfrom canvasanvil-canvas
Creates and edits draw.io diagrams in a live editor. Handles new diagrams, local XML edits, shape-library diagrams, and truncated XML continuation.
Ships in canvasanvil-canvas. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use when the user asks for a diagram, flowchart, architecture diagram, network diagram, ER diagram, BPMN diagram, or a cloud/infrastructure diagram, or mentions draw.io, diagrams.net, drawio, or a .drawio file.
.drawio file (a scratch file if file writes are limited).scripts/validate-drawio-xml.mjs.scripts/check-layout.mjs. Fix every error it reports and run it again, keeping the arrangement while fixing.projectDir, or reuse the one already open. Read get_diagram_state before editing.set_diagram_xml for new diagrams or explicit relayouts, edit_diagram for local cell changes, and append_diagram for truncated XML as described below. Read the latest revision before a new request. Use a stable operation ID for each call and reuse it for transport retries. A corrected XML payload or changed operation set uses a new operation ID. Poll pending operations until applied or failed. Manual edits synchronize back into the project.The same tools exist on two paths; use the first that is available.
MCP tools (canvasanvil_canvas, from the CanvasAnvil plugin): call render_diagram_widget. Showing it to the user is your job, in this order: (1) a host that renders MCP App widgets shows the editor in the conversation; (2) otherwise open the returned browserUrl yourself, right away, in the host's built-in browser or preview pane where the user can see it; (3) if you have no such tool, call render_diagram_widget again with launch: true to open the user's default browser; (4) hand the URL to the user only if all of that fails. The result's next repeats this.
Command line (no plugin needed; this folder carries the runtime in runtime/, Node 20+):
node <skill-dir>/runtime/scripts/canvas.mjs open diagram <projectDir>
It prints the editor's url (http://127.0.0.1:…). Open it yourself in the host's built-in browser or preview pane; if you have no such tool, run the command again with --launch to open the user's default browser. Give the URL to the user only if both fail. Then run every tool below as
node <skill-dir>/runtime/scripts/canvas.mjs call <tool> @args.json
with the same arguments as a JSON file (projectDir included). It prints the tool's JSON result. canvas.mjs tools lists the tools.
On both paths the editor page must stay open: it applies queued changes with the website's code and saves the user's manual edits. Nothing changes on the canvas while it is closed.
prompts/display.md
prompts/edit.md
prompts/append.md
prompts/router.md
references/xml-rules.mdreferences/layout-rules.mdreferences/edit-rules.mdreferences/shape-library-index.mdreferences/shape-libraries/<library>.mdRead the library file before generating any library-backed diagram.
Do not guess undocumented shape-library prefixes or shape names.
<mxGraphModel> with <root>.mxCell is written flat inside <root>; nesting is expressed with parent.<mxCell id="0"/><mxCell id="1" parent="0"/>0 and 1 are reserved, never used for a shape or an edge.container=1 (or swimlane), with members using parent="<group id>" and coordinates relative to the group.parent="1", and their source and target must reference existing ids.The editor reuses the website layout engine. New diagrams try light tidying and ELK optimization, retaining a result that meets the website score and arrangement-preservation gates. Local edits tidy only rows containing changed cells. Give the model a coherent initial layout using references/layout-rules.md.
flow-down, flow-right, flow-up, tree-down, tree-right, mindmap, swimlane, sequence, timeline, free, or auto when none of them fits or you are unsure (the editor then picks the correction itself).<name>.drawio when file writes are available.export_diagram for drawio, SVG or PNG. Poll get_editor_operation for its actual saved file path.runtime/ supplies the editor and its tools. The draw.io editor loads from https://embed.diagrams.net, with an initial-load fallback to the official https://jgraph.github.io/drawio/src/main/webapp/index.html mirror, and needs network access.The user gives instructions in the chat and may edit the diagram by hand between them. A newly installed or updated plugin may need a host restart before its MCP tools load; the command line works without it.
Read get_diagram_state immediately before a modification or export. Its document.xml and immutable documentPath contain saved manual edits. Use the returned revision as baseRevision. Preserve unrelated cells, IDs and layout. Reuse the open widget while commands run. A pending command needs the widget open and responsive. If it remains pending, report that condition instead of claiming success. A revision conflict requires rereading the current document and adapting the change.
Call export_diagram with format (drawio, svg, png), baseRevision and a new stable operationId when a file is needed. Read get_editor_operation with editor="diagram" to get the file path. State is stored under <projectDir>/diagram/.
Read get_diagram_state after application. Its document.layoutCorrection records original and corrected XML, mode, layout, method, scores and moved/straightened counts. Report actual results and remaining issues. The correction finishes before the command is marked applied. Saved manual edits and restored documents load as saved.
For a new diagram or explicitly requested relayout, call set_diagram_xml with xml, baseRevision, a new stable operationId, mode="create" and the declared layout. The widget runs the website's wrapWithMxFile and validateAndFixXml, then corrects layout before loading and saving the final diagram. Read document.xmlFixes from get_diagram_state for the actual XML repairs. Unrepairable errors fail the operation and preserve the saved document.
For a local edit, read the current XML and call edit_diagram with baseRevision, a stable operationId and ordered operations. Each operation has operation (add, update, delete) and cell_id; add/update also require new_xml containing exactly one matching mxCell. The widget uses the website's applyDiagramOperations, including removing descendants and connected edges on deletion. It tidies only rows containing the added or updated IDs. Read the resulting state after completion.
If set_diagram_xml returns awaiting_append, continue from its exact next character using append_diagram. Pass that operation ID as draftId, the continuation as xml, the original baseRevision, and a new stable operationId for the chunk. A retry of that chunk reuses the same operation ID. If the chunk also returns awaiting_append, use its ID as the next draftId. The draft is saved in the project and survives MCP restarts. The canvas changes only after the combined XML is complete, validated, repaired and layout-corrected.
Do not repeat wrappers or root cells during continuation. A continued operation names its nextOperationId; a superseded draft has been replaced by a newer request. A revision conflict means the user changed the canvas during generation. Read the new state and regenerate against that revision. Poll get_editor_operation only once the final chunk is pending, and report success only after applied.
The scripts live in this skill's own folder and need only Node, with no install step. In the commands, <skill-dir> is the folder that holds this SKILL.md. Use its absolute path, so the commands work from any working directory.
scripts/validate-drawio-xml.mjs: structure (root cells, unique ids, parents, edge ends)scripts/check-layout.mjs: layout (overlaps, groups, edges through shapes, text fit); prints a score and exits 1 on errorsscripts/build-drawio-url.mjsvendor/pako_deflate.min.cjs (compression only, no install step)If the user specifies an output directory or file path, write the .drawio file there.
If the user does not specify an output location, create a new output folder automatically and write the .drawio file there.
Do not write generated artifacts into the skill folder.
Report the actual changes and any validation errors. Link requested files after their export operation is applied.
agents/openai.yaml (opens in a new tab)package.json (opens in a new tab)prompts/append.md (opens in a new tab)prompts/display.md (opens in a new tab)prompts/edit.md (opens in a new tab)prompts/router.md (opens in a new tab)references/edit-rules.md (opens in a new tab)references/layout-rules.md (opens in a new tab)references/shape-libraries/README.md (opens in a new tab)references/shape-libraries/alibaba_cloud.md (opens in a new tab)references/shape-libraries/android.md (opens in a new tab)references/shape-libraries/arrows2.md (opens in a new tab)references/shape-libraries/atlassian.md (opens in a new tab)references/shape-libraries/aws4.md (opens in a new tab)references/shape-libraries/azure2.md (opens in a new tab)references/shape-libraries/basic.md (opens in a new tab)references/shape-libraries/bpmn.md (opens in a new tab)references/shape-libraries/cabinets.md (opens in a new tab)references/shape-libraries/cisco19.md (opens in a new tab)references/shape-libraries/citrix.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
drawio, diagrams, flowcharts, architecture-diagrams, diagrams-net
npx claudepluginhub codingfeng101/canvasanvil --plugin canvasanvil-canvas4 skills in this plugin
/cad-skillHome interior design in a live house designer (2D / 3D / furniture / MEP / ceilings / quote / drawing set) the user can also edit by hand; every model change starts from the user's latest saved version. From an existing floor plan (image, PDF, DXF, CAD) it reconstructs the plan; from a brief it first settles a design plan with the user as clickable decisions, describes the layout as a grid with intent and lets programs draw it; MEP is laid out, the wiring preferences applied, checks and a room-by-room MEP audit run, and exports are produced. Shown in the conversation where the host renders MCP App widgets, otherwise opened by the agent in the built-in browser or the user's default browser. Use for home layout, renovation design, floor plan to designer./canvas-skillOpen and use CanvasAnvil's native Excalidraw canvas, generate images with the host image tool (or the configured image API when the host has none), and revise selected images from drawn annotations./ppt-skillMake presentations the way CanvasAnvil's PPT workspace does -- pick a template from the bundled library, then build the deck from an idea, from an outline, or by beautifying an existing PPT/PDF; review and adjust the outline with the user before anything is drawn; draw all slides concurrently, redraw failures, edit single slides; export PDF, image PPTX or editable PPTX. Also makes template backgrounds on their own and exports existing slides.Other plugins' skills for the same job