Draw.io
This is a compact local adaptation of the official
jgraph/drawio-mcp Codex skill. Generate
native .drawio files from Mermaid or Draw.io XML, then optionally apply layout
or export editable PNG, SVG, or PDF files.
Research Routing
- Treat Draw.io as an editable execution backend, not as the authority on
theory, mechanisms, or claims.
- For academic conceptual figures, preserve the semantic graph, render graph,
visible-text allowlist, negative constraints, and issue ledger supplied by
conceptual-figure-workflow and engineering-figure-agent.
- Every arrow must map to an approved semantic edge. Do not invent labels,
feedback loops, causal directions, variables, stages, or evidence.
- Use
nature-figure for empirical maps, statistical charts, and exact
quantitative panels.
For the meaning of approved nodes and edges, read semantic approval scope. Directly supported semantics do not require an extra approval round; new or conflicting scientific assertions still require a user decision.
Workflow
- Read the reviewed figure contract or establish the requested non-academic
diagram structure.
- Detect whether the Draw.io Desktop CLI is available.
- Choose an authoring route:
- Mermaid for standard flowcharts, sequence/class/state/ER diagrams,
timelines, mind maps, C4 diagrams, and other supported types when the
Desktop CLI is available.
- Draw.io XML for precise placement, custom styling, special shape libraries,
or any machine without the Desktop CLI.
- Create a native
.drawio file first.
- For XML, optionally apply one layout pass:
verticalFlow or horizontalFlow for pipelines
verticalTree, horizontalTree, or radialTree for hierarchies
organic for networks
libavoid only to reroute edges without moving nodes
- Validate XML structure and audit labels, nodes, and arrows against the figure
contract.
- Deliver the native
.drawio source. When requested and the Desktop CLI is
available, also export PNG, SVG, or PDF with embedded diagram XML.
- Report absolute source and export paths. Do not silently flatten an editable
research figure because optional export tooling is unavailable.
Authoring Rules
- Mermaid must be converted to
.drawio before export. Do not export .mmd
directly to an embedded PNG/SVG/PDF.
- Prefer XML when scientific labels, ports, edge direction, or topology must be
exact.
- Keep the
.drawio source as the primary editable artifact even after export.
- Match diagram labels to the user's requested language.
- Use concise labels and ensure the figure remains readable at its intended
publication size.
- Do not apply both ELK and
libavoid to the same result; ELK already routes its
edges.
Critical XML Rules
- Start with an
mxGraphModel containing root cells id="0" and id="1".
- Escape
&, <, >, and quotes in attribute values.
- Use a unique ID for every
mxCell.
- Give every edge a child
<mxGeometry relative="1" as="geometry" />.
- Do not include XML comments in generated diagram files.
- Validate XML well-formedness before opening or exporting.
References
Read only what is needed:
references/cli-export-and-troubleshooting.md: Desktop CLI discovery,
conversion, layout, export, URL delivery, and common failures.
- Official Mermaid reference:
https://raw.githubusercontent.com/jgraph/drawio-mcp/main/shared/mermaid-reference.md
- Official Draw.io XML reference:
https://raw.githubusercontent.com/jgraph/drawio-mcp/main/shared/xml-reference.md
Minimal Commands
Convert Mermaid to native Draw.io:
drawio -x -f xml -o diagram.drawio diagram.mmd
Apply an XML layout:
drawio -x -f xml --layout horizontalFlow -o diagram.drawio diagram.drawio
Export with editable XML embedded:
drawio -x -f svg -e -b 10 -o diagram.drawio.svg diagram.drawio
When the Desktop CLI is unavailable, author Draw.io XML directly and deliver
the .drawio file. Node.js may still be used for the optional browser-URL route.
1---2name: drawio3description: Create or edit native Draw.io diagrams and optionally export editable PNG/SVG/PDF files. Use when the user explicitly requests Draw.io or an editable diagram, or when engineering-figure-agent selects Draw.io for a reviewed, label-heavy conceptual framework, mechanism diagram, architecture, workflow, ER diagram, sequence diagram, network diagram, or other topology-sensitive figure. For unreviewed academic conceptual figures, use conceptual-figure-workflow first; use nature-figure for statistical plots and maps.4---56# Draw.io78This is a compact local adaptation of the official9[`jgraph/drawio-mcp`](https://github.com/jgraph/drawio-mcp) Codex skill. Generate10native `.drawio` files from Mermaid or Draw.io XML, then optionally apply layout11or export editable PNG, SVG, or PDF files.1213## Research Routing1415- Treat Draw.io as an editable execution backend, not as the authority on16 theory, mechanisms, or claims.17- For academic conceptual figures, preserve the semantic graph, render graph,18 visible-text allowlist, negative constraints, and issue ledger supplied by19 `conceptual-figure-workflow` and `engineering-figure-agent`.20- Every arrow must map to an approved semantic edge. Do not invent labels,21 feedback loops, causal directions, variables, stages, or evidence.22- Use `nature-figure` for empirical maps, statistical charts, and exact23 quantitative panels.2425For the meaning of approved nodes and edges, read [semantic approval scope](../engineering-figure-agent/references/figure-brief-spec.md#meaning-of-approved-semantics). Directly supported semantics do not require an extra approval round; new or conflicting scientific assertions still require a user decision.2627## Workflow28291. Read the reviewed figure contract or establish the requested non-academic30 diagram structure.312. Detect whether the Draw.io Desktop CLI is available.323. Choose an authoring route:33 - Mermaid for standard flowcharts, sequence/class/state/ER diagrams,34 timelines, mind maps, C4 diagrams, and other supported types when the35 Desktop CLI is available.36 - Draw.io XML for precise placement, custom styling, special shape libraries,37 or any machine without the Desktop CLI.384. Create a native `.drawio` file first.395. For XML, optionally apply one layout pass:40 - `verticalFlow` or `horizontalFlow` for pipelines41 - `verticalTree`, `horizontalTree`, or `radialTree` for hierarchies42 - `organic` for networks43 - `libavoid` only to reroute edges without moving nodes446. Validate XML structure and audit labels, nodes, and arrows against the figure45 contract.467. Deliver the native `.drawio` source. When requested and the Desktop CLI is47 available, also export PNG, SVG, or PDF with embedded diagram XML.488. Report absolute source and export paths. Do not silently flatten an editable49 research figure because optional export tooling is unavailable.5051## Authoring Rules5253- Mermaid must be converted to `.drawio` before export. Do not export `.mmd`54 directly to an embedded PNG/SVG/PDF.55- Prefer XML when scientific labels, ports, edge direction, or topology must be56 exact.57- Keep the `.drawio` source as the primary editable artifact even after export.58- Match diagram labels to the user's requested language.59- Use concise labels and ensure the figure remains readable at its intended60 publication size.61- Do not apply both ELK and `libavoid` to the same result; ELK already routes its62 edges.6364## Critical XML Rules6566- Start with an `mxGraphModel` containing root cells `id="0"` and `id="1"`.67- Escape `&`, `<`, `>`, and quotes in attribute values.68- Use a unique ID for every `mxCell`.69- Give every edge a child `<mxGeometry relative="1" as="geometry" />`.70- Do not include XML comments in generated diagram files.71- Validate XML well-formedness before opening or exporting.7273## References7475Read only what is needed:7677- `references/cli-export-and-troubleshooting.md`: Desktop CLI discovery,78 conversion, layout, export, URL delivery, and common failures.79- Official Mermaid reference:80 `https://raw.githubusercontent.com/jgraph/drawio-mcp/main/shared/mermaid-reference.md`81- Official Draw.io XML reference:82 `https://raw.githubusercontent.com/jgraph/drawio-mcp/main/shared/xml-reference.md`8384## Minimal Commands8586Convert Mermaid to native Draw.io:8788```bash89drawio -x -f xml -o diagram.drawio diagram.mmd90```9192Apply an XML layout:9394```bash95drawio -x -f xml --layout horizontalFlow -o diagram.drawio diagram.drawio96```9798Export with editable XML embedded:99100```bash101drawio -x -f svg -e -b 10 -o diagram.drawio.svg diagram.drawio102```103104When the Desktop CLI is unavailable, author Draw.io XML directly and deliver105the `.drawio` file. Node.js may still be used for the optional browser-URL route.