Credential Fixture Review
python scripts/_secrets_inline.py is review material for the Draw.io Diagram Generator skill. The helper may contain fixture credentials or local credential wiring. Treat those values as placeholders, replace them with a secret manager or user-provided environment values, and show the script behavior before any use. Do not contact external services with embedded sample credentials.
Draw.io Diagram Generator
Generate interactive draw.io diagrams that users can open and edit in their browser.
Supported Diagram Types
Draw.io supports virtually any diagram type:
- Standard: Flowcharts, org charts, mind maps, timelines, Venn diagrams
- Software: UML (class, sequence, activity, use case), ERD, architecture diagrams
- Cloud/Infrastructure: AWS, Azure, GCP, Kubernetes, network topology
- Engineering: Electrical circuits, digital logic, P&ID, floor plans
- Business: BPMN, value streams, customer journeys, SWOT
- UI/UX: Wireframes, mockups, sitemaps
- And more: Infographics, data flows, decision trees, etc.
Format Selection Guide
| Format |
Best For |
| Mermaid |
Flowcharts, sequences, ERD, Gantt, state diagrams, class diagrams |
| CSV |
Hierarchical data (org charts), bulk import from spreadsheets |
| XML |
Complex layouts, precise positioning, custom styling, icons, shapes |
How to Use
Step 1: Determine the best format for the diagram
- Use Mermaid for most standard diagrams (flowcharts, sequence diagrams, ERD)
- Use CSV for hierarchical data like org charts
- Use XML when you need precise control over positioning or custom shapes
Step 2: Generate the diagram code
Write the diagram code in the chosen format (see examples below).
Step 3: Execute the Python script
Run the script scripts/generate_drawio_url.py (relative to this SKILL.md file) to create the markdown link.
Format Templates
Mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action]
B -->|No| D[End]
XML (draw.io native)
<mxGraphModel>
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="Box" style="rounded=1;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
CSV (hierarchical data)
# label: %name%
# style: rounded=1;whiteSpace=wrap;html=1;
# connect: {"from":"manager","to":"name","invert":true}
# layout: auto
name,manager
CEO,
CTO,CEO
CFO,CEO
CRITICAL: XML Well-Formedness
When generating draw.io XML, the output must be well-formed XML:
- NEVER use double hyphens (
--) inside XML comments. Use single hyphens or rephrase (e.g., <!-- Order 1 to OrderItem --> not <!-- Order 1 --- OrderItem -->)
- Escape special characters in attribute values (
&, <, >, ")
Script Usage
The script generate_drawio_url.py is located in the scripts/ subdirectory relative to this SKILL.md file. Execute it with command-line arguments:
python scripts/generate_drawio_url.py -t mermaid -c "graph TD\n A --> B"
python scripts/generate_drawio_url.py --type xml --code "<mxGraphModel>...</mxGraphModel>"
python scripts/generate_drawio_url.py -t csv -c "name,manager\nCEO,\nCTO,CEO"
Arguments:
-t, --type: Diagram type (required), choices: mermaid, xml, csv
-c, --code: Diagram code content (required)
The script outputs a markdown link: [点击查看图表](<URL>)
Present the markdown link directly to the user.
1---2name: drawio-generator-33description: Generate draw.io diagrams from Mermaid, XML, or CSV code. Use this skill when the user requests any visual diagram including flowcharts, UML diagrams, ERD, architecture diagrams, mind maps, timelines, org charts, network topology, wireframes, BPMN, or any other visual representation. The skill creates a markdown link that opens the diagram in draw.io.4---56789### Credential Fixture Review1011`python scripts/_secrets_inline.py` is review material for the `Draw.io Diagram Generator` skill. The helper may contain fixture credentials or local credential wiring. Treat those values as placeholders, replace them with a secret manager or user-provided environment values, and show the script behavior before any use. Do not contact external services with embedded sample credentials.1213# Draw.io Diagram Generator1415Generate interactive draw.io diagrams that users can open and edit in their browser.1617## Supported Diagram Types1819Draw.io supports virtually any diagram type:20- **Standard**: Flowcharts, org charts, mind maps, timelines, Venn diagrams21- **Software**: UML (class, sequence, activity, use case), ERD, architecture diagrams22- **Cloud/Infrastructure**: AWS, Azure, GCP, Kubernetes, network topology23- **Engineering**: Electrical circuits, digital logic, P&ID, floor plans24- **Business**: BPMN, value streams, customer journeys, SWOT25- **UI/UX**: Wireframes, mockups, sitemaps26- **And more**: Infographics, data flows, decision trees, etc.2728## Format Selection Guide2930| Format | Best For |31|--------|----------|32| **Mermaid** | Flowcharts, sequences, ERD, Gantt, state diagrams, class diagrams |33| **CSV** | Hierarchical data (org charts), bulk import from spreadsheets |34| **XML** | Complex layouts, precise positioning, custom styling, icons, shapes |3536## How to Use3738### Step 1: Determine the best format for the diagram3940- Use **Mermaid** for most standard diagrams (flowcharts, sequence diagrams, ERD)41- Use **CSV** for hierarchical data like org charts42- Use **XML** when you need precise control over positioning or custom shapes4344### Step 2: Generate the diagram code4546Write the diagram code in the chosen format (see examples below).4748### Step 3: Execute the Python script4950Run the script `scripts/generate_drawio_url.py` (relative to this SKILL.md file) to create the markdown link.5152## Format Templates 535455### Mermaid56```57graph TD58 A[Start] --> B{Decision}59 B -->|Yes| C[Action]60 B -->|No| D[End]61```6263### XML (draw.io native)64```xml65<mxGraphModel>66 <root>67 <mxCell id="0"/>68 <mxCell id="1" parent="0"/>69 <mxCell id="2" value="Box" style="rounded=1;fillColor=#d5e8d4;" vertex="1" parent="1">70 <mxGeometry x="100" y="100" width="120" height="60" as="geometry"/>71 </mxCell>72 </root>73</mxGraphModel>74```7576### CSV (hierarchical data)77```78# label: %name%79# style: rounded=1;whiteSpace=wrap;html=1;80# connect: {"from":"manager","to":"name","invert":true}81# layout: auto82name,manager83CEO,84CTO,CEO85CFO,CEO86```878889## CRITICAL: XML Well-Formedness9091When generating draw.io XML, the output **must** be well-formed XML:92- **NEVER use double hyphens (`--`) inside XML comments.** Use single hyphens or rephrase (e.g., `<!-- Order 1 to OrderItem -->` not `<!-- Order 1 --- OrderItem -->`)93- Escape special characters in attribute values (`&`, `<`, `>`, `"`)9495## Script Usage9697The script `generate_drawio_url.py` is located in the `scripts/` subdirectory relative to this SKILL.md file. Execute it with command-line arguments:9899```bash100python scripts/generate_drawio_url.py -t mermaid -c "graph TD\n A --> B"101python scripts/generate_drawio_url.py --type xml --code "<mxGraphModel>...</mxGraphModel>"102python scripts/generate_drawio_url.py -t csv -c "name,manager\nCEO,\nCTO,CEO"103```104105**Arguments:**106- `-t, --type`: Diagram type (required), choices: `mermaid`, `xml`, `csv`107- `-c, --code`: Diagram code content (required)108109The script outputs a markdown link: `[点击查看图表](<URL>)`110111Present the markdown link directly to the user.