npx skills add ...
npx skills add bahayonghang/drawio-skills --skill drawio
Create, edit, replicate, import, and export draw.io diagrams with an offline YAML-first workflow: architecture, network topologies, flowcharts, UML/ER, org charts, Mermaid/CSV conversion, existing .drawio bundles, style presets, themes, and non-publication formula diagrams. For publication figures (paper, thesis, IEEE, camera-ready) use drawio-academic-skills instead.
npx skills add bahayonghang/drawio-skills --skill drawio
Create, edit, validate, replicate, import, and export draw.io diagrams through a YAML-first offline workflow. It is the single maintained base for sibling overlays and owns the local CLI, schemas, references, themes, palettes, examples, style presets, and export helpers.
Use this base skill for general draw.io work: software/system architecture; network topologies and infrastructure maps; flowcharts, swimlanes, process maps, and org charts; UML class/sequence/state/ER; Mermaid and CSV conversion; structured redraw and non-academic replication; formula-bearing technical diagrams; .drawio import, sidecar export, and local validation.
For paper, thesis, IEEE, journal, manuscript, or publication-ready figure requests, route to the sibling drawio-academic-skills overlay; the base does not apply academic publication gates. Without the overlay, render the local YAML bundle but report that overlay policy was not applied.
Use the lightest path that satisfies the request:
.drawio plus the default delivered image, a 300dpi PNG via draw.io Desktop (standalone SVG fallback)..drawio.svg on explicit request..mcp.json (pinned @next-ai-drawio/mcp-server@0.4.13, fetched over the network by npx; see references/docs/mcp-tools.md); offline authoring never reads it.The optional MCP/live backend is a refinement provider only. Never required for normal authoring, editing, import, replication, or export.
Choose the route first, then load only that route's references. All paths below live under references/; the reusable YAML example catalog is references/examples/README.md.
create — new diagram from text, YAML, Mermaid, CSV, or a concise spec → workflows/create.md, docs/design-system/README.md, docs/design-system/specification.mdconfig-import — declared Terraform, Kubernetes, Compose, SQL DDL, OpenAPI, GitHub Actions, or GitLab CI architecture → docs/config-importers.md, docs/canonical-graph-projection.mdlive-drift — compare explicit Terraform state/plan JSON, Docker inspect JSON, or Kubernetes live JSON against a declared projection without capture → docs/live-snapshots-drift.md, docs/canonical-graph-projection.md, workflows/visual-review.mdcode-import — Python module/class, JavaScript/TypeScript ESM, Go package, or Rust module relationships from a local project directory → docs/code-importers.md, docs/canonical-graph-projection.mdmulti-page — create, import, validate, or transform bundle v1 pages with stable page/object identity and structured links → docs/upstream-capability-compatibility.md, docs/xml-format.mdraster-replicate — normalize a trusted structured visual extraction through --input-format raster-extraction before canonical rendering → workflows/replicate.md, docs/upstream-capability-compatibility.mdlocal-image — embed local PNG/JPEG files as atomic image nodes through top-level assets and node.image → docs/local-image-assets.mdpostprocess — project or transform canonical YAML/Draw.io with offline mermaid, explain, relabel, restyle, heatmap, or script-free html → docs/upstream-capability-compatibility.mdarchitecture — system/software architecture, microservice or cloud-service maps with role-based color coding, plus AI agent / RAG / memory diagrams(架构、微服务、云架构、agent、RAG、记忆、multi-agent、工具调用;非拓扑、非论文)→ workflows/create.md, docs/architecture-diagrams.md, docs/agent-diagrams.md, docs/design-system/README.mdedit — modify an existing sidecar bundle or imported .drawio → workflows/edit.md, docs/migration-readiness.mdreplicate — redraw an uploaded image, screenshot, SVG, or reference diagram → workflows/replicate.md, docs/design-system/README.md, docs/design-system/specification.md, docs/design-system/color-guide.mdpalette — palette, colorblind safety, grayscale/black-and-white printing, or multi-category distinction → docs/design-system/color-guide.md, docs/design-system/themes.md, docs/design-system/specification.md, examples/palettes/README.mdmath-formula — formulas, equations, LaTeX, AsciiMath, MathJax, or Chinese formula keywords → docs/math-typesetting.md, docs/design-system/formulas.mdstencil-heavy — cloud, AI brand, SysML, BPMN, network gear, or exact draw.io shape work → docs/stencil-library-guide.md, docs/upstream-capability-compatibility.md, official/xml-reference.md, official/style-reference.mdnetwork-topology — network topology, VLAN / subnet / gateway, campus / data-center / cloud network maps(拓扑、子网、网关、VLAN)→ docs/ieee-network-diagrams.md, docs/stencil-library-guide.md, official/xml-reference.mdedge-audit — dense or routing-sensitive diagrams → docs/edge-quality-rules.md, official/xml-reference.mdvisual-review — inspect an exported artifact, record issues, or apply targeted rework → workflows/visual-review.mdlive-refinement — explicit browser/inline visual refinement → docs/mcp-tools.md, docs/migration-readiness.mddirect-xml — tiny XML-only handoff or raw mxGraph edits → official/xml-reference.md, official/style-reference.md, docs/xml-format.md, upstream/pure-drawio-skill.mdUse network-topology when the diagram is a network/infrastructure map; use stencil-heavy when the focus is provider icons or exact draw.io shapes in any diagram type.
.drawio files normalize into YAML before rendering.<name>.drawio and a 300dpi <name>.png (standalone SVG fallback when Desktop is unavailable); keep sidecars such as <name>.spec.yaml and <name>.arch.json in a project-local work directory such as .drawio-tmp/<name>/.references/workflows/visual-review.md; complete each round only after validation, preview inspection, and previous-blocker review.start_session, read_diagram_xml, or patch capabilities are unavailable, edit the offline YAML bundle instead of blocking.$$...$$ for standalone formulas, \(...\) for inline formulas, and AsciiMath backticks. Never $...$, \[...\], or bare LaTeX commands.meta.replication, reference page size in meta.canvas, standalone text/formula boxes in bounds, and off-line connector labels in labelOffset. Do not deliver a rebuild as one full-page embedded reference image..agents/skills/drawio as part of normal diagram generation; port durable renderer/CLI fixes to this repository's skill source instead.fillColor=none;strokeColor=none;labelBackgroundColor=none); vertical CJK labels are one character per line ("可\n视\n化"), never horizontal=0. Hard rules: references/docs/design-system/tokens.md § Text & Label Styling.source/target node ids; never standalone arrow shapes), no-waypoint orthogonal edges must be collinear (--validate flags avoidable bends), and arrows default to a bold open head (endArrow=open;endSize=12). Filled block/diamond heads only on explicit request or for UML/ER semantics. Full rules: references/docs/edge-quality-rules.md.mxgraph.* icons, search the bundled catalog before writing YAML: node scripts/cli.js search <keyword>. Unknown names in covered libraries are rejected with suggestions; --allow-unknown-shapes is a temporary escape hatch only.meta.palette.horizontal, vertical, hierarchical, star, mesh, tiered — details in references/docs/design-system/specification.md).--validate also reports node/edge crossings and total edge length):Use --strict/--strict-warnings for release-grade review.
Register local PNG/JPEG files under top-level assets and reference them with node.image (never node.icon, and never style.image). Paths are relative to the asset root (cwd or --asset-root), not to the spec file. The renderer inlines data:image/png;base64, (or JPEG) into a shape=image cell. SVG files and multi-page bundles with assets are hard errors. Size diagnostics (warning above 2 MiB, error above 8 MiB per asset or 24 MiB citation-weighted total) point at references/docs/local-image-assets.md. Foreign .drawio images without this skill's metadata require --extract-assets <dir>.
Prefer editing the sidecar bundle. If only a .drawio file exists, import it first, edit the generated .spec.yaml, then regenerate:
Write beside-output sidecars only when the user asks for a reproducible editing bundle.
For /drawio replicate (uploaded images or screenshots): extract structure, palette, and text-placement intent; represent position-sensitive titles, captions, formulas, callouts, and edge labels explicitly; set meta.source: replicated; render and self-check text positions against the exported PNG (or fallback SVG) before claiming completion. Playbook: references/workflows/replicate.md.
PNG/PDF/JPG and embedded .drawio.svg exports require draw.io Desktop (--use-desktop; --dpi defaults to 300); without it the PNG export falls back to a standalone .svg (stderr warning) so you still deliver .drawio plus an image. For browser handoff:
The diagram content is encoded in the URL fragment after #R and is not sent as a server query parameter.
Bundled style presets live under styles/built-in/; user presets live outside the repository, e.g. ~/.drawio-skill/styles/ or an overlay-specific user directory. Resolve preset names user-first (user directory before styles/built-in/); an unknown preset name is an error, never a silent fallback.
To learn a reusable preset from an existing diagram and render an approval sample, follow references/docs/style-extraction.md. Copy-paste style strings: references/docs/style-presets.md.
Never mutate bundled presets. Copy a bundled preset to the user preset directory before making it the default or editing it.
Theme and palette are independent: theme owns typography, spacing, shapes, line styles, modules, and canvas; meta.palette optionally replaces semantic/category colors. Omitting meta.palette preserves the selected theme byte-for-byte.
Ask only when the request mentions palette/color choice, colorblind safety, grayscale or black-and-white printing, or multi-category distinction and does not name a palette. Then use AskUserQuestion as a single-select: offer 3-4 relevant palettes, put the best fit first with (Recommended), use each palette's displayName as the label, and summarize colorblind/grayscale safety plus intended use in the description. If the user already specified a palette, apply it directly and do not ask.
For replicate, preserve source colors by default and do not ask for a palette. Ask only when the user explicitly requests normalization or a replacement palette; record that choice in meta.replication.colorMode and set meta.palette only for the normalized result.
Bundled palette metadata and previews: assets/palettes/ and references/examples/palettes/. User palettes live under ~/.drawio-skill/palettes/; an explicit invalid palette is an error, never a silent fallback.
Validate before claiming completion:
references/workflows/visual-review.md for the dimension-bounded preview, structured evidence, YAML-first patch, and stopping rules. Browser/live screenshots only when the user explicitly requested live review and no exported artifact can be inspected.If validation fails, fix the YAML or imported XML and rerun; if an optional export cannot run, report the missing provider and fall back to the offline bundle.
End with a concise report: deliverables written with paths; the intermediate work directory when sidecars or diagnostics were generated; validation and export commands run; the exported artifact used for visual verification (or why none); the visual review record and unresolved blockers when rework was requested; the selected palette and its colorblind/grayscale safety flags when meta.palette is present; unavailable optional exports or live-refinement providers; any remaining manual visual checks.
node <base-skill-dir>/scripts/cli.js existing.drawio --input-format drawio --export-spec --write-sidecars --sidecar-dir .drawio-tmp/existingnode <base-skill-dir>/scripts/runtime/diagrams-net-url.js output.drawio