Draw.io Diagrams

Draw.io Diagrams

Teaches an AI agent to write draw.io diagram files in XML and export them to PNG, SVG or PDF with a bundled script.

Skill files3 files

scripts/

SKILL.md97 lines
1
---
2
name: drawio
3
description: Generate draw.io diagrams as .drawio files and export to PNG/SVG/PDF with embedded XML
4
---
5
6
# Draw.io Diagram Skill
7
8
Generate draw.io diagrams as native `.drawio` files and export them to PNG images that can be embedded in Word documents.
9
10
## How to Create a Diagram
11
12
1. **Generate draw.io XML** in `mxGraphModel` format for the requested diagram
13
2. **Write the XML** to a `.drawio` file using the create/edit file tool
14
3. **Export to PNG** using the bundled export script
15
16
## Bundled Export Script
17
18
This skill includes `drawio-to-png.mjs`, a Node.js export script with two rendering backends:
19
20
1. **draw.io CLI** (pixel-perfect, fastest) — used automatically if draw.io desktop is installed
21
2. **Official draw.io viewer in headless browser** (pixel-perfect, needs Chromium/Edge) — fallback when CLI is unavailable
22
23
### Usage
24
25
```bash
26
# Install dependencies (one-time, from the scripts folder)
27
cd skills/drawio/scripts && npm install
28
29
# Export a single diagram
30
node skills/drawio/scripts/drawio-to-png.mjs <input.drawio> [output.png]
31
32
# Export all .drawio files in a directory
33
node skills/drawio/scripts/drawio-to-png.mjs --dir <directory>
34
35
# Force a specific renderer
36
node skills/drawio/scripts/drawio-to-png.mjs --renderer=cli|viewer|auto <input.drawio>
37
```
38
39
### Skill Folder Contents
40
41
| File | Purpose |
42
|------|---------|
43
| `SKILL.md` | This instruction file |
44
| `scripts/drawio-to-png.mjs` | Node.js export script (CLI + browser fallback) |
45
| `scripts/package.json` | Dependencies (`puppeteer-core`) |
46
47
## Supported Export Formats
48
49
| Format | Embed XML | Notes |
50
|--------|-----------|-------|
51
| `png` | Yes | Viewable everywhere, editable in draw.io |
52
| `svg` | Yes | Scalable, editable in draw.io |
53
| `pdf` | Yes | Printable, editable in draw.io |
54
55
## Draw.io XML Style Conventions
56
57
Use these styles for consistent, professional diagrams:
58
59
```xml
60
<!-- Primary service (highlighted) -->
61
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;strokeWidth=2;arcSize=12;shadow=1;" />
62
63
<!-- External system -->
64
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" />
65
66
<!-- Success/processing stage -->
67
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" />
68
69
<!-- Warning/quality gate -->
70
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" />
71
72
<!-- Error/failure path -->
73
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" />
74
75
<!-- Data store (cylinder) -->
76
<mxCell style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" />
77
78
<!-- Arrow -->
79
<mxCell style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#6c8ebf;strokeWidth=2;" />
80
```
81
82
## Locating the draw.io CLI
83
84
Try `drawio` first (works if on PATH), then fall back:
85
86
- **Windows**: `"C:\Program Files\draw.io\draw.io.exe"`
87
- **macOS**: `/Applications/draw.io.app/Contents/MacOS/draw.io`
88
- **Linux**: `drawio` (via snap/apt/flatpak)
89
90
### CLI Export Command
91
92
```bash
93
drawio -x -f png -e -b 10 -o <output.png> <input.drawio>
94
```
95
96
Flags: `-x` (export), `-f` (format), `-e` (embed diagram XML), `-b` (border), `-o` (output path).
97

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 11,985 prompts

More by @OpenSourceBuffGuy

See all
Peeling Object With a Hidden Inner World prompt image

Peeling Object With a Hidden Inner World

Draws a single object frozen mid-peel in space, its curling skin revealing a detailed inner world, with slots for the object and what lives inside.

image-prompt, nano-banana, placeholders, 3d-render, surreal, still-life, macro, exploded-view, dramatic-lighting, soft-lighting, muted-colors, creativity, illustration, whimsical, concept-art, poster, negative-space

Gamer rages at 14 hours of GTA VI download prompt image

Gamer rages at 14 hours of GTA VI download

Generates a 22-second found-footage clip shot on an early-2000s camcorder of a gamer losing his temper over a 14-hour game download, with a reference screenshot on the TV.

video-prompt, home-video, handheld, single-take, vertical-format, vlog, reference-image, video-games, humorous, guardrails, negative-prompt, film-grain, cinematic, timed-beats, lip-sync, short-form-video, seedance, long-form, advanced, for-gamers, camera-movement, pov

Luxury Food Poster Template prompt image

Luxury Food Poster Template

Fills a luxury food advertisement poster template: a hero dessert or drink with floating ingredients, splash effects and styled lighting, with a cheat sheet of options.

image-prompt, gpt-image, template, placeholders, food-photography, poster, photorealistic, product-photography, advertising, luxury, cooking, vertical-format, studio-lighting, motion-blur, macro, vibrant-colors, cheat-sheet, for-marketers, for-photographers, ad-copy, text-rendering, chatgpt, cinematic, for-online-sellers

Reviews

Loading reviews…

Discussion

Loading comments…