draw-io

Generate and edit draw.io diagrams in XML format with proper font settings, arrow placement, and Japanese text support. Use when creating flowcharts, architecture diagrams, sequence diagrams, or any visual diagrams in .drawio format. Handles font family settings, arrow layering, text sizing, and PNG export validation.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026⬇️2downloads

When & Why to Use This Skill

This Claude skill automates the generation and editing of professional draw.io diagrams by directly manipulating XML data. It solves common programmatic diagramming issues by handling complex formatting tasks such as precise arrow layering (Z-order), font family configuration (with specialized support for Japanese characters), and optimal text sizing. It is an essential tool for developers and architects looking to maintain high-quality, version-controlled visual documentation.

Use Cases

  • System Architecture Mapping: Automatically generate detailed system architecture diagrams from technical requirements or codebase analysis.
  • Multi-language Flowcharts: Create business logic flowcharts with robust support for Japanese text, ensuring correct character width and font rendering.
  • Sequence Diagram Automation: Programmatically generate and update sequence diagrams to reflect changes in API interactions or software workflows.
  • Documentation Standardization: Apply consistent styling, branding, and layout rules across all .drawio files within a project repository.
  • Visual Verification Workflows: Integrate with CLI tools to export generated XML to PNG for rapid visual auditing and quality assurance.
namedraw-io
descriptionGenerate and edit draw.io diagrams in XML format with proper font settings, arrow placement, and Japanese text support. Use when creating flowcharts, architecture diagrams, sequence diagrams, or any visual diagrams in .drawio format. Handles font family settings, arrow layering, text sizing, and PNG export validation.

draw.io Diagram Generation Skill

Overview

This skill enables Claude Code to generate high-quality draw.io diagrams by directly editing XML. It addresses common pitfalls when generating draw.io files programmatically.

Quick Start

When creating a draw.io diagram:

  1. Set defaultFontFamily in mxGraphModel
  2. Add fontFamily=FontName; to ALL text element styles
  3. Use fontSize=18 or larger for readability
  4. Place arrows (edges) BEFORE boxes (vertices) in XML
  5. Allocate 30-40px width per Japanese character
  6. Set page="0" for transparent background
  7. Verify with PNG export

Core Rules

Font Settings

<!-- In mxGraphModel -->
<mxGraphModel defaultFontFamily="Noto Sans JP" page="0" ...>

<!-- In EVERY text element's style -->
<mxCell style="text;fontFamily=Noto Sans JP;fontSize=18;..." />

Arrow Placement (Z-Order)

Arrows must be declared FIRST to render behind other elements:

<root>
  <mxCell id="0" />
  <mxCell id="1" parent="0" />

  <!-- ARROWS FIRST (renders at back) -->
  <mxCell id="arrow1" edge="1" ... />

  <!-- BOXES AFTER (renders in front) -->
  <mxCell id="box1" vertex="1" ... />
</root>

Label-Arrow Spacing

Labels must be at least 20px away from arrow lines:

<!-- Arrow at Y=220 -->
<mxCell id="arrow">
  <mxGeometry>
    <mxPoint y="220" as="sourcePoint"/>
  </mxGeometry>
</mxCell>

<!-- Label at Y=180 (40px above arrow) - CORRECT -->
<mxCell id="label" value="Process">
  <mxGeometry y="180" width="60" height="20" />
</mxCell>

Japanese Text Width

Allocate sufficient width to prevent unwanted line breaks:

<!-- 8 Japanese characters × 35px = 280px minimum -->
<mxCell id="title" value="シンプルなフロー図">
  <mxGeometry width="300" height="40" />
</mxCell>

Instruction Template

When asked to create a draw.io diagram, use this approach:

  1. Understand the diagram requirements
  2. Plan the layout (positions, connections)
  3. Generate XML with all rules applied
  4. Suggest PNG verification command

PNG Verification

Always recommend PNG export for visual verification:

# macOS
drawio -x -f png -s 2 -t -o output.png input.drawio
open output.png

# Linux
drawio -x -f png -s 2 -t -o output.png input.drawio
xdg-open output.png

Supporting Files