edwingao28/excalidraw-toolkit/excalidraw
Claude Code and agent skill by edwingao28/excalidraw-toolkit
- community
Checking that the SKILL.md file is still in the repository.
Edit saved native Excalidraw diagrams with scoped file operations, or generate diagrams from specified components, a sample, or a description. Use for diagram edits, data flows, parameter traces, and PNG/SVG exports. For codebase discovery, use auto-diagram.
Install
npx vskill@latest install edwingao28/excalidraw-toolkit/excalidrawSKILL.md
Excalidraw Diagram Generator (MCP Edition)
For an existing saved diagram, use the file workflow below. For a new diagram, use the live canvas workflow that follows it.
Edit an existing saved diagram
Load the installed scoped-edit skill when the user asks to modify a saved .excalidraw file, including recoloring or relabeling it. The project installation places it in .claude/skills/scoped-edit/SKILL.md for Claude Code or .agents/skills/scoped-edit/SKILL.md for Codex. Its generated command prefix records the absolute Node and CLI paths; keep those paths unchanged.
Follow that skill's inspect → supported request → edited copy → receipt and PNG inspection workflow. inspect determines the available operations and target restrictions. Report missing installation or an unsupported operation explicitly. Preserve the saved scene and its original bytes; canvas clearing or regeneration does not implement a scoped edit. The remaining steps apply to new live diagrams.
Mental Model
You are placing shapes on a 2D canvas and drawing arrows between them.
Everything is (x, y, width, height). That's it.
The 5 Tools You Actually Need
| Tool | What It Does | When to Use | |
|---|---|---|---|
read_diagram_guide | Returns color palette + sizing rules | First call. Read once, use throughout. | |
batch_create_elements | Create many shapes + arrows at once | Main workhorse. Create your whole diagram in 1-2 calls. | |
get_canvas_screenshot | Take a photo of the current canvas | After every batch. Verify it looks right. | |
clear_canvas | Replace the current scene with an empty canvas | Only when the user explicitly requests replacement of the current canvas. | |
export_to_image | Save as PNG or SVG | Final step if user wants an image file. |
Other useful tools: describe_scene (text description of canvas), create_from_mermaid (quick diagram from Mermaid syntax), export_scene (save as .excalidraw JSON file), set_viewport (zoom/pan to fit), export_to_excalidraw_url (shareable link).
How Shapes Work
A shape has: type, position (x, y), size (width, height), colors, and label text.
Key points:
textputs a label directly inside the shape (MCP handles the binding for you)roughness: 0= clean lines.roughness: 1= hand-drawn look.- Use
\nfor multi-line labels - Shapes:
rectangle,ellipse,diamond,text(standalone)
How Arrows Work
New arrows connect shapes by ID. The MCP creation helper computes endpoint positions; inspect the resulting geometry and screenshot before considering the connection complete.
Key points:
startElementId/endElementId= theidof the shape to connect to- Supply the endpoint shape IDs and the coordinates required by the installed tool schema.
- Binding references alone do not guarantee rerouting after a shape moves. Check arrow points, bound labels, and the rendered result after any geometry change.
textadds a label on the arrowstrokeStyle: "dashed"= async/optional flows."dotted"= weak dependency.startArrowhead/endArrowhead="arrow","dot","triangle","bar", ornull
Step-by-Step Workflow
Step 1: Understand What to Draw
Read the codebase. Identify:
- Components (services, databases, APIs, queues, frontends)
- Connections (which components talk to which, and how)
- Layers (group related components into rows or zones)
Record source paths and relevant line ranges or symbols for code-derived components and connections. Distinguish imports, observed call sites, and assumptions; an import or valid source reference alone does not prove a runtime interaction. State unresolved connections and the inspected scope. Proceed with a clear diagram request; ask only when a material ambiguity prevents selecting the content or target.
When a sample diagram is provided (ASCII art, text mockup, screenshot, etc.):
- Preserve ALL text and detail from the sample by default. Do not simplify, summarize, or omit labels, annotations, bullet points, or sublabels present in the sample.
- Extract every node's full text (titles, subtitles, tool names, metrics, details) and reproduce it verbatim in shape labels using
\nfor multiline. - Preserve section headers, status annotations (e.g. "Fail = Stop & Notify"), and arrow labels exactly as written.
- Size boxes large enough to fit the full text (increase height/width beyond defaults as needed).
- The sample is the source of truth for content — you may improve layout, colors, and styling, but never drop information.
Step 2: Read the Design Guide
This returns the color palette, sizing rules, and layout best practices. Use it.
Step 3: Inspect the Current Canvas
Call query_elements and get_canvas_screenshot before creating elements. Record existing IDs and choose an empty region for the new diagram. Use fresh IDs for this request and preserve unrelated elements.
clear_canvas replaces the entire current scene. Use it only when the user explicitly requests that replacement, then inspect the result before drawing. If the user asks to modify existing live content and its target is ambiguous, resolve the target first; the new-diagram recipe does not authorize replacing it.
Step 4: Plan Your Layout on Paper
Before calling any create tool, sketch the layout mentally:
Step 5: Create Everything in One Batch
Call batch_create_elements with the new diagram's elements, shapes before their arrows. The helper can resolve references to shapes in the same batch. Inspect the response for partial failures; query the request's IDs before retrying so successful elements are not duplicated.
Order of elements in the array:
- Zone backgrounds (large dashed rectangles) — so they render behind everything
- Shapes (rectangles, ellipses, diamonds) — with
idset for arrow references - Arrows — using
startElementId/endElementId - Standalone text labels (titles, annotations)
Step 6: Self-Critique Loop (automatic)
Inspect every generated diagram, including small diagrams. Check geometry and the actual screenshot before delivery, with at most two corrective passes.
6a. Record the affected elements
Limit corrections to the IDs created for this request and record their current values. A snapshot is optional only for a scene exclusively owned by this task. Whole-scene restore replaces other content too; use it only while exclusive ownership and the absence of intervening edits are established. Otherwise, repair the affected fields or report the remaining issue.
6b. Geometric validation (via query_elements)
Check element positions and sizes programmatically:
| Check | Detect | Fix | |
|---|---|---|---|
| Overlapping shapes | Bounding boxes intersect on both axes | Move one element +200px on x or y | |
| Cramped spacing | Edges <100px apart | Shift apart, recalculate zone boundaries | |
| Zone not wrapping children | Zone bounds don't contain all children with 50px padding | Recalculate: leftmost_child_x - 50 to rightmost_child_x + width + 60 | |
| Unconnected shapes | Shape has no arrows referencing its ID (and should) | Add missing arrow or note to user |
6c. Visual validation (via screenshot)
Check for issues requiring visual judgment:
| Check | Detect | Fix | |
|---|---|---|---|
| Arrow labels clipped | Label text cut off or unreadable | Increase gap between connected shapes to 200px+ | |
| Text too small | Labels hard to read | Increase to 16px minimum | |
| Title missing | No diagram title visible | Add text element at y = top_element_y - 60 | |
| Diagram off-center | Content clustered in one corner | set_viewport({ scrollToContent: true }) |
6d. Fix and re-check
Use supported tools to correct only this request's elements, then inspect the geometry and screenshot again. Keep stable IDs. A shape move may require corresponding bound-label and arrow updates; inspect those dependencies explicitly. Avoid delete-and-recreate repairs that silently discard bindings or metadata. If a safe correction is unavailable, retain the result and report the issue.
Constraints:
- Max 2 corrective passes. After 2, deliver the artifacts and state remaining problems. If screenshots cannot be inspected, report visual verification as incomplete.
- Only fix layout/visual issues. Do NOT change architectural content.
- Log what you fixed AND what remains unfixed.
Step 7: Present to User
Show the final screenshot and summarize:
- Components and connections generated
- Auto-fixes applied during self-critique (if any)
- Remaining issues (if any)
- Available next actions (export, refine, drill-down)
Step 8: Export (if requested)
Complete Example: 3-Layer Architecture
This shows exactly what to pass to batch_create_elements:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/excalidraw/skills/excalidraw/SKILL.md
Popularity
- Repository stars
- 134
- Repository forks
- 9
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 30 Apr 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/edwingao28/excalidraw-toolkit/excalidraw)