drawio-diagram

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Draw.io 图表

Draw.io Diagrams

本 Skill 指导 Agent 生成标准的 Draw.io 格式图表(.drawio 文件),支持两种模式:从零生成(模型架构、算法流程等)与风格迁移(参考图 + 内容 → 按参考图风格生成新图)。
This Skill guides the Agent to generate standard Draw.io format diagrams (.drawio files), supporting two modes: generation from scratch (model architecture, algorithm workflow, etc.) and style migration (reference image + content → generate new diagrams following the style of the reference image).

Step 0:任务识别

Step 0: Task Identification

条件执行
用户提供参考图,且希望「按这张图的风格」画新图执行
reference/style-migration.md
其他情况(从零生成)执行
reference/generation.md
ConditionAction
User provides a reference image and wants to draw a new diagram "following the style of this image"Execute
reference/style-migration.md
Other cases (generation from scratch)Execute
reference/generation.md

使用时机

When to Use

从零生成:
  • 用户需要为深度学习模型(如 Transformer、CNN、RNN 等)生成架构图
  • 用户需要绘制算法流程图、数据流图、系统架构图
  • 用户需要可视化特定概念(如感受野、注意力机制、特征提取过程等)
  • 用户提到「画个图」「生成架构图」「可视化模型结构」「绘制流程图」等需求
风格迁移:
  • 用户提供参考图,希望「按这个风格画」「照着这个排版/配色画」
Generation from Scratch:
  • Users need to generate architecture diagrams for deep learning models (such as Transformer, CNN, RNN, etc.)
  • Users need to draw algorithm flowcharts, data flow diagrams, system architecture diagrams
  • Users need to visualize specific concepts (such as receptive field, attention mechanism, feature extraction process, etc.)
  • Users mention requirements such as "draw a diagram", "generate architecture diagram", "visualize model structure", "draw flowchart", etc.
Style Migration:
  • Users provide a reference image and want to "draw in this style", "draw following this layout/color scheme"

通用规范(两种模式共用)

General Specifications (applicable to both modes)

1. XML 格式严格性

1. XML Format Strictness

  • ✅ 所有标签必须正确闭合:
    <mxCell>
    对应
    </mxCell>
    ,绝不能写成
    </mCell>
  • ✅ 使用
    vertex="1"
    标记节点,
    edge="1"
    标记连线
  • ✅ 每个元素必须有唯一
    id
    ,从 0 开始递增
  • ✅ 特殊字符必须转义:
    &
    &amp;
    <
    &lt;
    >
    &gt;
  • ✅ All tags must be properly closed:
    <mxCell>
    corresponds to
    </mxCell>
    , never write as
    </mCell>
  • ✅ Use
    vertex="1"
    to mark nodes,
    edge="1"
    to mark connections
  • ✅ Each element must have a unique
    id
    , incrementing from 0
  • ✅ Special characters must be escaped:
    &
    &amp;
    ,
    <
    &lt;
    ,
    >
    &gt;

2. 标准文件结构

2. Standard File Structure

xml
<mxfile host="app.diagrams.net">
  <diagram name="图表名称" id="图表id">
    <mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="宽度" pageHeight="高度" background="#F5F5DC">
      <root>
        <mxCell id="0"/>
        <mxCell id="1" parent="0"/>
        <!-- 所有图形元素从 id="2" 开始 -->
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
xml
<mxfile host="app.diagrams.net">
  <diagram name="图表名称" id="图表id">
    <mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="宽度" pageHeight="高度" background="#F5F5DC">
      <root>
        <mxCell id="0"/>
        <mxCell id="1" parent="0"/>
        <!-- 所有图形元素从 id="2" 开始 -->
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

3. 常用样式

3. Common Styles

  • 节点
    rounded=1;whiteSpace=wrap;html=1;fillColor=#颜色;strokeColor=#333333;strokeWidth=1;fontSize=11
  • 连线
    edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#000000;strokeWidth=2;endArrow=classic
  • 虚线(残差)
    dashed=1
  • Node:
    rounded=1;whiteSpace=wrap;html=1;fillColor=#color;strokeColor=#333333;strokeWidth=1;fontSize=11
  • Connection:
    edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;strokeColor=#000000;strokeWidth=2;endArrow=classic
  • Dashed line (residual):
    dashed=1

4. 输出要求

4. Output Requirements

  1. 图表说明(2-3 行)
  2. 使用指南:Draw.io 打开、导出 PNG/SVG/PDF、图题与论文引用示例
  1. Diagram description (2-3 lines)
  2. Usage guide: opening in Draw.io, exporting PNG/SVG/PDF, diagram title and paper citation examples

参考资源

Reference Resources