xml-generator

An agent that turns a confirmed diagram plan into complete draw.io XML, the file format used to store editable draw.io diagrams.

In plain words
What is it for?
Use it to generate draw.io XML for flowcharts, C4 architecture diagrams, database diagrams, and other planned visualizations.
Why use it?
It checks that the planned shapes, connections, pages, and identifiers are complete before generating the diagram file.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/luongnv89/skills/xml-generator
Clone the repo
git clone --depth 1 https://github.com/luongnv89/skills
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 902 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00902
Opus 5 $0.00000 $0.00451
Sonnet 5 $0.00000 $0.00180
Haiku 4.5 $0.00000 $0.00090

Measured 3d ago against content hash 04e60075fe25, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

xml-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/diagram-generator/drawio-generator/agents/xml-generator.md · 112 lines

How it starts

The opening of the file, as written. The whole thing — 112 lines — stays where its author put it; the contents beside it link to each section on GitHub.

XML Generator Agent

Role: Generate complete, valid draw.io XML from a confirmed diagram plan.

Input

Receive from main agent:

  • diagram_type: Type of diagram (flowchart, C4, ER, etc.)
  • pages: Array of pages (for multi-page diagrams like C4):
    [
      {
        page_name: "Context",
        elements_list: [...],
        edges_list: [...]
      },
      ...
    ]
    
  • elements_list: Array of shapes for single-page diagrams:
    [
      { id, label, x, y, width, height, fill_color, stroke_color, shape_type },
      ...
    ]
    
  • edges_list: Array of connections:
    [
      { id, from_element_id, to_element_id, label },
      ...
    ]
    
  • style_options: User-selected palette (Professional, C4, Monochrome)
  • complexity_estimate: Element count for threshold check

Procedure

  1. Validate input completeness

    • All required fields present
    • No missing IDs or cross-references
    • Page structure correct for multi-page diagrams
    • If any issue, request clarification before proceeding
  2. Generate mxfile root

    • Create <mxfile> element with version attributes
    • Add metadata: host, agent (Claude Code), etc.
  3. For each page or single diagram:

    • Create <diagram> element with name and ID
    • Create <mxGraphModel> with viewport settings
    • Create <root> for all cells
  4. Generate system cells (mandatory for draw.io)

    • <mxCell id="0"/> — implicit parent
    • <mxCell id="1" parent="0"/> — canvas
  5. Generate shape cells

    • For each element in elements_list:
      • Create <mxCell> with:
        • id: unique within page
        • value: label text
        • style: shape styling with html=1;whiteSpace=wrap;
        • vertex="1"
        • parent="1" (or container ID if nested)
      • Child <mxGeometry>: x, y, width, height
      • Important: Size shapes to fit text
        • Single-line: width 120+, height 40–50
        • Multi-line: width 160+, height 80 (add ~20px per line)
  6. Generate edge cells

    • For each edge in edges_list:
      • Create <mxCell> with:
        • id: unique within page
        • value: edge label (if any)
        • style: edge styling with html=1
        • edge="1"
        • parent="1"
        • source: from_element_id
        • target: to_element_id
      • Child <mxGeometry relative="1" as="geometry"/>

Read the full file on GitHub · 112 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 112 lines · 0 tokens per session scan A 04e60075fe25

Subscribe to this mod's changes

xml-generator is an agent published in the GitHub repository luongnv89/skills (121 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 902 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.