Loading...
Loading...
Compare original and translation side by side
(0,0) ────────── x increases ──────────►
│
│ ┌──────────┐ ┌──────────┐
│ │ Box A │─────►│ Box B │
│ └──────────┘ └──────────┘
│ │
y ▼
increases ┌──────────┐
│ │ Box C │
▼ └──────────┘(0,0) ────────── x轴向右递增 ──────────►
│
│ ┌──────────┐ ┌──────────┐
│ │ 图形A │─────►│ 图形B │
│ └──────────┘ └──────────┘
│ │
y ▼
轴向 ┌──────────┐
下递 │ 图形C │
增 └──────────┘| Tool | What It Does | When to Use |
|---|---|---|
| Returns color palette + sizing rules | First call. Read once, use throughout. |
| Create many shapes + arrows at once | Main workhorse. Create your whole diagram in 1-2 calls. |
| Take a photo of the current canvas | After every batch. Verify it looks right. |
| Wipe everything | Start fresh before a new diagram. |
| Save as PNG or SVG | Final step if user wants an image file. |
describe_scenecreate_from_mermaidexport_sceneset_viewportexport_to_excalidraw_url| 工具 | 功能 | 使用场景 |
|---|---|---|
| 返回调色板、尺寸规则 | 首次调用。读取一次,全程使用。 |
| 批量创建多个图形和箭头 | 主要工具。1-2次调用即可创建完整图表。 |
| 截取当前画布的截图 | 每次批量操作后。验证图表显示是否正确。 |
| 清空画布所有内容 | 创建新图表前重置画布。 |
| 保存为PNG或SVG格式 | 用户需要图片文件时的最终步骤。 |
describe_scenecreate_from_mermaidexport_sceneset_viewportexport_to_excalidraw_url{
"type": "rectangle",
"id": "my-box",
"x": 100,
"y": 100,
"width": 180,
"height": 70,
"backgroundColor": "#a5d8ff",
"strokeColor": "#1971c2",
"roughness": 0,
"text": "My Service\nPort 8080"
}textroughness: 0roughness: 1\nrectangleellipsediamondtext{
"type": "rectangle",
"id": "my-box",
"x": 100,
"y": 100,
"width": 180,
"height": 70,
"backgroundColor": "#a5d8ff",
"strokeColor": "#1971c2",
"roughness": 0,
"text": "我的服务\n端口 8080"
}textroughness: 0roughness: 1\nrectangleellipsediamondtext{
"type": "arrow",
"x": 0,
"y": 0,
"startElementId": "my-box",
"endElementId": "other-box",
"strokeColor": "#1971c2",
"text": "HTTP"
}startElementIdendElementIdidx, ytextstrokeStyle: "dashed""dotted"startArrowheadendArrowhead"arrow""dot""triangle""bar"null{
"type": "arrow",
"x": 0,
"y": 0,
"startElementId": "my-box",
"endElementId": "other-box",
"strokeColor": "#1971c2",
"text": "HTTP"
}startElementIdendElementIdidx, ytextstrokeStyle: "dashed""dotted"startArrowheadendArrowhead"arrow""dot""triangle""bar"null\n\nmcp__excalidraw__read_diagram_guide()mcp__excalidraw__read_diagram_guide()mcp__excalidraw__clear_canvas()
mcp__excalidraw__get_canvas_screenshot() // MUST verify empty!mcp__excalidraw__clear_canvas()
mcp__excalidraw__get_canvas_screenshot() // 必须验证画布为空!Vertical flow (most common):
Row 1 (y=0): Zone backgrounds (large dashed rectangles)
Row 2 (y=60): Entry points / Users
Row 3 (y=350): Middle layer (APIs, services)
Row 4 (y=650): Data layer (databases, storage)
Columns: x = 40, 440, 840 (spaced 400px apart for labeled arrows)
Box size: 230 x 160 (standard) | 200 x 120 (for decision diamonds)
Spacing between rows: ~200px gap after accounting for box height
Spacing between boxes in a row: 180px gap (for arrow labels)垂直流(最常见):
第1行(y=0): 区域背景(大虚线矩形)
第2行(y=60): 入口点/用户
第3行(y=350): 中间层(API、服务)
第4行(y=650): 数据层(数据库、存储)
列间距:x = 40, 440, 840 (带标签的箭头间距为400px)
图形尺寸:230x160(标准) | 200x120(决策菱形)
行间距:约200px(包含图形高度后的间隙)
同行图形间距:180px(用于箭头标签)batch_create_elementsidstartElementIdendElementIdbatch_create_elementsidstartElementIdendElementIdmcp__excalidraw__get_canvas_screenshot()mcp__excalidraw__get_canvas_screenshot()update_elementdelete_elementcreate_elementupdate_elementdelete_elementcreate_elementmcp__excalidraw__set_viewport({ scrollToContent: true })mcp__excalidraw__set_viewport({ scrollToContent: true })mcp__excalidraw__export_to_image({ format: "png", filePath: "/path/to/output.png" })
mcp__excalidraw__export_scene({ filePath: "/path/to/output.excalidraw" })
mcp__excalidraw__export_to_excalidraw_url() // shareable linkmcp__excalidraw__export_to_image({ format: "png", filePath: "/path/to/output.png" })
mcp__excalidraw__export_scene({ filePath: "/path/to/output.excalidraw" })
mcp__excalidraw__export_to_excalidraw_url() // 生成可分享链接batch_create_elements{
"elements": [
// --- ZONE BACKGROUNDS (render behind everything) ---
{
"type": "rectangle", "id": "zone-frontend",
"x": 0, "y": 0, "width": 500, "height": 160,
"backgroundColor": "#e9ecef", "strokeColor": "#868e96",
"strokeStyle": "dashed", "opacity": 40, "roughness": 0
},
{
"type": "text", "x": 10, "y": 10,
"text": "Frontend Layer", "fontSize": 14, "strokeColor": "#868e96"
},
{
"type": "rectangle", "id": "zone-backend",
"x": 0, "y": 200, "width": 500, "height": 160,
"backgroundColor": "#eebefa", "strokeColor": "#9c36b5",
"strokeStyle": "dashed", "opacity": 30, "roughness": 0
},
{
"type": "text", "x": 10, "y": 210,
"text": "Backend Layer", "fontSize": 14, "strokeColor": "#9c36b5"
},
// --- SHAPES (give each an id so arrows can reference them) ---
{
"type": "rectangle", "id": "react-app",
"x": 40, "y": 50, "width": 180, "height": 70,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "React App\nFrontend"
},
{
"type": "rectangle", "id": "api-server",
"x": 40, "y": 250, "width": 180, "height": 70,
"backgroundColor": "#d0bfff", "strokeColor": "#7048e8", "roughness": 0,
"text": "API Server\nExpress.js"
},
{
"type": "rectangle", "id": "database",
"x": 280, "y": 250, "width": 180, "height": 70,
"backgroundColor": "#b2f2bb", "strokeColor": "#2f9e44", "roughness": 0,
"text": "PostgreSQL\nDatabase"
},
// --- ARROWS (connect shapes by ID) ---
{
"type": "arrow", "x": 130, "y": 120,
"startElementId": "react-app", "endElementId": "api-server",
"strokeColor": "#1971c2", "text": "REST API"
},
{
"type": "arrow", "x": 220, "y": 285,
"startElementId": "api-server", "endElementId": "database",
"strokeColor": "#2f9e44", "text": "SQL"
},
// --- TITLE ---
{
"type": "text", "x": 100, "y": -40,
"text": "System Architecture", "fontSize": 24, "strokeColor": "#1e1e1e"
}
]
}batch_create_elements{
"elements": [
// --- 区域背景(渲染在所有元素后方) ---
{
"type": "rectangle", "id": "zone-frontend",
"x": 0, "y": 0, "width": 500, "height": 160,
"backgroundColor": "#e9ecef", "strokeColor": "#868e96",
"strokeStyle": "dashed", "opacity": 40, "roughness": 0
},
{
"type": "text", "x": 10, "y": 10,
"text": "前端层", "fontSize": 14, "strokeColor": "#868e96"
},
{
"type": "rectangle", "id": "zone-backend",
"x": 0, "y": 200, "width": 500, "height": 160,
"backgroundColor": "#eebefa", "strokeColor": "#9c36b5",
"strokeStyle": "dashed", "opacity": 30, "roughness": 0
},
{
"type": "text", "x": 10, "y": 210,
"text": "后端层", "fontSize": 14, "strokeColor": "#9c36b5"
},
// --- 图形(为每个图形设置id以便箭头引用) ---
{
"type": "rectangle", "id": "react-app",
"x": 40, "y": 50, "width": 180, "height": 70,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "React应用\n前端"
},
{
"type": "rectangle", "id": "api-server",
"x": 40, "y": 250, "width": 180, "height": 70,
"backgroundColor": "#d0bfff", "strokeColor": "#7048e8", "roughness": 0,
"text": "API服务器\nExpress.js"
},
{
"type": "rectangle", "id": "database",
"x": 280, "y": 250, "width": 180, "height": 70,
"backgroundColor": "#b2f2bb", "strokeColor": "#2f9e44", "roughness": 0,
"text": "PostgreSQL\n数据库"
},
// --- 箭头(通过ID连接图形) ---
{
"type": "arrow", "x": 130, "y": 120,
"startElementId": "react-app", "endElementId": "api-server",
"strokeColor": "#1971c2", "text": "REST API"
},
{
"type": "arrow", "x": 220, "y": 285,
"startElementId": "api-server", "endElementId": "database",
"strokeColor": "#2f9e44", "text": "SQL"
},
// --- 标题 ---
{
"type": "text", "x": 100, "y": -40,
"text": "系统架构", "fontSize": 24, "strokeColor": "#1e1e1e"
}
]
}{
"elements": [
// --- TITLE ---
{"type": "text", "x": 20, "y": 10, "text": "Data Flow: parameter_name Threading", "fontSize": 24, "strokeColor": "#1e1e1e"},
{"type": "text", "x": 20, "y": 48, "text": "Subtitle describing the trace", "fontSize": 16, "strokeColor": "#868e96"},
// --- WHY SECTION (top-right, first-principles context) ---
{"type": "rectangle", "id": "why-bg", "x": 460, "y": 80, "width": 440, "height": 310,
"backgroundColor": "#e9ecef", "strokeColor": "#868e96", "roughness": 0},
{"type": "text", "x": 480, "y": 95, "text": "WHY: The Problem", "fontSize": 20, "strokeColor": "#e03131"},
{"type": "text", "x": 480, "y": 135, "text": "1. What currently happens", "fontSize": 16, "strokeColor": "#1e1e1e"},
{"type": "text", "x": 480, "y": 195, "text": "2. Why it's expensive/wrong", "fontSize": 16, "strokeColor": "#e03131"},
{"type": "text", "x": 480, "y": 275, "text": "3. Gap in current design", "fontSize": 16, "strokeColor": "#1e1e1e"},
{"type": "text", "x": 480, "y": 335, "text": "Solution: what this change does", "fontSize": 16, "strokeColor": "#2f9e44"},
// --- FLOW BOXES (center column, 150px vertical pitch) ---
{"type": "rectangle", "id": "l1", "x": 60, "y": 420, "width": 300, "height": 65,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "Entry Point\nfile/path.py"},
// Split into two paths
{"type": "rectangle", "id": "l2a", "x": -100, "y": 570, "width": 290, "height": 65,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "Path A\nfile/path_a.py"},
{"type": "rectangle", "id": "l2b", "x": 230, "y": 570, "width": 290, "height": 65,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "Path B\nfile/path_b.py"},
// Converge point
{"type": "rectangle", "id": "l4", "x": 60, "y": 720, "width": 300, "height": 65,
"backgroundColor": "#eebefa", "strokeColor": "#9c36b5", "roughness": 0,
"text": "Convergence Point\nfile/path_merge.py"},
// Decision
{"type": "diamond", "id": "dec", "x": 110, "y": 870, "width": 200, "height": 120,
"backgroundColor": "#fff3bf", "strokeColor": "#fab005", "roughness": 0,
"text": "condition?"},
// Outcome branches
{"type": "rectangle", "id": "yes", "x": -100, "y": 1080, "width": 260, "height": 65,
"backgroundColor": "#ffc9c9", "strokeColor": "#e03131", "roughness": 0,
"text": "Expensive Operation"},
{"type": "rectangle", "id": "no", "x": 250, "y": 1080, "width": 220, "height": 65,
"backgroundColor": "#b2f2bb", "strokeColor": "#2f9e44", "roughness": 0,
"text": "Skip / Fast Path"},
// --- ARROWS (bound by ID, auto-routed) ---
{"type": "arrow", "x": 150, "y": 485, "startElementId": "l1", "endElementId": "l2a",
"text": "Path A label", "strokeColor": "#1971c2"},
{"type": "arrow", "x": 280, "y": 485, "startElementId": "l1", "endElementId": "l2b",
"text": "Path B label", "strokeColor": "#1971c2"},
{"type": "arrow", "x": 45, "y": 635, "startElementId": "l2a", "endElementId": "l4",
"text": "data form", "strokeColor": "#9c36b5"},
{"type": "arrow", "x": 375, "y": 635, "startElementId": "l2b", "endElementId": "l4",
"text": "data form", "strokeColor": "#1971c2", "strokeStyle": "dashed"},
{"type": "arrow", "x": 210, "y": 785, "startElementId": "l4", "endElementId": "dec",
"strokeColor": "#2f9e44"},
{"type": "arrow", "x": 150, "y": 990, "startElementId": "dec", "endElementId": "yes",
"text": "True", "strokeColor": "#e03131"},
{"type": "arrow", "x": 270, "y": 990, "startElementId": "dec", "endElementId": "no",
"text": "False", "strokeColor": "#2f9e44"},
// --- LAYER LABELS (left column, gray) ---
{"type": "text", "x": -100, "y": 420, "text": "Layer 1\nEntry", "fontSize": 14, "strokeColor": "#868e96"},
{"type": "text", "x": -210, "y": 570, "text": "Layer 2\nBackend", "fontSize": 14, "strokeColor": "#868e96"},
// --- DATA FORM ANNOTATIONS (right column, orange) ---
{"type": "text", "x": 570, "y": 440, "text": "Data form: Python bool", "fontSize": 14, "strokeColor": "#e8590c"},
{"type": "text", "x": 570, "y": 590, "text": "Data form: JSON / arg", "fontSize": 14, "strokeColor": "#e8590c"},
{"type": "text", "x": 570, "y": 740, "text": "Data form: Dataclass", "fontSize": 14, "strokeColor": "#e8590c"}
]
}{
"elements": [
// --- 标题 ---
{"type": "text", "x": 20, "y": 10, "text": "数据流:parameter_name 传递轨迹", "fontSize": 24, "strokeColor": "#1e1e1e"},
{"type": "text", "x": 20, "y": 48, "text": "轨迹描述副标题", "fontSize": 16, "strokeColor": "#868e96"},
// --- 原因说明区(右上角,底层逻辑背景) ---
{"type": "rectangle", "id": "why-bg", "x": 460, "y": 80, "width": 440, "height": 310,
"backgroundColor": "#e9ecef", "strokeColor": "#868e96", "roughness": 0},
{"type": "text", "x": 480, "y": 95, "text": "原因:存在的问题", "fontSize": 20, "strokeColor": "#e03131"},
{"type": "text", "x": 480, "y": 135, "text": "1. 当前现状", "fontSize": 16, "strokeColor": "#1e1e1e"},
{"type": "text", "x": 480, "y": 195, "text": "2. 问题的影响(成本高/错误)", "fontSize": 16, "strokeColor": "#e03131"},
{"type": "text", "x": 480, "y": 275, "text": "3. 当前设计的缺陷", "fontSize": 16, "strokeColor": "#1e1e1e"},
{"type": "text", "x": 480, "y": 335, "text": "解决方案:本次改动的作用", "fontSize": 16, "strokeColor": "#2f9e44"},
// --- 流程图形(中间列,垂直间距150px) ---
{"type": "rectangle", "id": "l1", "x": 60, "y": 420, "width": 300, "height": 65,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "入口点\nfile/path.py"},
// 分支为两条路径
{"type": "rectangle", "id": "l2a", "x": -100, "y": 570, "width": 290, "height": 65,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "路径A\nfile/path_a.py"},
{"type": "rectangle", "id": "l2b", "x": 230, "y": 570, "width": 290, "height": 65,
"backgroundColor": "#a5d8ff", "strokeColor": "#1971c2", "roughness": 0,
"text": "路径B\nfile/path_b.py"},
// 汇聚点
{"type": "rectangle", "id": "l4", "x": 60, "y": 720, "width": 300, "height": 65,
"backgroundColor": "#eebefa", "strokeColor": "#9c36b5", "roughness": 0,
"text": "汇聚点\nfile/path_merge.py"},
// 决策节点
{"type": "diamond", "id": "dec", "x": 110, "y": 870, "width": 200, "height": 120,
"backgroundColor": "#fff3bf", "strokeColor": "#fab005", "roughness": 0,
"text": "条件判断?"},
// 结果分支
{"type": "rectangle", "id": "yes", "x": -100, "y": 1080, "width": 260, "height": 65,
"backgroundColor": "#ffc9c9", "strokeColor": "#e03131", "roughness": 0,
"text": "高成本操作"},
{"type": "rectangle", "id": "no", "x": 250, "y": 1080, "width": 220, "height": 65,
"backgroundColor": "#b2f2bb", "strokeColor": "#2f9e44", "roughness": 0,
"text": "跳过/快速路径"},
// --- 箭头(通过ID绑定,自动路由) ---
{"type": "arrow", "x": 150, "y": 485, "startElementId": "l1", "endElementId": "l2a",
"text": "路径A标签", "strokeColor": "#1971c2"},
{"type": "arrow", "x": 280, "y": 485, "startElementId": "l1", "endElementId": "l2b",
"text": "路径B标签", "strokeColor": "#1971c2"},
{"type": "arrow", "x": 45, "y": 635, "startElementId": "l2a", "endElementId": "l4",
"text": "数据格式", "strokeColor": "#9c36b5"},
{"type": "arrow", "x": 375, "y": 635, "startElementId": "l2b", "endElementId": "l4",
"text": "数据格式", "strokeColor": "#1971c2", "strokeStyle": "dashed"},
{"type": "arrow", "x": 210, "y": 785, "startElementId": "l4", "endElementId": "dec",
"strokeColor": "#2f9e44"},
{"type": "arrow", "x": 150, "y": 990, "startElementId": "dec", "endElementId": "yes",
"text": "是", "strokeColor": "#e03131"},
{"type": "arrow", "x": 270, "y": 990, "startElementId": "dec", "endElementId": "no",
"text": "否", "strokeColor": "#2f9e44"},
// --- 层级标签(左列,灰色) ---
{"type": "text", "x": -100, "y": 420, "text": "层级1\n入口", "fontSize": 14, "strokeColor": "#868e96"},
{"type": "text", "x": -210, "y": 570, "text": "层级2\n后端", "fontSize": 14, "strokeColor": "#868e96"},
// --- 数据格式注释(右列,橙色) ---
{"type": "text", "x": 570, "y": 440, "text": "数据格式:Python布尔值", "fontSize": 14, "strokeColor": "#e8590c"},
{"type": "text", "x": 570, "y": 590, "text": "数据格式:JSON / 参数", "fontSize": 14, "strokeColor": "#e8590c"},
{"type": "text", "x": 570, "y": 740, "text": "数据格式:数据类", "fontSize": 14, "strokeColor": "#e8590c"}
]
}| Component Type | Background | Stroke | When to Use |
|---|---|---|---|
| Frontend/UI | | | React, Next.js, web apps |
| Backend/API | | | API servers, processors |
| Database | | | PostgreSQL, Redis, MongoDB |
| Storage | | | S3, file systems |
| AI/ML | | | ML models, AI services |
| External API | | | Third-party services |
| Queue/Event | | | Kafka, RabbitMQ, SQS |
| Cache | | | Redis cache, Memcached |
| Decision/Gate | | | Conditionals, routers |
| Zone/Group | | | Logical groupings |
| 组件类型 | 背景色 | 边框色 | 使用场景 |
|---|---|---|---|
| 前端/UI | | | React、Next.js、Web应用 |
| 后端/API | | | API服务器、处理器 |
| 数据库 | | | PostgreSQL、Redis、MongoDB |
| 存储 | | | S3、文件系统 |
| AI/ML | | | ML模型、AI服务 |
| 外部API | | | 第三方服务 |
| 队列/事件 | | | Kafka、RabbitMQ、SQS |
| 缓存 | | | Redis缓存、Memcached |
| 决策/网关 | | | 条件判断、路由器 |
| 区域/分组 | | | 逻辑分组 |
| Property | Value | Why |
|---|---|---|
| Box width | 200-240px | Fits multiline labels with breathing room |
| Box height | 120-160px | Fits 3-4 line labels comfortably |
| Horizontal gap (labeled arrows) | 150-200px | Arrow labels are ~80-120px wide, need clearance on both sides |
| Horizontal gap (unlabeled arrows) | 100-120px | Just the arrow line + breathing room |
| Column spacing (labeled) | 400px | 220px box + 180px gap |
| Column spacing (unlabeled) | 340px | 220px box + 120px gap |
| Row spacing | 280-350px | 150px box + 150px gap for arrows + annotations |
| Font size (labels) | 16px | Default, readable |
| Font size (titles) | 20-24px | Stands out as header |
| Font size (zone labels) | 14px | Subtle, doesn't compete |
| Zone opacity | 25-40 | Background, not foreground |
| Zone padding | 50-60px around children | Zone borders must NOT hug inner boxes |
| Section header to box gap | 40px | Headers need clearance from boxes below |
| 属性 | 值 | 原因 |
|---|---|---|
| 图形宽度 | 200-240px | 容纳多行标签并留有呼吸空间 |
| 图形高度 | 120-160px | 舒适容纳3-4行标签 |
| 水平间距(带标签箭头) | 150-200px | 箭头标签宽度约80-120px,两侧需要留白 |
| 水平间距(无标签箭头) | 100-120px | 仅需箭头线条+呼吸空间 |
| 列间距(带标签) | 400px | 220px图形 + 180px间距 |
| 列间距(无标签) | 340px | 220px图形 + 120px间距 |
| 行间距 | 280-350px | 150px图形 + 箭头和注释所需的150px间距 |
| 标签字体大小 | 16px | 默认值,清晰可读 |
| 标题字体大小 | 20-24px | 作为标题突出显示 |
| 区域标签字体大小 | 14px | 风格低调,不与主内容冲突 |
| 区域透明度 | 25-40 | 作为背景,不抢占前景注意力 |
| 区域内边距 | 子元素周围50-60px | 区域边框绝不能紧贴内部图形 |
| 章节标题与图形的间距 | 40px | 标题需要与下方图形保持留白 |
Title (y = -40)
[Zone 1: y=0, height=260]
[Box A: x=40] [Box B: x=440] [Box C: x=840]
[Zone 2: y=350, height=260]
[Box D: x=40] [Box E: x=440]
[Zone 3: y=700, height=260]
[Box F: x=240]标题 (y = -40)
[区域1: y=0, 高度=260]
[图形A: x=40] [图形B: x=440] [图形C: x=840]
[区域2: y=350, 高度=260]
[图形D: x=40] [图形E: x=440]
[区域3: y=700, 高度=260]
[图形F: x=240][Source] ──► [Transform 1] ──► [Transform 2] ──► [Output]
x=40 x=440 x=840 x=1240y[源] ──► [转换1] ──► [转换2] ──► [输出]
x=40 x=440 x=840 x=1240y [Consumer A]
▲
│
[Producer] ──► [Event Bus] ──► [Consumer B]
│
▼
[Consumer C] [消费者A]
▲
│
[生产者] ──► [事件总线] ──► [消费者B]
│
▼
[消费者C] Layer Labels Main Flow Column Side Annotations
(left, gray) (center, colored) (right, orange)
Layer 1 ┌─────────────────────┐ Data form: Python bool
User API │ Entry Point │
│ file/path.py │
└──────┬──────┬───────┘
│ │
┌───────┘ └────────┐
▼ ▼
Layer 2 ┌──────────┐ ┌──────────┐ Data form: JSON / bool
Backend │ Path A │ │ Path B │
└────┬─────┘ └────┬─────┘
│ │ (dashed = direct)
▼ │
Layer 3 ┌──────────┐ │ Data form: Dataclass
HTTP │ Server │ │
└────┬─────┘ │
└──────┬───────┘ (converge)
▼
Layer 4 ┌─────────────────────┐ Data form: IPC message
Manager │ Manager │
└──────┬──────────────┘
▼
Layer 5 ┌─────────────────────┐ Data form: Conditional
Executor │ Executor │
└──────┬──────────────┘
▼
◇ Decision? ◇
/ \
True/ \False
▼ ▼
[Yes] [No]| Element | x | y | width | height |
|---|---|---|---|---|
| Main boxes | 60 | +150 per row | 300 | 65 |
| Split left | -100 | row_y | 290 | 65 |
| Split right | 230 | row_y | 290 | 65 |
| Decision diamond | 110 | row_y | 200 | 120 |
| Layer labels | -100 to -50 | aligned to box | — | fontSize: 14 |
| Annotations | 570 | aligned to box | — | fontSize: 14 |
| WHY section | 460, y=80 | — | 440 | 310 |
#868e96ComponentName\nfile/path.py#e8590c#a5d8ff#1971c2#eebefa#9c36b5#b2f2bb#2f9e44#fff3bf#fab005#ffc9c9#e03131#e9ecef#868e96strokeStyle: "dashed"x: 460 层级标签 主流程列 侧边注释
(左列,灰色) (中列,彩色) (右列,橙色)
层级1 ┌─────────────────────┐ 数据格式:Python布尔值
用户API │ 入口点 │
│ file/path.py │
└──────┬──────┬───────┘
│ │
┌───────┘ └────────┐
▼ ▼
层级2 ┌──────────┐ ┌──────────┐ 数据格式:JSON / 布尔值
后端 │ 路径A │ │ 路径B │
└────┬─────┘ └────┬─────┘
│ │ (虚线=直接传递)
▼ │
层级3 ┌──────────┐ │ 数据格式:数据类
HTTP │ 服务器 │ │
└────┬─────┘ │
└──────┬───────┘ (汇聚)
▼
层级4 ┌─────────────────────┐ 数据格式:IPC消息
管理器 │ 管理器 │
└──────┬──────────────┘
▼
层级5 ┌─────────────────────┐ 数据格式:条件判断
执行器 │ 执行器 │
└──────┬──────────────┘
▼
◇ 条件判断? ◇
/ \
是/ \否
▼ ▼
[是分支] [否分支]| 元素 | x坐标 | y坐标 | 宽度 | 高度 |
|---|---|---|---|---|
| 主流程图形 | 60 | 每行增加150 | 300 | 65 |
| 分支左图形 | -100 | 当前行y坐标 | 290 | 65 |
| 分支右图形 | 230 | 当前行y坐标 | 290 | 65 |
| 决策菱形 | 110 | 当前行y坐标 | 200 | 120 |
| 层级标签 | -100至-50 | 与图形对齐 | — | 字体大小:14 |
| 侧边注释 | 570 | 与图形对齐 | — | 字体大小:14 |
| 原因说明区 | 460, y=80 | — | 440 | 310 |
#868e96组件名称\nfile/path.py#e8590c#a5d8ff#1971c2#eebefa#9c36b5#b2f2bb#2f9e44#fff3bf#fab005#ffc9c9#e03131#e9ecef#868e96strokeStyle: "dashed"| Mistake | Fix |
|---|---|
| Ghost elements from previous diagram | Always |
| Arrows don't connect | Set |
| Shapes overlap | Increase spacing. Use 240px column gap, 140px row gap |
| Labels cut off | Make boxes wider (200px+) or use shorter text |
| Can't tell layers apart | Add zone background rectangles with dashed stroke + low opacity |
| Too many colors | Limit to 3-4 fill colors. Same role = same color |
| Diagram too cluttered | Split into multiple diagrams, or use |
| Arrows cross messily | Rearrange shapes so related ones are adjacent. Vertical flow reduces crossings |
| Annotations overlap with flow | Use 3-column layout: labels (x<0), flow (x:60-360), annotations (x:570+) |
| Lost detail from sample diagram | Sample is source of truth for content. Reproduce ALL text verbatim — titles, subtitles, tool lists, metrics, annotations. Size boxes larger if needed |
| 错误 | 修复方案 |
|---|---|
| 之前的图表留下残留元素 | 每次调用 |
| 箭头未正确连接图形 | 将 |
| 图形重叠 | 增加间距。使用240px列间距、140px行间距 |
| 标签被截断 | 加宽图形(200px以上)或缩短文本 |
| 无法区分层级 | 添加带虚线边框和低透明度的区域背景矩形 |
| 颜色过多 | 限制为3-4种填充色。同一角色使用相同颜色 |
| 图表过于杂乱 | 拆分为多个图表,或使用 |
| 箭头交叉混乱 | 重新排列图形,使相关图形相邻。垂直流布局可减少交叉 |
| 注释与流程重叠 | 使用三列布局:标签(x<0)、流程(x:60-360)、注释(x:570+) |
| 丢失示例图表中的细节 | 示例是内容的唯一可信来源。逐字重现所有文本——标题、副标题、工具列表、指标、注释。必要时增大图形尺寸 |
undefinedundefinedundefinedundefinedundefinedundefined
---
---| Method | Output | Use Case |
|---|---|---|
| PNG file | Embed in docs, Slack, PRs |
| SVG file | Scalable, embed in web pages |
| .excalidraw JSON | Editable in excalidraw.com or VS Code |
| Shareable URL | Share with anyone, no file needed |
| 方法 | 输出格式 | 使用场景 |
|---|---|---|
| PNG文件 | 嵌入文档、Slack、PR |
| SVG文件 | 可缩放,嵌入网页 |
| .excalidraw JSON文件 | 在excalidraw.com或VS Code中编辑 |
| 可分享链接 | 无需文件,直接分享给任何人 |