Install
openclaw skills install @holdyounger/drawio-diagram-builderCreate, edit, replicate, and iteratively refine editable research and technical diagrams in diagrams.net/draw.io (.drawio XML) from prompts, papers, repositories, screenshots, or existing diagrams. Use when asked to generate a scientific figure, paper method diagram, ML/system architecture diagram, draw.io file, reference figure reproduction, browser screenshot feedback loop, Windows-safe draw.io preview, or layout fixes for text overlap, arrows, colors, icons, fonts, and component alignment.
openclaw skills install @holdyounger/drawio-diagram-builderBefore starting, verify these are available. If anything is missing, tell the user immediately — do not proceed without them.
| Requirement | Why |
|---|---|
| Python 3 (3.7+) | All preview/validation scripts are Python. Run python --version to check. |
| Browser automation | The iterative refinement loop depends on taking screenshots of a local preview. You need one of: Playwright MCP, Puppeteer MCP, browser-evaluate/screenshot tools, or equivalent. |
| Vision / image-reading tool (required when user provides reference images as style guides) | Style extraction (see references/style-extraction.md) requires sampling pixel colors from reference images. You need one of: vision-capable model with image reading, a color-picker MCP/browser tool, or the ability to ask the user for hex codes. Without this, you CANNOT complete the style extraction table — do not fabricate hex codes. Fallback: ask the user for the palette. |
| Internet access | Preview loads https://embed.diagrams.net/ in an iframe. Offline won't work. |
| File write access | You will create .drawio files. |
Script paths in this document are relative to the skill directory. Resolve them like <skill-dir>/scripts/serve_drawio_preview.py. If you can't find the skill directory, look under the agent's installed skills path (e.g., ~/.claude/<skill-dir>/ or ~/.codex/<skill-dir>/).
If Playwright reports a missing bundled browser, first try an installed browser channel before giving up, for example npx playwright screenshot --channel chrome ... or --channel msedge ....
Produce an editable draw.io diagram first, especially for research and technical figures. Do not use an embedded screenshot as the final answer when the user asks for redraw, replica, vector, editable, or 100% reproduction. Raster images may be used only as references, temporary overlays, or explicitly approved assets.
Prefer direct .drawio XML authoring plus browser screenshot feedback for complex or high-fidelity diagrams. Use local draw.io UI control only when it materially improves inspection or user handoff.
Use this priority order:
.drawio XML generation/editing — reliable, reproducible. Write XML with explicit mxGeometry positions.scripts/serve_drawio_preview.py (one command, starts server + opens browser) or scripts/make_drawio_preview.py + python -m http.server. This keeps the browser URL short, avoiding the Windows long-URL crash.http://127.0.0.1:<port>/drawio-preview.html, wait for the draw.io embed to load (2-5 seconds), take a full-page or viewport screenshot. This is the evidence you compare against the reference.@drawio/mcp — only for small diagrams or quick opening. On Windows, large encoded URLs fail with The data area passed to a system call is too small; do not rely on .url shortcuts for large XML.Load references/drawio-workflow.md for the detailed end-to-end process. Load references/self-supervision-and-intake.md for any non-trivial diagram, mixed prompt-plus-image input, project-context diagram, or iterative visual repair. Load references/style-extraction.md when the user provides reference images as style guides — mandatory before authoring XML; you must extract palette, typography, spacing, and arrow grammar before drawing. Load references/topconf-paper-style.md when the user asks for a computer-science paper, top-conference, camera-ready, method, ML pipeline, multimodal architecture, benchmark, or polished research figure, especially when the user gives weak or missing style references. Load references/xml-authoring.md when writing or repairing XML shapes, styles, edges, and text layout. Load references/xml-preflight.md before rendering any diagram — it documents static XML quality checks that catch computable defects (arrow-box collisions, text overflow, spacing variance, color chaos) without a screenshot. Load references/primitive-icons.md when a reference figure contains small modality, memory, warning, tool, clock, document, or other paper-style icons that should remain editable. Load assets/icons/ICON-MANIFEST.md when generic SVG icon assets would improve fidelity.
For any reference-image replication request, load references/reference-replication-protocol.md before creating XML. This is mandatory. Treat high-fidelity replication as an evidence pipeline: observe the reference, specify geometry, author XML, render, compare, patch, and repeat. Do not start drawing from a reference image until the protocol's required intermediate artifacts exist.
Resolve all references relative to the skill directory.
Verify prerequisites — confirm Python 3 and browser automation are available. If not, stop and tell the user what's missing.
Collect input context
references/topconf-paper-style.md and the bundled images under assets/reference-images/ as style/layout fallback only. Do not invent scientific content to fill the layout.references/style-extraction.md. Fill every row of the extraction table — palette hex codes, font sizes, corner radii, stroke widths, spacing rhythms. The extracted values become your mandatory style contract. Do not skip this. When your diagram looks nothing like the reference, the root cause is almost always: no style extraction was done.Build the diagram brief and visual specification
references/self-supervision-and-intake.md.visual-spec.mdlayout-grid.mdasset-ledger.mddefect-log.mdAuthor the .drawio file
.drawio file is the primary artifact. Preview HTML is only a derived artifact.mxfile with one or more diagram pages.mxGeometry positions and sizes for high-fidelity work.references/primitive-icons.md for common research-figure icon recipes before inventing one-off symbols. Use bundled SVG icons from assets/icons/ when fidelity matters more than primitive editability, and record them in asset-ledger.md.python <skill-dir>/scripts/validate_visual_quality.py <file>.drawio
references/xml-preflight.md for the full explanation of each rule.Preview without long URLs
scripts/serve_drawio_preview.py <file>.drawio --port 8765. It generates the preview HTML, starts a server, and opens the browser.scripts/make_drawio_preview.py <file>.drawio --out drawio-preview.html, then python -m http.server 8765 --bind 127.0.0.1 in the output directory.http://127.0.0.1:8765/drawio-preview.html?rev=1 in the browser.Iterate from evidence
await page.screenshot({ clip: { x, y, width, height } }). The crop coordinates must come from the CURRENT screenshot, not from memory or XML — inspect the screenshot, find the canvas edges, then crop.references/self-supervision-and-intake.md Section 4.1 for the zone-by-zone scanning guide.?rev=N), screenshot again, and repeat.defect-log.md with: observed defect, reference evidence, XML cells to change, patch summary, and remaining risk. After the first screenshot row exists, treat defect-log.md as append-only.visual-spec.md and layout-grid.md before making XML patches. A structural miss means an observation, coordinate, asset, or draw.io-rendering assumption was wrong.Validate before handoff
| Dimension | Score (1-10) |
|---|---|
| Text readability | /10 |
| Arrow accuracy | /10 |
| Color coherence | /10 |
| Layout consistency | /10 |
| Style match to reference/spec | /10 |
| TOTAL | /50 |
scripts/validate_drawio.py <file>.drawio.scripts/validate_drawio.py --strict --json <file>.drawio when a CI-friendly final gate is useful, or when warnings such as off-page vertices or placeholder-like labels should block handoff.scripts/validate_replication_artifacts.py <workdir> --require-screenshot-review after the latest screenshot pass. Run validation after generation/preview writes finish; do not run validators in parallel with scripts that write the same artifact directory..drawio path, the latest screenshot path, the self-score card, and the defect log summary. Leave the local preview server running if the user wants to continue iterating..drawio files by writing or patching XML directly. For small targeted fixes, use the file editing tool (e.g., Edit/Write in Claude Code)..url files or huge #create= URLs. Use local preview HTML with postMessage.validate_visual_quality.py before rendering, you deserve the disaster you see. Run it now, fix the FAILs, regenerate.validate_visual_quality.py, fix every FAIL, review every WARN, then re-render..drawio download. Move the downloaded file back to your working path before further edits.assets/icons/ICON-MANIFEST.md before searching the web. Use the bundled MIT-licensed Tabler SVGs for generic document, media, storage, routing, tool, metric, and status icons.references/xml-authoring.md; escape normal text and use deliberate raw HTML only for agent-authored tags such as <i> or <sub>.?rev=3, regenerate preview HTML, or reopen the tab.embed.diagrams.net iframe can take 3-5 seconds on slow connections. If it still fails, verify internet access.VERSION: installed skill version marker. Use it through scripts/check_skill_update.py, not by checking for a specific feature string.scripts/check_skill_update.py: compare the installed skill version with the canonical GitHub version.scripts/make_drawio_preview.py: build a local short-URL preview HTML that loads .drawio XML into diagrams.net via postMessage.scripts/serve_drawio_preview.py: generate the preview HTML and serve it on 127.0.0.1 with an optional browser launch.scripts/validate_drawio.py: parse, structurally validate, count labels/assets, and sanity-check .drawio files before handoff. Supports --strict and --json.scripts/validate_visual_quality.py: pre-render static checker. Parses .drawio XML and computes visual defects without rendering — arrow-box collisions, text overflow risk, font proportionality, spacing variance, color incoherence, element overlap, orphan labels, font size anomalies, and edge density. Run before first preview. Zero FAILs required. Supports --json, --strict, --rules.assets/icons/ICON-MANIFEST.md: local MIT-licensed SVG icon inventory and usage rules.assets/reference-images/REFERENCE-IMAGES.md: bundled top-conference-style figure references for style fallback.references/drawio-workflow.md: full professional workflow for prompt/paper/code/reference-image to editable draw.io.references/self-supervision-and-intake.md: mixed-input intake, diagram brief, mandatory 5-dimension audit, red-team role switch, self-scoring card, and hard gates before handoff.references/xml-preflight.md: explains every pre-render static check — what it catches, why it matters, and why XML alone blinds the agent to these defects.references/style-extraction.md: mandatory style extraction protocol — how to sample palettes, measure typography, identify layout rhythm, and extract arrow grammar from reference images before drawing. Use whenever the user provides style reference images.references/topconf-paper-style.md: top-conference computer-science figure style, fallback reference selection, and paper-quality bar.references/primitive-icons.md: reusable editable primitive recipes for common research-figure icons.references/reference-replication-protocol.md: low-freedom protocol for high-fidelity reference-image replication.references/xml-authoring.md: XML, layout, style, edge, text, icon, and iteration patterns.