Draw.io Diagram Editor

Draw io

by davila7 · MIT license · ★ 32,299 on GitHub

Draw io cover

Draw.io diagram creation, editing, and review. Use for .drawio XML editing, PNG conversion, layout adjustment, and AWS icon usage.

---
name: draw-io
description: draw.io diagram creation, editing, and review. Use for .drawio XML editing, PNG conversion, layout adjustment, and AWS icon usage.
---

# draw.io Diagram Skill

## 1. Basic Rules

- Edit only `.drawio` files
- Do not directly edit `.drawio.png` files
- Use auto-generated `.drawio.png` by pre-commit hook in slides

## 2. Font Settings

For diagrams used in Quarto slides,
specify `defaultFontFamily` in mxGraphModel tag:

Overview

For diagrams used in Quarto slides, specify defaultFontFamily in mxGraphModel tag:

Manual install (npx, ZIP)
Claude Codenpx skills add davila7/claude-code-templates --skill draw-io -g -a claude-code
Claude Code (degit)npx degit davila7/claude-code-templates/cli-tool/components/skills/creative-design/draw-io#main ~/.claude/skills/draw-io
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md7.4 KB
Read SKILL.md here
davila7/main1 file shown
SKILL.md
Show the full text279 lines

draw.io Diagram Skill

1. Basic Rules

  • Edit only .drawio files
  • Do not directly edit .drawio.png files
  • Use auto-generated .drawio.png by pre-commit hook in slides

2. Font Settings

For diagrams used in Quarto slides, specify defaultFontFamily in mxGraphModel tag:

<mxGraphModel defaultFontFamily="Noto Sans JP" ...>

Also explicitly specify fontFamily in each text element's style attribute:

style="text;html=1;fontSize=27;fontFamily=Noto Sans JP;"

3. Conversion Commands

See conversion script at scripts/convert-drawio-to-png.sh.

# Convert all .drawio files
mise exec -- pre-commit run --all-files

# Convert specific .drawio file
mise exec -- pre-commit run convert-drawio-to-png --files assets/my-diagram.drawio

# Run script directly (using skill's script)
bash ~/.claude/skills/draw-io/scripts/convert-drawio-to-png.sh assets/diagram1.drawio

Internal command used:

drawio -x -f png -s 2 -t -o output.drawio.png input.drawio
Option Description
-x Export mode
-f png PNG format output
-s 2 2x scale (high resolution)
-t Transparent background
-o Output file path

4. Layout Adjustment

4.1. Coordinate Adjustment Steps
  1. Open .drawio file in text editor (plain XML format)
  2. Find mxCell for element to adjust (search by value attribute for text)
  3. Adjust coordinates in mxGeometry tag
    • x: Position from left
    • y: Position from top
    • width: Width
    • height: Height
  4. Run conversion and verify
4.2. Coordinate Calculation
  • Element center coordinate = y + (height / 2)
  • To align multiple elements, calculate and match center coordinates

5. Design Principles

5.1. Basic Principles
  • Clarity: Create simple, visually clean diagrams
  • Consistency: Unify colors, fonts, icon sizes, line thickness
  • Accuracy: Do not sacrifice accuracy for simplification
5.2. Element Rules
  • Label all elements
  • Use arrows to indicate direction (prefer 2 unidirectional arrows over bidirectional)
  • Use latest official icons
  • Add legend to explain custom symbols
5.3. Accessibility
  • Ensure sufficient color contrast
  • Use patterns in addition to colors
5.4. Progressive Disclosure

Separate complex systems into staged diagrams:

Diagram Type Purpose
Context Diagram System overview from external perspective
System Diagram Main components and relationships
Component Diagram Technical details and integration points
Deployment Diagram Infrastructure configuration
Data Flow Diagram Data flow and transformation
Sequence Diagram Time-series interactions
5.5. Metadata

Include title, description, last updated, author, and version in diagrams.

6. Best Practices

6.1. Background Color
  • Remove background="#ffffff"
  • Transparent background adapts to various themes
6.2. Font Size
  • Use 1.5x standard font size (around 18px) for PDF readability
6.3. Japanese Text Width
  • Allow 30-40px per character
  • Insufficient width causes unintended line breaks
<!-- For 10-character text, allow 300-400px -->
<mxGeometry x="140" y="60" width="400" height="40" />
6.4. Arrow Placement
  • Always place arrows at back (position in XML right after Title)
  • Position arrows to avoid overlapping with labels
  • Keep arrow start/end at least 20px from label bottom edge
<!-- Title -->
<mxCell id="title" value="..." .../>

<!-- Arrows (back layer) -->
<mxCell id="arrow1" style="edgeStyle=..." .../>

<!-- Other elements (front layer) -->
<mxCell id="box1" .../>
6.5. Arrow Connection to Text Labels

For text elements, exitX/exitY don't work, so use explicit coordinates:

<!-- Good: Explicit coordinates with sourcePoint/targetPoint -->
<mxCell id="arrow" style="..." edge="1" parent="1">
  <mxGeometry relative="1" as="geometry">
    <mxPoint x="1279" y="500" as="sourcePoint"/>
    <mxPoint x="119" y="500" as="targetPoint"/>
    <Array as="points">
      <mxPoint x="1279" y="560"/>
      <mxPoint x="119" y="560"/>
    </Array>
  </mxGeometry>
</mxCell>
6.6. edgeLabel Offset Adjustment

Adjust offset attribute to distance arrow labels from arrows:

<!-- Place above arrow (negative value to distance) -->
<mxPoint x="0" y="-40" as="offset"/>

<!-- Place below arrow (positive value to distance) -->
<mxPoint x="0" y="40" as="offset"/>
6.7. Remove Unnecessary Elements
  • Remove decorative icons irrelevant to context
  • Example: If ECR exists, separate Docker icon is unnecessary
6.8. Labels and Headings
  • Service name only: 1 line
  • Service name + supplementary info: 2 lines with line break
  • Redundant notation (e.g., ECR Container Registry): shorten to 1 line
  • Use &lt;br&gt; tag for line breaks
6.9. Background Frame and Internal Element Placement

When placing elements inside background frames (grouping boxes), ensure sufficient margin.

  • YOU MUST: Internal elements must have at least 30px margin from frame boundary
  • YOU MUST: Account for rounded corners (rounded=1) and stroke width
  • YOU MUST: Always visually verify PNG output for overflow

Coordinate calculation verification:

Background frame: y=20, height=400 -> range is y=20-420
Internal element top: frame y + 30 or more (e.g., y=50)
Internal element bottom: frame y + height - 30 or less (e.g., up to y=390)

Bad example (may overflow):

<!-- Background frame -->
<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
  <mxGeometry x="500" y="20" width="560" height="400" />
</mxCell>
<!-- Text: y=30 is too close to frame top (y=20) -->
<mxCell id="label" value="Title" style="text;...">
  <mxGeometry x="510" y="30" width="540" height="35" />
</mxCell>

Good example (sufficient margin):

<!-- Background frame -->
<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
  <mxGeometry x="500" y="20" width="560" height="430" />
</mxCell>
<!-- Text: y=50 is 30px from frame top (y=20) -->
<mxCell id="label" value="Title" style="text;...">
  <mxGeometry x="510" y="50" width="540" height="35" />
</mxCell>

7. Reference

AWS icon search examples:

python ~/.claude/skills/draw-io/scripts/find_aws_icon.py ec2
python ~/.claude/skills/draw-io/scripts/find_aws_icon.py lambda

8. Checklist

  • No background color set (page="0")
  • Font size appropriate (larger recommended)
  • Arrows placed at back layer
  • Arrows not overlapping labels (verify in PNG)
  • Arrow start/end sufficiently distant from labels (at least 20px)
  • Arrows not penetrating boxes or icons (verify in PNG)
  • Internal elements not overflowing background frame (verify in PNG)
  • 30px+ margin between background frame and internal elements
  • AWS service names are official names/correct abbreviations
  • AWS icons are latest version (mxgraph.aws4.*)
  • No unnecessary elements remaining
  • Visually verified PNG conversion

9. Image Display in reveal.js Slides

Add auto-stretch: false to YAML header:

---
title: "Your Presentation"
format:
  revealjs:
    auto-stretch: false
---

This ensures correct image display on mobile devices.

1---
2name: draw-io
3description: draw.io diagram creation, editing, and review. Use for .drawio XML editing, PNG conversion, layout adjustment, and AWS icon usage.
4---
5 
6# draw.io Diagram Skill
7 
8## 1. Basic Rules
9 
10- Edit only `.drawio` files
11- Do not directly edit `.drawio.png` files
12- Use auto-generated `.drawio.png` by pre-commit hook in slides
13 
14## 2. Font Settings
15 
16For diagrams used in Quarto slides,
17specify `defaultFontFamily` in mxGraphModel tag:
18 
19```xml
20<mxGraphModel defaultFontFamily="Noto Sans JP" ...>
21```
22 
23Also explicitly specify `fontFamily` in each text element's style attribute:
24 
25```xml
26style="text;html=1;fontSize=27;fontFamily=Noto Sans JP;"
27```
28 
29## 3. Conversion Commands
30 
31See conversion script at [scripts/convert-drawio-to-png.sh](scripts/convert-drawio-to-png.sh).
32 
33```sh
34# Convert all .drawio files
35mise exec -- pre-commit run --all-files
36 
37# Convert specific .drawio file
38mise exec -- pre-commit run convert-drawio-to-png --files assets/my-diagram.drawio
39 
40# Run script directly (using skill's script)
41bash ~/.claude/skills/draw-io/scripts/convert-drawio-to-png.sh assets/diagram1.drawio
42```
43 
44Internal command used:
45 
46```sh
47drawio -x -f png -s 2 -t -o output.drawio.png input.drawio
48```
49 
50| Option | Description |
51|--------|-------------|
52| `-x` | Export mode |
53| `-f png` | PNG format output |
54| `-s 2` | 2x scale (high resolution) |
55| `-t` | Transparent background |
56| `-o` | Output file path |
57 
58## 4. Layout Adjustment
59 
60### 4.1. Coordinate Adjustment Steps
61 
621. Open `.drawio` file in text editor (plain XML format)
632. Find `mxCell` for element to adjust (search by `value` attribute for text)
643. Adjust coordinates in `mxGeometry` tag
65 - `x`: Position from left
66 - `y`: Position from top
67 - `width`: Width
68 - `height`: Height
694. Run conversion and verify
70 
71### 4.2. Coordinate Calculation
72 
73- Element center coordinate = `y + (height / 2)`
74- To align multiple elements, calculate and match center coordinates
75 
76## 5. Design Principles
77 
78### 5.1. Basic Principles
79 
80- Clarity: Create simple, visually clean diagrams
81- Consistency: Unify colors, fonts, icon sizes, line thickness
82- Accuracy: Do not sacrifice accuracy for simplification
83 
84### 5.2. Element Rules
85 
86- Label all elements
87- Use arrows to indicate direction
88 (prefer 2 unidirectional arrows over bidirectional)
89- Use latest official icons
90- Add legend to explain custom symbols
91 
92### 5.3. Accessibility
93 
94- Ensure sufficient color contrast
95- Use patterns in addition to colors
96 
97### 5.4. Progressive Disclosure
98 
99Separate complex systems into staged diagrams:
100 
101| Diagram Type | Purpose |
102|--------------|---------|
103| Context Diagram | System overview from external perspective |
104| System Diagram | Main components and relationships |
105| Component Diagram | Technical details and integration points |
106| Deployment Diagram | Infrastructure configuration |
107| Data Flow Diagram | Data flow and transformation |
108| Sequence Diagram | Time-series interactions |
109 
110### 5.5. Metadata
111 
112Include title, description, last updated, author, and version in diagrams.
113 
114## 6. Best Practices
115 
116### 6.1. Background Color
117 
118- Remove `background="#ffffff"`
119- Transparent background adapts to various themes
120 
121### 6.2. Font Size
122 
123- Use 1.5x standard font size (around 18px) for PDF readability
124 
125### 6.3. Japanese Text Width
126 
127- Allow 30-40px per character
128- Insufficient width causes unintended line breaks
129 
130```xml
131<!-- For 10-character text, allow 300-400px -->
132<mxGeometry x="140" y="60" width="400" height="40" />
133```
134 
135### 6.4. Arrow Placement
136 
137- Always place arrows at back (position in XML right after Title)
138- Position arrows to avoid overlapping with labels
139- Keep arrow start/end at least 20px from label bottom edge
140 
141```xml
142<!-- Title -->
143<mxCell id="title" value="..." .../>
144 
145<!-- Arrows (back layer) -->
146<mxCell id="arrow1" style="edgeStyle=..." .../>
147 
148<!-- Other elements (front layer) -->
149<mxCell id="box1" .../>
150```
151 
152### 6.5. Arrow Connection to Text Labels
153 
154For text elements, exitX/exitY don't work, so use explicit coordinates:
155 
156```xml
157<!-- Good: Explicit coordinates with sourcePoint/targetPoint -->
158<mxCell id="arrow" style="..." edge="1" parent="1">
159 <mxGeometry relative="1" as="geometry">
160 <mxPoint x="1279" y="500" as="sourcePoint"/>
161 <mxPoint x="119" y="500" as="targetPoint"/>
162 <Array as="points">
163 <mxPoint x="1279" y="560"/>
164 <mxPoint x="119" y="560"/>
165 </Array>
166 </mxGeometry>
167</mxCell>
168```
169 
170### 6.6. edgeLabel Offset Adjustment
171 
172Adjust offset attribute to distance arrow labels from arrows:
173 
174```xml
175<!-- Place above arrow (negative value to distance) -->
176<mxPoint x="0" y="-40" as="offset"/>
177 
178<!-- Place below arrow (positive value to distance) -->
179<mxPoint x="0" y="40" as="offset"/>
180```
181 
182### 6.7. Remove Unnecessary Elements
183 
184- Remove decorative icons irrelevant to context
185- Example: If ECR exists, separate Docker icon is unnecessary
186 
187### 6.8. Labels and Headings
188 
189- Service name only: 1 line
190- Service name + supplementary info: 2 lines with line break
191- Redundant notation (e.g., ECR Container Registry): shorten to 1 line
192- Use `&lt;br&gt;` tag for line breaks
193 
194### 6.9. Background Frame and Internal Element Placement
195 
196When placing elements inside background frames (grouping boxes),
197ensure sufficient margin.
198 
199- YOU MUST: Internal elements must have at least 30px margin from frame boundary
200- YOU MUST: Account for rounded corners (`rounded=1`) and stroke width
201- YOU MUST: Always visually verify PNG output for overflow
202 
203Coordinate calculation verification:
204 
205```text
206Background frame: y=20, height=400 -> range is y=20-420
207Internal element top: frame y + 30 or more (e.g., y=50)
208Internal element bottom: frame y + height - 30 or less (e.g., up to y=390)
209```
210 
211Bad example (may overflow):
212 
213```xml
214<!-- Background frame -->
215<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
216 <mxGeometry x="500" y="20" width="560" height="400" />
217</mxCell>
218<!-- Text: y=30 is too close to frame top (y=20) -->
219<mxCell id="label" value="Title" style="text;...">
220 <mxGeometry x="510" y="30" width="540" height="35" />
221</mxCell>
222```
223 
224Good example (sufficient margin):
225 
226```xml
227<!-- Background frame -->
228<mxCell id="bg" style="rounded=1;strokeWidth=3;...">
229 <mxGeometry x="500" y="20" width="560" height="430" />
230</mxCell>
231<!-- Text: y=50 is 30px from frame top (y=20) -->
232<mxCell id="label" value="Title" style="text;...">
233 <mxGeometry x="510" y="50" width="540" height="35" />
234</mxCell>
235```
236 
237## 7. Reference
238 
239- [Layout Guidelines](references/layout-guidelines.md)
240- [AWS Icons](references/aws-icons.md)
241- [AWS Icon Search Script](scripts/find_aws_icon.py)
242 
243AWS icon search examples:
244 
245```sh
246python ~/.claude/skills/draw-io/scripts/find_aws_icon.py ec2
247python ~/.claude/skills/draw-io/scripts/find_aws_icon.py lambda
248```
249 
250## 8. Checklist
251 
252- [ ] No background color set (page="0")
253- [ ] Font size appropriate (larger recommended)
254- [ ] Arrows placed at back layer
255- [ ] Arrows not overlapping labels (verify in PNG)
256- [ ] Arrow start/end sufficiently distant from labels (at least 20px)
257- [ ] Arrows not penetrating boxes or icons (verify in PNG)
258- [ ] Internal elements not overflowing background frame (verify in PNG)
259- [ ] 30px+ margin between background frame and internal elements
260- [ ] AWS service names are official names/correct abbreviations
261- [ ] AWS icons are latest version (mxgraph.aws4.*)
262- [ ] No unnecessary elements remaining
263- [ ] Visually verified PNG conversion
264 
265## 9. Image Display in reveal.js Slides
266 
267Add `auto-stretch: false` to YAML header:
268 
269```yaml
270---
271title: "Your Presentation"
272format:
273 revealjs:
274 auto-stretch: false
275---
276```
277 
278This ensures correct image display on mobile devices.
279 
View all files on GitHub →

Details

License
MIT
Stars on the repo
★ 32,299
Checked
Source
davila7/claude-code-templates ↗
Creator
davila7 · 212 listings
View creator

Similar skills

See all →
SkillAzure App Deployermicrosoft/skills · by microsoftEnd-to-end orchestrator: from a business idea, app idea, or existing app to running Azure deployment with cost estimates and pre-deploy approval. Analyzes your app, auto-detects the right Azure services, scaffolds infrastructure code, and deploys — tailored to your app, not a template. Handles moving existing apps to Azure without rewriting or with minimal changes. WHEN: bring your app to Azure, plan my app, cost to run, is my code ready to deploy, deploy my app to the cloud, deploy all my services, what Azure services do I need, plan my Azure deployment, deploy my new app to Azure, one-click deploy, I have an app and want it on Azure, migrate my app to Azure, help me get started, build an app, no code yet, starter project. DO NOT USE FOR: use azd for deployment(use azure-deploy), optimizing existing costs (use cost-optimization), code readiness checks only (use azure-app-onboard-prereq).★ 3.1k GitHub starsSkillAzure Deployment Auditormicrosoft/skills · by microsoftAssess whether source code is ready to deploy to Azure — the check BEFORE infrastructure work. Evaluates build health, app completeness, dependencies and local services, stack compatibility, and deployment feasibility. Answers questions about what your app needs before it can be deployed — frameworks, dependencies, and configuration. Checks whether dependencies are compatible and identifies deployment blockers and unsupported frameworks. WHEN: "evaluate my repo", "is my app ready to deploy", "what does my app need to deploy", "what do I need before deploying", "does my app need", "can I ship this to Azure", "scan my repo for issues", "is this app deployable", "check if my app is ready for Azure", "do I need a Dockerfile", "what's blocking my deployment", "are there any blockers", "are my dependencies compatible", "does Azure support my framework", "what needs to change before deploying", "check my app configuration".★ 3.1k GitHub starsSkillAzure AI Gatewaymicrosoft/azure-skills · by microsoftConfigure Azure API Management as an AI Gateway for AI models, MCP tools, and agents. WHEN: semantic caching, token limit, content safety, load balancing, AI model governance, MCP rate limiting, jailbreak detection, add Azure OpenAI backend, add AI Foundry model, test AI gateway, LLM policies, configure AI backend, token metrics, AI cost control, convert API to MCP, import OpenAPI to gateway.★ 1.6k GitHub starsSkillKusto Query Buildermicrosoft/azure-skills · by microsoftQuery and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetry, and time series analysis. WHEN: KQL queries, Kusto database queries, Azure Data Explorer, ADX clusters, log analytics, time series data, IoT telemetry, anomaly detection.★ 1.6k GitHub starsAgentDocker CLI Container Gatewaydocker/mcp-gateway · by dockerDocker's own CLI plugin: run any server from the Docker MCP Catalog in its own container, behind one connection, with secrets kept out of env vars.★ 1.6k GitHub starsAgentAgent Marketplaceelisymlabs/elisym · by elisymlabsOpen infrastructure for AI agents to discover and pay each other★ 17 GitHub stars

More from davila7

Skill2D Game Developmentdavila7/claude-code-templates · by davila72D game development principles. Sprites, tilemaps, physics, camera.★ 32.3k GitHub starsSkill3D Game Development Principlesdavila7/claude-code-templates · by davila73D game development principles. Rendering, shaders, physics, cameras.★ 32.3k GitHub starsSkill3D Web Experience Builderdavila7/claude-code-templates · by davila7Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.★ 32.3k GitHub starsSkillSplit Test Setupdavila7/claude-code-templates · by davila7When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," or "hypothesis." For tracking implementation, see analytics-tracking.★ 32.3k GitHub starsAgentResearch Literature Synthesizerdavila7/claude-code-templates · by davila7Academic research synthesis specialist. Use PROACTIVELY for comprehensive research on academic topics, literature reviews, technical investigations, and well-cited analysis combining multiple sources. <example>Context: A podcast episode needs a segment grounded in peer-reviewed evidence with formal citations. user: "Research the current state of transformer efficiency techniques for the episode, with proper academic citations." assistant: "I'll use the academic-research-synthesizer agent to search arXiv and Semantic Scholar, extract full-text findings via WebFetch, and produce a cited literature synthesis with confidence levels." <commentary>Use academic-research-synthesizer (not comprehensive-researcher) when the episode segment needs peer-reviewed sourcing, formal citation format, and explicit confidence tagging rather than general-purpose multi-source coverage.</commentary></example> <example>Context: The episode-orchestrator has routed a "literature review" request for a technical deep-dive segment. user: "Summarize the research landscape on federated learning privacy guarantees." assistant: "I'll invoke academic-research-synthesizer to systematically search academic sources, note peer-review status per source, and synthesize consensus vs. open debates."</example>★ 32.3k GitHub starsAgentAcademic Research Specialistdavila7/claude-code-templates · by davila7Academic research specialist for scholarly sources, peer-reviewed papers, and academic literature. Use PROACTIVELY for research paper analysis, literature reviews, citation tracking, and academic methodology evaluation. <example>Context: The research-orchestrator has kicked off Phase 4 parallel research on 'efficacy of intermittent fasting' and needs peer-reviewed evidence. user: "Find the academic evidence on intermittent fasting outcomes." assistant: "I'll use the academic-researcher agent to search Semantic Scholar, PubMed, and OpenAlex for peer-reviewed studies and write structured findings to academic-research.md." <commentary>The request is specifically for scholarly/peer-reviewed evidence rather than general web coverage or code, so academic-researcher (not web-researcher or technical-researcher) is the right specialist.</commentary></example> <example>Context: The user wants a literature review comparing methodologies across studies on a topic. user: "Can you review the literature on transformer model interpretability and identify research gaps?" assistant: "Let me invoke the academic-researcher agent to pull foundational and recent papers, extract methodologies, and surface open research gaps." <commentary>Literature review, methodology extraction, and research-gap identification are core academic-researcher capabilities, distinct from technical-researcher's focus on code repositories and implementations.</commentary></example>★ 32.3k GitHub stars