Token导航 LogoToken导航TokenDH.com
前端设计external-servicegithub未标认证来源可访问许可证需确认审计提醒

drawio-generator绘图生成器

Agent Skill

drawio-generator 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

269

周安装

11

GitHub Stars

公开资料未说明

下载量

87
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:drawio-generator(绘图生成器)
来源仓库:https://github.com/enriquecatala/skills
仓库路径:skills/drawio-generator
安装命令:
npx skills add https://github.com/enriquecatala/skills --skill drawio-generator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/enriquecatala/skills --skill drawio-generator

简介

将自然语言转换为 Draw.io (mxGraph) XML 图表,支持流程图与架构图生成。

  • 严格遵循 stencil 命名规则与颜色填充要求,确保图形元素正确渲染。
  • 可直接输出可编辑的 .drawio.xml 文件,适用于文档与演示材料制作。
  • 需核对 stencils/*.md 中的可用图元名称,防止使用无效或拼写错误的 stencil。
  • drawio-generator 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Draw.io Diagram Generator

Generate professional-grade Draw.io (mxGraph) XML diagrams from natural language. You ARE the LLM — generate the XML directly, validate it, fix issues, and deliver.

Critical Rules

Structure Rules

  • S1: Check Stencil Names 🚨 NEVER guess stencil names. Check stencils/*.md for EXACT names. Wrong: mxgraph.cisco.router → Correct: mxgraph.cisco.routers.router
  • S2: Stencils Require fillColor Many stencils have no default color. Always add fillColor/strokeColor. Exception: edge/link stencils are connectors, not devices.
  • S3: Root Cells Required Must include <mxCell id="0"/> and <mxCell id="1" parent="0"/> or diagram won't render.
  • S4: Labels Below Stencils Use verticalLabelPosition=bottom;verticalAlign=top;labelPosition=center;align=center; for device/icon labels.
  • S5: mxCell Must Be Siblings ALL mxCell elements must be siblings under <root> — NEVER nest mxCell inside another mxCell.
  • S6: Container Transparency For container shapes, use fillColor=none; to make background transparent and prevent covering child elements.
  • S7: No Array Elements ⚠️ NEVER use <Array> elements in mxGeometry — this CRASHES draw.io! Let draw.io auto-route edges. Use exitX/exitY/entryX/entryY style params instead.
  • S8: No XML Comments NEVER include <!--... --> in generated XML — breaks editing.

Layout Rules

  • L1: Starting Margin Begin positioning from x=40, y=40.
  • L2: Element Spacing Keep 40-60px gaps between connected shapes; 150-200px for routing channels between groups.
  • L3: Compact Layouts Use vertical stacking or grid layouts. Keep within x: 0-800, y: 0-600 viewport. Avoid spreading elements too far apart.

Edge Routing Rules — CRITICAL for Clean Diagrams

  • E1: No Shared Paths Multiple edges between same nodes must use DIFFERENT exit/entry positions (exitY=0.3 and exitY=0.7, NOT both 0.5).
  • E2: Bidirectional Use Opposite Sides A→B: exitX=1, entryX=0. B→A: exitX=0, entryX=1.
  • E3: Explicit Exit/Entry Points Every edge should specify: exitX, exitY, entryX, entryY in style.
  • E4: Route Around Obstacles If any shape is between source and target, let draw.io auto-route with edgeStyle=orthogonalEdgeStyle. Do NOT use <Array> waypoints.
  • E5: Plan Layout First Organize shapes into columns/rows. Trace each edge mentally: "What shapes are between source and target?"
  • E6: Natural Connection Points NEVER use corners (entryX=1,entryY=1). Top-to-bottom: exitY=1, entryY=0. Left-to-right: exitX=1, entryX=0.
  • E7: Diagonal Routing Principle When connecting distant nodes diagonally, route along the PERIMETER of the diagram, NOT through the middle where other shapes exist.

Pre-Generation Checklist

  1. Do any edges cross over non-source/target shapes? → Rearrange layout
  2. Do any two edges share the same path? → Adjust exit/entry points
  3. Are any connections at corners? → Use edge centers instead
  4. Could rearranging shapes reduce crossings? → Revise layout

Workflow

1. Understand the Request

Determine:

  • Diagram type: Cloud architecture, microservices, network, UML, ERD, etc.
  • Components: Systems, services, databases, actors involved
  • Relationships: Connections (sync/async, data flow, dependencies)

If the user provides a file (PDF, DOCX, TXT, MD), read it and extract entities, relationships, and processes.

2. Read the Prompt References

Before generating, read these files for rules and styling guidance:

  • references/drawio_system_prompt.txt — the master system prompt with all XML rules
  • references/color_palette.md — professional colors by component type
  • references/drawio_xml_rules.md — quick-reference for mxGraph syntax

Also study assets/example_simple.drawio as a structural reference.

3. Select Stencils (if applicable)

If the diagram involves vendor-specific icons (AWS, Azure, GCP, Cisco, Kubernetes, etc.):

  1. Identify which stencil library to use from the table below
  2. Read the corresponding stencils/<category>.md file for EXACT shape names
  3. Note the required fillColor and recommended dimensions for each shape

NEVER guess stencil names — always verify against the stencil file.

4. Plan the Layout (Multi-Phase for Complex Diagrams)

For diagrams with >15 components, use this phased approach:

  • P1: Plan — Identify diagram type, choose canvas size, select stencil libraries. Plan element positions first, then derive zone boundaries.
  • P2: Zones — Write zone/container cells FIRST in XML (drawio renders by document order). Solid fill: rounded=1;fillColor=#BAC8D3;strokeColor=none;opacity=60. Dashed border: rounded=1;dashed=1;dashPattern=8 8;fillColor=none;strokeColor=#0BA5C4.
  • P3: Elements — Position shapes on grid (multiples of 10/20). Keep consistent device style per stencil family.
  • P4: Connections — Add edges last. Network links: endArrow=none;endFill=0. Data flow: endArrow=classic. Dashed for logical/VPN: dashed=1.
  • P5: Labels — Add floating text, legends. Verify every element has a value or adjacent label.
  • P6: Chunking — When a diagram exceeds ~30 elements, split XML output into chunks.

5. Generate the Draw.io XML

Following the system prompt rules, generate the complete mxFile XML. Key rules:

  • Use the exact root skeleton: <mxfile><diagram><mxGraphModel><root>
  • Always include <mxCell id="0"/> and <mxCell id="1" parent="0"/>
  • Shapes: vertex="1" parent="1" with unique descriptive IDs
  • Edges: edge="1" parent="1" with valid source and target
  • NEVER use <Array> elements — crashes draw.io
  • Use color palette by component type
  • Position shapes at grid multiples of 10 or 20
  • Labels match the user's language

Save the XML to a .drawio file using write_to_file.

6. Validate (ReAct Loop)

Run the validator script on the saved file:

python .agent/skills/drawio-generator/scripts/validate_drawio.py <output_file.drawio>
  • If ✅ valid → proceed to step 7
  • If ❌ errors → read the error messages, fix the XML, save again, re-validate
  • Repeat until all checks pass

Common fixes:

  • Duplicate IDs: Renumber cells sequentially
  • Broken edges: Ensure source/target IDs exist as vertex cells
  • Array elements: Remove <Array> children from edge geometries
  • Malformed XML: Fix unclosed tags, unescape & or < in labels

7. Deliver

Tell the user:

  • Where the .drawio file was saved
  • Brief design concept (what architectural decisions you made)
  • How to open: draw.io desktop, app.diagrams.net, or VS Code Draw.io extension

8. Iterative Refinement

If the user wants changes to an existing diagram:

  1. Read the current .drawio file
  2. Modify the XML preserving existing IDs where possible
  3. Save, validate, and deliver the updated file

Stencil Libraries

drawio provides 8900+ pre-built stencils across 48 categories. Full stencil reference: See stencils/*.md files.

CategoryStencil FileUse Case
AWSaws4.mdAWS cloud architecture (1031 shapes)
Azureazure.md, mscae.mdAzure cloud & enterprise architecture
GCPgcp2.mdGoogle Cloud architecture
Ciscocisco.md, cisco19.md, cisco_safe.mdNetwork topology
Kuberneteskubernetes.md, kubernetes2.mdContainer orchestration
Networknetworks.md, networks2.mdGeneral network diagrams
Virtualizationcitrix.md, citrix2.md, veeam.md, vvd.mdInfrastructure diagrams
Softwarebpmn.md, flowchart.md, sitemap.md, mockup.mdProcess & UI design
Hardwarerack.md, cabinets.md, electrical.mdData center & electrical
Officeoffice.md, atlassian.md, salesforce.mdBusiness diagrams
Cloud (Other)alibaba_cloud.md, ibm_cloud.mdOther cloud providers

Stencil Usage Example

<!-- Cisco router with label below -->
<mxCell id="router1" value="Core Router" style="shape=mxgraph.cisco.routers.router;html=1;fillColor=#036897;strokeColor=#ffffff;strokeWidth=2;verticalLabelPosition=bottom;verticalAlign=top;labelPosition=center;align=center;" vertex="1" parent="1">
  <mxGeometry x="100" y="100" width="78" height="53" as="geometry"/>
</mxCell>

<!-- AWS Lambda -->
<mxCell id="lambda1" value="Lambda" style="shape=mxgraph.aws4.lambda;html=1;fillColor=#ED7100;strokeColor=none;verticalLabelPosition=bottom;verticalAlign=top;" vertex="1" parent="1">
  <mxGeometry x="200" y="100" width="54" height="56" as="geometry"/>
</mxCell>

<!-- Kubernetes pod -->
<mxCell id="pod1" value="API Pod" style="shape=mxgraph.kubernetes.pod;html=1;fillColor=#326CE5;strokeColor=#ffffff;strokeWidth=2;verticalLabelPosition=bottom;verticalAlign=top;" vertex="1" parent="1">
  <mxGeometry x="300" y="100" width="50" height="50" as="geometry"/>
</mxCell>

Common Shapes Reference

Basic Shapes

<mxCell id="rect" value="Box" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
  <mxGeometry x="20" y="20" width="100" height="50" as="geometry"/></mxCell>
<mxCell id="rounded" value="Rounded" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
  <mxGeometry x="140" y="20" width="100" height="50" as="geometry"/></mxCell>
<mxCell id="circle" value="Circle" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
  <mxGeometry x="260" y="10" width="70" height="70" as="geometry"/></mxCell>
<mxCell id="db" value="Database" style="shape=cylinder;whiteSpace=wrap;html=1;" vertex="1" parent="1">
  <mxGeometry x="350" y="5" width="60" height="80" as="geometry"/></mxCell>
<mxCell id="cloud" value="Cloud" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="1">
  <mxGeometry x="430" y="10" width="100" height="70" as="geometry"/></mxCell>

Container / Swimlane

<!-- Swimlane with child elements (relative positioning) -->
<mxCell id="lane1" value="Frontend" style="swimlane;" vertex="1" parent="1">
  <mxGeometry x="40" y="40" width="200" height="200" as="geometry"/></mxCell>
<mxCell id="step1" value="Step 1" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="lane1">
  <mxGeometry x="20" y="60" width="160" height="40" as="geometry"/></mxCell>

Note: Children use parent="lane1" with coordinates RELATIVE to the swimlane. Edges always use parent="1".

Edge Patterns

<!-- Basic directional edge -->
<mxCell style="edgeStyle=orthogonalEdgeStyle;endArrow=classic;html=1;" edge="1" parent="1" source="a" target="b">
  <mxGeometry relative="1" as="geometry"/></mxCell>

<!-- Bidirectional: use different exit/entry Y positions -->
<mxCell id="e1" value="Request" style="edgeStyle=orthogonalEdgeStyle;exitX=1;exitY=0.3;entryX=0;entryY=0.3;endArrow=classic;html=1;" edge="1" parent="1" source="nodeA" target="nodeB">
  <mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e2" value="Response" style="edgeStyle=orthogonalEdgeStyle;exitX=0;exitY=0.7;entryX=1;entryY=0.7;endArrow=classic;html=1;" edge="1" parent="1" source="nodeB" target="nodeA">
  <mxGeometry relative="1" as="geometry"/></mxCell>

Common Style Reference

  • Arrow Types: Inheritance(endArrow=block;endFill=0) Implementation(endArrow=block;endFill=0;dashed=1) Association(endArrow=open;endFill=1) Dependency(endArrow=open;dashed=1) Aggregation(startArrow=diamondThin;startFill=0) Composition(startArrow=diamondThin;startFill=1)
  • Shape Styles: rounded(0,1) fillColor(hex) strokeColor(hex) strokeWidth(num) dashed(0,1) opacity(0-100) fontColor(hex) fontSize(num) fontStyle(0=normal,1=bold,2=italic,3=both) align(left,center,right) verticalAlign(top,middle,bottom) shadow(0,1)
  • Edge Styles: edgeStyle(orthogonalEdgeStyle,entityRelationEdgeStyle,elbowEdgeStyle) curved(0,1) endArrow/startArrow(classic,block,open,oval,diamond,none) endFill/startFill(0=hollow,1=filled)
  • State Colors: Pending(#dae8fc,#6c8ebf) Success(#d5e8d4,#82b366) Error(#f8cecc,#b85450) Warning(#fff2cc,#d6b656) Complete(#e1d5e7,#9673a6)

Common Pitfalls

IssueSolution
Shape not visibleVerify vertex="1" and parent="1" attributes
Edge not connectingEnsure source and target match cell IDs
Styles not applyingCheck semicolon separators in style string
Text not showingAdd html=1;whiteSpace=wrap; to style
Stencil not renderingVerify exact name in stencils/*.md, add fillColor
Edges crossing shapesRearrange layout to minimize crossings
Multiple edges overlappingUse different exitY/entryY values (0.3 and 0.7)
Corner connections look uglyUse edge centers instead (exitX=1,exitY=0.5)
Diagram too spread outKeep within x: 0-800, y: 0-600 viewport
XML crashes draw.ioRemove <Array> elements, fix unclosed tags

Tips for AI Generation

  1. Plan layout first: Sketch positions mentally before writing XML — identify potential edge crossings
  2. Use grid alignment: Position shapes at multiples of 10 or 20
  3. Unique IDs: Use descriptive IDs like client, server, db instead of random strings
  4. Consistent spacing: Keep 40-60px gaps between connected shapes; 150-200px for routing channels
  5. Layer backgrounds first: Define zone/container cells before shapes inside them
  6. Color zones: Use light background colors with strokeColor=none for region highlighting
  7. Verify edges mentally: Before generating, trace each edge and ask "Does this cross any shape?"
  8. Escape special characters: Use < for <, > for >, & for &, " for "

Files

PathPurpose
scripts/validate_drawio.pyXML validator — run after every generation
references/drawio_system_prompt.txtMaster system prompt with all mxGraph rules
references/drawio_xml_rules.mdQuick-reference for XML syntax
references/color_palette.mdProfessional colors by component type
assets/example_simple.drawioWorking example for structural reference
stencils/*.mdStencil libraries — 48 categories, 8900+ shapes

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.79%
按下载量换算29

Claude

32.29%
按下载量换算28

Cursor

18.32%
按下载量换算16

Gemini CLI

10.47%
按下载量换算9

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills