/lstack:drawio-generatorfrom lstack
Generates professional diagrams as valid draw.io XML — flowcharts, architecture, C4 models, ER diagrams, sequence diagrams, mind maps, and swimlanes. Follows a four-phase workflow: Understand, Propose, Generate, Validate.
Ships in lstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate professional diagrams as valid draw.io XML. Every request flows through four phases — Understand, Propose, Generate, Validate — before the file is written. Body content is intentionally lean to respect the agent's context budget; depth lives in references/.
Part of the diagram-generator suite. For a hand-drawn / sketch look, use
excalidraw-generatorinstead; thediagram-generatorumbrella routes between the two.
If the Agent tool is available, use subagents per Subagent Architecture for large diagrams; fresh-context validation avoids single-pass context overflow. Without it (e.g., Claude.ai), run every phase inline and self-review against the 9 checks.
Run this once: before reading an existing .drawio file (Iteration), otherwise before the Phase 4 write. The sync target is the output file's directory.
repo="$(git -C "<output dir>" rev-parse --show-toplevel)". If it fails, skip the sync and record sync: skipped (not a git repo).git -C "$repo" remote get-url origin. If it fails, skip steps 3–6 and record sync: skipped (no origin).branch="$(git -C "$repo" rev-parse --abbrev-ref HEAD)". If it prints HEAD, skip steps 4–6 and record sync: skipped (detached HEAD).git -C "$repo" status --porcelain. If the output is empty, run git -C "$repo" fetch origin && git -C "$repo" pull --rebase origin "$branch".git -C "$repo" stash push -u -m "drawio-generator pre-sync", then the same fetch and pull, then git -C "$repo" stash pop.git -C "$repo" rebase --abort, then git -C "$repo" stash pop when step 5 stashed. If the stash pop conflicts, leave the stash in place. In both cases do not write the file; stop and ask the user how to continue. With no answer, the status is BLOCKED.This skill writes one file and commits nothing.
Confirm what to draw before generating anything.
"I'll create a C4 container diagram with a layered layout: API gateway on top, services in the middle, databases at the bottom. Sound good?"
Present the numbered plan below.
(A) Top-to-bottom, (B) Left-to-right, (C) Layered(1) Professional, (2) C4 official, (3) MonochromeGenerate the draw.io XML in memory. Phase 4 writes the file.
Output path: use the path the user gave. Otherwise use a descriptive kebab-case name ending in .drawio (auth-flow.drawio) in the current working directory. If that file exists and the user did not ask to update it, confirm with the user before you overwrite it; to update it, follow Iteration.
Read references/xml-authoring.md for shape/edge/container syntax, sizing rules, multi-page structure, and file naming. Read references/drawio-format.md for the full XML schema and color palettes.
Critical rules every shape must follow:
html=1;whiteSpace=wrap; in the style stringnode-api-gateway)<mxGeometry x y width height as="geometry"/> sized to fit the labelsource, target, and <mxGeometry relative="1" as="geometry"/>Run all 9 checks before writing the file. See references/validation-checks.md for the full check list and fix patterns.
COMPLETE.PARTIAL with the failed check numbers.BLOCKED with the failed checks.The 9 checks: (1) XML structure and system cells, (2) required shape attributes, (3) unique IDs per page, (4) edge bindings, (5) edge geometry, (6) no overlaps >10px, (7) container hierarchy, (8) semantic completeness, (9) readable text and fitted shapes.
A valid .drawio file written to disk (raw XML), then the Final Report. A minimal complete file is in references/xml-authoring.md → Minimal complete file.
End every run, stops included, with this compact text block. A Phase 1–2 question that awaits the user's answer does not end the run; if the user ends the run without answering, report BLOCKED. Status is COMPLETE (file written, 9/9 checks pass), PARTIAL (file written, a check from 6–9 failed), or BLOCKED (no file written). Fill rules, PARTIAL and BLOCKED examples, and reader checks: references/final-report.md. Example:
Result: COMPLETE. Wrote flow.drawio (1 page, 2 shapes, 1 edge, 0 containers).
Evidence: /abs/path/flow.drawio. Validation 9/9 checks passed (inline, 1 cycle). sync: skipped (not a git repo)
Uncertainty: Rendering in draw.io untested. Assumed top-to-bottom flow; the request gave no direction.
Decision: No approval needed.
Verify these for every run:
.drawio file is written to disk and its XML parses, unless the status is BLOCKED.references/validation-checks.md pass on every page, or the Final Report lists each failed check.Result: and its status, and has Evidence:, Uncertainty: and Decision: lines. Evidence: cites only checks that ran; 9/9 appears only when all 9 passed.references/final-report.md (result findable, facts and assumptions separated, claims traceable, next decision clear). Without a human reviewer's answer, human understanding is unconfirmed..drawio file: read it first, preserve existing cell IDs, append new elements — never regenerate from scratch.<diagram> has its own ID namespace; system cells id="0" and id="1" must be present on every page independently.After each phase, print a short status report with that phase's checks; the template and per-phase checks are in references/step-reports.md. The Validate report precedes the Final Report; it does not replace it.
Default style is Professional; C4 requests use the official C4 palette. Color rules and the supported diagram types: references/xml-authoring.md → Style guidelines and Supported diagram types.
When iterating on an existing diagram, read the file and modify the XML in memory. Preserve element IDs that haven't changed. Run Phase 4 on the result before rewriting the file; a BLOCKED result leaves the original file untouched.
Use the Phase 2 complexity estimate: large (30+ elements) runs this subagent loop; small and medium run inline.
Phase 3 — agents/xml-generator.md
Phase 4 — review loop (max 3 cycles)
agents/xml-validator.md. Outputs PASS/FAIL for all 9 checks.agents/xml-fixer.md with the report. Patches XML; never regenerates. Skips semantic/structure issues (those require generator revision).ready_for_validation: false (check 1 or 8), re-spawn agents/xml-generator.md with the validator report; that counts as a cycle.PARTIAL, or BLOCKED).Optional and propose-only. After the run's result is delivered, run this check:
.drawio file naming.references/ (the directory holding this SKILL.md). Bump the patch number of metadata.version. If the skill is an installed copy or tracked in git, say so. Commit nothing unless the user asks.Off — the user opted out.agents/xml-fixer.md (opens in a new tab)agents/xml-generator.md (opens in a new tab)agents/xml-validator.md (opens in a new tab)references/drawio-format.md (opens in a new tab)references/final-report.md (opens in a new tab)references/step-reports.md (opens in a new tab)references/validation-checks.md (opens in a new tab)references/xml-authoring.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
drawio, diagram-generation, c4-model, er-diagram, flowchart, architecture-diagram
npx claudepluginhub luongnv89/skills --plugin lstack20 skills in this plugin
/agent-configCreate, update, or audit AGENTS.md (default) or CLAUDE.md agent instructions: set up, prune, add a rule, or merge CLAUDE.md or .cursorrules into one file Claude Code, Codex, and Cursor all read. Don't use for READMEs, skills, or subagents./auto-pushGenerate a commit message, stage all changes, and push to remote after scanning for secrets, large files, and protected-branch risks. Skip for opening PRs, code review, or cutting releases/tags./cleanup-projectPrepare a git repo before new work: review uncommitted changes, fix .gitignore, delete merged branches, end on clean main, or inspect one branch before deciding. Don't use for dead code, commit-and-push, releases, LICENSE files, or git how-tos.Other plugins' skills for the same job