skills/diagram-generator/excalidraw-generator/SKILL.md
Generate diagrams as valid Excalidraw JSON — flowcharts, architecture, ER diagrams, mind maps, sequence diagrams, wireframes, C4 models, and more. Don't use for draw.io/Mermaid output, slide decks, or pixel-perfect brand graphics.
npx skillsauth add luongnv89/skills excalidraw-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate professional diagrams as valid Excalidraw JSON. Every diagram goes through four phases: Understand the request, Propose options, Generate the JSON, and Validate before writing the file.
Part of the diagram-generator suite. For precise, editable-in-draw.io output, use
drawio-generatorinstead; thediagram-generatorumbrella routes between the two.
This SKILL.md is intentionally compact to fit the agent's context budget (token-efficient body). Long-form details live in references/ — read the linked file when you need depth.
Triggers/exclusions are set by the frontmatter description above. Output is an Excalidraw file, or embedded in Markdown via the excalidraw fenced block if the user asks for that.
If the Agent tool is available, use the subagent review loop described in references/style-and-iteration.md (Subagent Architecture). It provides fresh-context validation and avoids single-pass context overflow.
If the Agent tool is unavailable (e.g., Claude.ai), execute every phase inline and self-review against the 10 checks (less rigorous, but functional).
Confirm what to draw before generating anything.
Present a plan with selectable options:
references/diagram-types.md for the catalogue. If multiple fit, present numbered options.(A) Top-to-bottom, (B) Left-to-right, (C) Radial).references/style-and-iteration.md. Pick rendering style (clean/hand-drawn/sketchy) and color scheme that fits the diagram's purpose. No fixed palette.Wait for confirmation. If the user says "just do it" or the request is straightforward, use sensible defaults (hand-drawn, roughness 1, Virgil font, best-fit layout) and proceed.
Write a .excalidraw file (raw JSON, no wrapper) in the current working directory. Use kebab-case names (auth-flow.excalidraw). The required envelope:
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [],
"appState": { "theme": "light", "viewBackgroundColor": "#ffffff" },
"files": {}
}
Set theme and viewBackgroundColor to whatever suits the diagram. For full element schema and field defaults, see references/excalidraw-format.md.
Embedding in Markdown: if the user asks to embed the diagram in a .md file, write the .excalidraw first, then a companion .md that references it via a fenced block tagged excalidraw containing the same JSON.
Before writing the file, run all 10 checks on the in-memory JSON. Fix and re-check until all pass. Full check definitions and fix recipes are in references/validation-checks.md. Quick summary:
boundElements, seed, etc.). Text adds text/fontSize/fontFamily/textAlign/verticalAlign/containerId/originalText/lineHeight/autoResize. Arrows add points/startBinding/endBinding/startArrowhead/endArrowhead.containerId ↔ boundElements {type:"text"}.startBinding/endBinding ↔ boundElements {type:"arrow"}.points length ≥ 2 and points[0] === [0,0].fontSize ≥ 16, visible strokeColor, lineHeight: 1.25 (never 1.35), autoResize: true.For every text element with containerId:
line_count = text.split('\n').lengthmin_text_height = line_count * fontSize * 1.25min_shape_height = min_text_height + 40 (20px padding top/bottom)height must be >= min_shape_height.width must be >= longest_line_pixel_width + 20.Boundary/container labels (e.g., "System Boundary") must be standalone text with containerId: null, positioned near the top-left of the container — never bound to it.
Fix: increase the shape's height/width to fit the text and shift elements below it to keep spacing. Always set lineHeight: 1.25 and autoResize: true on text. Never patch individual outputs — fix this skill's instructions if a new failure pattern emerges.
After all checks pass, emit the validation summary (10/10 passed, element counts, binding counts, "all shapes sized to fit", any auto-fixes applied).
After each phase, output a status block. Templates and check labels for each phase live in references/step-reports.md. Result line is PASS | FAIL | PARTIAL.
For "draw a flowchart of the user login process": file login-flow.excalidraw containing valid Excalidraw JSON, plus a validation summary in the response. Example fragment:
{
"type": "excalidraw", "version": 2, "source": "https://excalidraw.com",
"elements": [
{"id": "start-1", "type": "ellipse", "x": 300, "y": 40, "width": 120, "height": 56,
"boundElements": [{"id": "txt-start", "type": "text"}]},
{"id": "txt-start", "type": "text", "text": "Start", "fontSize": 18, "fontFamily": 1,
"containerId": "start-1", "lineHeight": 1.25, "autoResize": true}
],
"appState": {"theme": "light", "viewBackgroundColor": "#ffffff"}, "files": {}
}
Expected response includes:
Validation: 10/10 checks passed
- Elements: 6 shapes, 6 text labels, 5 arrows
- Bindings: 6 text bindings, 10 arrow bindings (all two-way)
- Text fits: all shapes sized to fit their bound text
- No overlaps, no missing fields
references/style-and-iteration.md; cap at 3 fix cycles.See references/style-and-iteration.md for extended edge cases, iteration patterns, and style variants.
type, version, elements, appState, files.references/validation-checks.md Check 2).fontSize >= 16, lineHeight: 1.25, autoResize: true.containerId ↔ boundElements).startBinding/endBinding ↔ boundElements).points[0] === [0,0] and length ≥ 2.Full catalogue with layout guidance: references/diagram-types.md. Categories: Flow & Process, Architecture, Data & Relationships, Planning, Comparison, Data Viz, UX/Design, Custom. If the request doesn't map cleanly to one type, propose the closest fit and explain why.
references/validation-checks.md — full text of all 10 Phase-4 checks plus fix recipes.references/excalidraw-format.md — Excalidraw JSON schema and field defaults.references/diagram-types.md — diagram-type catalogue with layout guidance.references/style-and-iteration.md — style variants, iteration patterns, subagent architecture, extended edge cases.references/step-reports.md — step completion report templates per phase.agents/json-generator.md, agents/json-validator.md, agents/json-fixer.md — subagent specs for the large-diagram review loop.tools
Run Herdr loops for one open GitHub issue (resolve→review→fix) or an existing PR (review→lazy fixer) until CLEAN. Don't use for plain resolution without review, review-only/no-fix requests, backlog automation, or merging.
tools
Manage AI agent fleets in Herdr: split root + sub-agents into one tab as a tiled grid, message/wait/read via herdr CLI, steer any pane. Use for Herdr multi-agent fleets. Don't use for tmux, screen, or non-Herdr terminals.
development
Generate or update docs to match the code, citing each claim to path:line and asking on ambiguity; runbook docs also get a check-only validation script. Don't use for API-reference autogen (JSDoc/Sphinx), landing pages, or CLAUDE.md/AGENTS.md.
testing
Generate a diagram and route to the right engine — draw.io XML (precise, editable, C4, swimlanes) or Excalidraw JSON (hand-drawn, sketch, wireframes). One entry for flowcharts, architecture, ER, sequence, mind maps. Don't use for Mermaid or slides.