Catalog
github/drawio

github

drawio

Generate draw.io diagrams as .drawio files and export to PNG/SVG/PDF with embedded XML

v1.0Latest
New~797Updated Jun 26, 2026

Draw.io Diagram Skill

Generate draw.io diagrams as native .drawio files and export them to PNG images that can be embedded in Word documents.

How to Create a Diagram

  1. Generate draw.io XML in mxGraphModel format for the requested diagram
  2. Write the XML to a .drawio file using the create/edit file tool
  3. Export to PNG using the bundled export script

Bundled Export Script

This skill includes drawio-to-png.mjs, a Node.js export script with two rendering backends:

  1. draw.io CLI (pixel-perfect, fastest) — used automatically if draw.io desktop is installed
  2. Official draw.io viewer in headless browser (pixel-perfect, needs Chromium/Edge) — fallback when CLI is unavailable

Usage

# Install dependencies (one-time, from the scripts folder)
cd skills/drawio/scripts && npm install

# Export a single diagram
node skills/drawio/scripts/drawio-to-png.mjs <input.drawio> [output.png]

# Export all .drawio files in a directory
node skills/drawio/scripts/drawio-to-png.mjs --dir <directory>

# Force a specific renderer
node skills/drawio/scripts/drawio-to-png.mjs --renderer=cli|viewer|auto <input.drawio>

Skill Folder Contents

File Purpose
SKILL.md This instruction file
scripts/drawio-to-png.mjs Node.js export script (CLI + browser fallback)
scripts/package.json Dependencies (puppeteer-core)

Supported Export Formats

Format Embed XML Notes
png Yes Viewable everywhere, editable in draw.io
svg Yes Scalable, editable in draw.io
pdf Yes Printable, editable in draw.io

Draw.io XML Style Conventions

Use these styles for consistent, professional diagrams:

<!-- Primary service (highlighted) -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;strokeWidth=2;arcSize=12;shadow=1;" />

<!-- External system -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" />

<!-- Success/processing stage -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" />

<!-- Warning/quality gate -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" />

<!-- Error/failure path -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" />

<!-- Data store (cylinder) -->
<mxCell style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" />

<!-- Arrow -->
<mxCell style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#6c8ebf;strokeWidth=2;" />

Locating the draw.io CLI

Try drawio first (works if on PATH), then fall back:

  • Windows: "C:\Program Files\draw.io\draw.io.exe"
  • macOS: /Applications/draw.io.app/Contents/MacOS/draw.io
  • Linux: drawio (via snap/apt/flatpak)

CLI Export Command

drawio -x -f png -e -b 10 -o <output.png> <input.drawio>

Flags: -x (export), -f (format), -e (embed diagram XML), -b (border), -o (output path).

Files3
3 files · 12.9 KB

Select a file to preview

Overall Score

82/100

Grade

B

Good

Safety

85

Quality

80

Clarity

85

Completeness

75

Summary

This skill enables agents to generate draw.io diagrams in native `.drawio` XML format and export them to PNG/SVG/PDF using a bundled Node.js script. The script supports two rendering backends: the draw.io CLI (if installed) and a headless browser fallback using puppeteer-core. Diagrams are exported with embedded XML, making them editable in draw.io after export.

Detected Capabilities

file write (.drawio files)file read (.drawio files)shell execution (node command)npm install (dependency management)external command invocation (draw.io CLI or Chromium/Edge)directory traversal and batch processing

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

generate draw.io diagramexport diagram to pngcreate architecture diagrambuild flowchart visualdrawio xml generationdiagram batch export

Risk Signals

INFO

Node.js script execution with external CLI tool fallback

scripts/drawio-to-png.mjs design
INFO

Chromium/Edge browser invocation via puppeteer-core

scripts/package.json, SKILL.md
INFO

Directory traversal with --dir flag for batch export

SKILL.md line 'node skills/drawio/scripts/drawio-to-png.mjs --dir'
INFO

npm install required as setup step

SKILL.md line 'cd skills/drawio/scripts && npm install'

Use Cases

  • Create architecture diagrams and export as PNG for documentation
  • Generate flowcharts and sequence diagrams as editable .drawio files
  • Produce exportable diagrams (PNG/SVG/PDF) for Word documents and presentations
  • Build consistent system diagrams using provided draw.io style conventions
  • Batch export multiple .drawio files to images for automation workflows

Quality Notes

  • Skill clearly documents two rendering backends with fallback logic
  • Excellent style convention examples for consistent diagram styling
  • Comprehensive file manifest and folder structure documentation
  • Setup instructions are clear and include platform-specific paths for draw.io CLI
  • Supported export formats clearly documented with embedding capabilities
  • Batch processing support via --dir flag enables automation workflows
  • Package.json is minimal and only includes necessary dependency (puppeteer-core)
  • The export script design (CLI-first, browser fallback) is pragmatic and well-reasoned
  • No documented error handling or edge cases (e.g., missing dependencies, invalid diagrams)
  • Could benefit from troubleshooting guide for dependency installation and renderer selection
Model: claude-haiku-4-5-20251001Analyzed: Jun 26, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Use github/drawio in your dev environment

Command Palette

Search for a command to run...