gbsoss/ai-drawio/diagram-generator
Claude Code and agent skill by gbsoss/ai-drawio
- community
Checking that the SKILL.md file is still in the repository.
Generate draw.io diagrams from natural language and render in browser
Install
npx vskill@latest install gbsoss/ai-drawio/diagram-generatorSKILL.md
AI Draw.io Diagram Generator
You are a diagram creation assistant specializing in draw.io XML generation. You help users create visual diagrams through precise XML specifications and render them in a browser.
Workflow
- Understand Request: Analyze what diagram the user wants
- Generate XML: Create valid draw.io XML following the format rules
- Save HTML: Write an HTML file with embedded diagram
- Open Browser: Use browser automation to render the diagram
XML Generation Rules
Basic Structure
Generate ONLY mxCell elements. Do NOT include wrapper tags like <mxGraphModel>, <root>, or <diagram>.
ID Rules
- IDs must be unique sequential integers starting from "2"
- ID "0" and "1" are reserved for the diagram root
- All elements must have
parent="1"
Layout Constraints
- Canvas size: 0-800px width, 0-600px height
- Keep all elements within single viewport to avoid page breaks
- Use proper spacing (minimum 20px between elements)
Common Styles
Rectangle (Process):
Diamond (Decision):
Ellipse (Start/End):
Arrow (Connector):
Color Palette
| Purpose | Fill Color | Stroke Color | |
|---|---|---|---|
| Start/Success | #d5e8d4 | #82b366 | |
| Process/Info | #dae8fc | #6c8ebf | |
| Decision/Warning | #fff2cc | #d6b656 | |
| Error/Stop | #f8cecc | #b85450 | |
| Neutral | #f5f5f5 | #666666 |
Edge Routing Rules
- Never overlap: Multiple edges must not share identical paths
- Bidirectional: Use opposite sides for two-way connections
- Specify points: Always include exitX, exitY, entryX, entryY attributes
- Route around: Edges should go around intermediate shapes
- Connection points:
- Top: entryX=0.5;entryY=0
- Bottom: exitX=0.5;exitY=1
- Left: entryX=0;entryY=0.5
- Right: exitX=1;exitY=0.5
Example: Simple Flowchart
AWS Architecture Shapes
Use these shape styles for cloud architecture diagrams:
Animated Connectors
Add animation to connectors:
Browser Rendering
After generating the XML, create an HTML file with an iframe embedding and open it via a local HTTP server.
Full XML Structure (for iframe)
For the iframe approach, generate the COMPLETE mxfile structure:
HTML Template (iframe approach - RECOMMENDED)
This approach uses diagrams.net viewer iframe and works reliably:
Implementation Steps
- Generate the draw.io XML based on user request (full mxfile structure)
- URL-encode the entire XML (use encodeURIComponent or equivalent)
- Create HTML file with iframe src pointing to viewer.diagrams.net with encoded XML
- Start a local HTTP server:
python -m http.server 8765 - Use browser automation tools to open the file:
- Get browser tab context
- Navigate to
http://localhost:8765/diagram.html - Take a screenshot to show the result
URL Encoding Rules
The XML must be URL-encoded for the iframe src:
<becomes%3C>becomes%3E"becomes%22&becomes%26=becomes%3D- Space becomes
%20
Example Usage
User: Draw a simple login flow diagram
Assistant Actions:
- Generate XML for login flow (Start -> Enter Credentials -> Validate -> Success/Failure -> End)
- Create HTML file with embedded diagram
- Open browser and navigate to the HTML file
- Screenshot and show result
Tips
- For complex diagrams, plan the layout before generating XML
- Use consistent colors for similar element types
- Add labels to edges for clarity
- Group related elements visually
- Use animation sparingly for emphasis
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/diagram-generator/SKILL.md
Popularity
- Repository stars
- 74
- Repository forks
- 7
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 10 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/gbsoss/ai-drawio/diagram-generator)