Excalidraw Generator 标志

Excalidraw Generator

社区
kv0906
excalidraw-generator

Professional Excalidraw diagram generation expert that creates complete, valid .excalidraw.json files based on user descriptions. Use ONLY when users explicitly mention "Excalidraw" or request to create diagrams specifically with Excalidraw (e.g., "用 Excalidraw 画个流程图", "generate an Excalidraw diagram", "create Excalidraw file"). Do NOT trigger for generic diagram requests without Excalidraw mention. Generates ready-to-open files instead of requiring copy-paste.

Add to TypingMind

概览

发布者kv0906
代码仓库pm-kit
技能名称excalidraw-generator
星标数
140
复刻数
35
附带文件
3
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 3 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 kv0906 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Excalidraw Generator AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/kv0906/pm-kit/tree/main/.claude/skills/excalidraw
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kv0906/pm-kit.git /tmp/pm-kit
mkdir -p .claude/skills
cp -r /tmp/pm-kit/.claude/skills/excalidraw .claude/skills/excalidraw-generator
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Excalidraw Generator,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Excalidraw Generator。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Excalidraw Generator 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Excalidraw Diagram Generator

Create complete, valid .excalidraw.json files that users can directly open at excalidraw.com.

Core Capabilities

Diagram types supported:

  • Flowcharts - Process flows, decision trees, workflows
  • Architecture Diagrams - System architectures, network topologies, component diagrams
  • UML Diagrams - Class diagrams, sequence diagrams, use case diagrams
  • Mind Maps - Hierarchical concept maps, brainstorming diagrams

Two visual styles:

  • Professional Mode (default): Clean, polished diagrams for technical documentation
  • Hand-drawn Mode: Sketch-style diagrams for brainstorming and informal use

Quick Reference

JSON Schema

json
{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [],
  "appState": {
    "gridSize": null,
    "viewBackgroundColor": "#ffffff"
  },
  "files": {}
}

Coordinate System

  • Origin: Top-left corner (0, 0)
  • X-axis: Increases rightward
  • Y-axis: Increases downward
  • Unit: Pixels

Grid-Based Layout System

Use a 20px grid for alignment:

GRID_UNIT = 20
COLUMN_WIDTH = 200    # Element + gap
ROW_HEIGHT = 150      # Element + gap

Position formula:
  x = START_X + (column * COLUMN_WIDTH)
  y = START_Y + (row * ROW_HEIGHT)

Recommended START_X = 50, START_Y = 100

Standard Element Sizes

ElementWidthHeightUse Case
Small box12060Labels, simple steps
Standard box16080Process steps
Large box200100Detailed nodes
Wide box24080Long text
Diamond100100Decision points
Circle8080Start/End nodes

Text Calculations (CRITICAL)

Text Height Formula

textHeight = fontSize × lineHeight × numberOfLines
           = fontSize × 1.25 × numberOfLines

Examples:
- 1 line, fontSize 20: 20 × 1.25 × 1 = 25px
- 3 lines, fontSize 14: 14 × 1.25 × 3 = 52.5px ≈ 53px
- 12 lines, fontSize 15: 15 × 1.25 × 12 = 225px

Text Centering Formula

text_x = shape_x + (shape_width - text_width) / 2
text_y = shape_y + (shape_height - text_height) / 2

Text Size Reference

Font SizeChar WidthLine HeightUse
11~6px15pxLabels, annotations
12~7px16pxSecondary text
14~8px18pxBody text
16~9px20pxPrimary text
18~10px24pxHeadings
20~11px26pxTitles
28~16px35pxIcons/Emoji

Estimate text_width: char_count × char_width

Centering Example

Shape: x=100, y=100, width=160, height=80
Text: "Process" (7 chars), fontSize=16

text_width = 7 × 9 = 63
text_height = 1 × 20 = 20
text_x = 100 + (160 - 63) / 2 = 148.5 ≈ 148
text_y = 100 + (80 - 20) / 2 = 130

UML Class Diagram Container Height

containerHeight = headerHeight + attributesHeight + methodsHeight + padding

Where:
- headerHeight = classNameTextHeight + topPadding (typically 15px + 15px = 30px)
- attributesHeight = fontSize × 1.25 × numberOfAttributes + 10px
- methodsHeight = fontSize × 1.25 × numberOfMethods + 10px

Example (12 attributes, 10 methods, fontSize 15):
- Header: 20 + 15 = 35px
- Attributes: 15 × 1.25 × 12 + 10 = 235px
- Methods: 15 × 1.25 × 10 + 10 ≈ 198px
- Total: 35 + 10 + 235 + 10 + 198 = 488px (round to 500px)

Arrow Positioning

Horizontal Arrow (Left to Right)

From shape at (x1, y1, w1, h1) to shape at (x2, y2, w2, h2):

arrow_x = x1 + w1           # Right edge of source
arrow_y = y1 + h1/2         # Vertical center
gap = x2 - (x1 + w1)        # Space between shapes
points = [[0, 0], [gap, 0]]

Vertical Arrow (Top to Bottom)

arrow_x = x1 + w1/2         # Horizontal center
arrow_y = y1 + h1           # Bottom edge of source
gap = y2 - (y1 + h1)
points = [[0, 0], [0, gap]]

Feedback Loop (Return Arrow)

From bottom-right back to left:
  Start: (800, 400)
  points=[
    [0, 0],        # Start
    [0, 80],       # Down
    [-400, 80],    # Left
    [-400, -150]   # Up to target
  ]

Z-Order (Element Array Order)

Elements render in array order. First = back, last = front.

Correct order:

  1. Background shapes (containers, frames)
  2. Connection lines/arrows
  3. Foreground shapes (nodes, boxes)
  4. Text labels
  5. Icons/overlays

Visual Styles

Professional Mode (Default)

Use for: Architecture diagrams, UML, technical docs, formal presentations

json
{
  "roughness": 0,
  "fillStyle": "solid",
  "strokeWidth": 2,
  "fontFamily": 2
}

Colors (light backgrounds for readability):

PurposeBackground
Primary#e7f5ff
Success#ebfbee
Warning#fff9db
Accent#f3f0ff
Secondary#fff4e6

Hand-drawn Mode

Use for: Brainstorming, sketches, informal sharing

json
{
  "roughness": 1,
  "fillStyle": "hachure",
  "strokeWidth": 2,
  "fontFamily": 1
}

Colors (medium saturation):

PurposeBackground
Primary#a5d8ff
Success#b2f2bb
Warning#ffec99
Error#ffc9c9
Accent#d0bfff
Secondary#ffd8a8

Stroke color: #1e1e1e (dark gray, softer than pure black)


Element Types

Common Properties (required for all)

json
{
  "id": "unique-id",
  "type": "rectangle",
  "x": 100,
  "y": 100,
  "width": 160,
  "height": 80,
  "strokeColor": "#1e1e1e",
  "backgroundColor": "transparent",
  "fillStyle": "solid",
  "strokeWidth": 2,
  "roughness": 1,
  "opacity": 100,
  "angle": 0,
  "seed": 100,
  "version": 1,
  "isDeleted": false,
  "boundElements": null,
  "link": null,
  "locked": false
}

Type-Specific Properties

Rectangle: Add "roundness": {"type": 3} for rounded corners

Text:

json
{
  "type": "text",
  "text": "Content\nLine 2",
  "fontSize": 16,
  "fontFamily": 1,
  "textAlign": "center",
  "verticalAlign": "middle"
}
  • fontFamily: 1=Virgil (hand), 2=Helvetica, 3=Cascadia (mono)

Arrow/Line:

json
{
  "type": "arrow",
  "points": [[0, 0], [100, 0]],
  "startArrowhead": null,
  "endArrowhead": "arrow"
}
  • Points are relative to element's x,y
  • Arrowheads: null, "arrow", "bar", "dot", "triangle"

Workflow

Step 1: Identify Diagram Type

Match the request to a diagram type:

  • Flowchart: Process flows, algorithms, decision trees, workflows
  • Architecture: System designs, microservices, cloud infrastructure
  • UML Class: Object-oriented design, class hierarchies, relationships
  • Mind Map: Brainstorming, concept hierarchies, topic exploration

Step 2: Use Templates as Foundation

Templates in assets/:

  • flowchart-template.json
  • architecture-template.json
  • uml-class-template.json
  • mindmap-template.json

Usage:

  1. Read the appropriate template
  2. Modify IDs, text, positions, colors
  3. Add/remove elements as needed
  4. Ensure all IDs are unique

Step 3: Generate Elements

Key element types:

  • rectangle - Boxes, containers, processes
  • ellipse - Start/end nodes, databases
  • diamond - Decisions, conditional branches
  • arrow / line - Connections, flows
  • text - Labels, descriptions

Step 4: Calculate Layout

Use the grid system and text centering formulas above.

Layout strategies:

  • Flowcharts: Top-to-bottom, centered alignment
  • Architecture: Left-to-right for flow, grouped by layer
  • UML Class: Use container height formula; prevent text overflow
  • Mind Maps: Radial from center, balanced branches

Step 5: Style and Polish

  1. Choose visual style (Professional or Hand-drawn)
  2. Apply consistent colors from the palette
  3. Ensure adequate spacing (80-100px between elements)

Step 6: Save to File

Always save directly as .excalidraw.json (no code blocks).

  1. Write complete JSON to file
  2. Name descriptively (e.g., user-login-flow.excalidraw.json)
  3. Save to current directory unless specified otherwise

After saving, provide:

  1. Confirmation with file path
  2. Brief description of diagram structure
  3. Instructions: "Open at excalidraw.com → Menu → Open"

Common Patterns

Pattern 1: Sequential Flow

For A → B → C processes:

  1. Place elements vertically with 120px gaps
  2. Use rectangles for processes, ellipses for start/end
  3. Connect with arrows (endArrowhead: "arrow")
  4. Center-align all elements

Pattern 2: Decision Tree

For conditional branches:

  1. Use diamond for decision nodes
  2. Branch arrows left/right or up/down
  3. Add text labels on arrows ("Yes", "No")
  4. Rejoin paths when appropriate

Pattern 3: Hierarchical Structure

For layered architectures:

  1. Group elements by layer (horizontal rows)
  2. Use different colors per layer
  3. Vertical arrows show dependencies
  4. Consistent element sizes within layers

Pattern 4: Radial Mind Map

For concept exploration:

  1. Central node (ellipse) in middle
  2. Lines radiate outward
  3. Different colors per branch
  4. Rectangles for sub-topics

Positioning Checklist

Before generating:

  1. Define grid: START_X, START_Y, COLUMN_WIDTH, ROW_HEIGHT
  2. List all elements with row/column positions
  3. Calculate exact x,y using formulas
  4. Calculate text positions using centering formula
  5. Calculate arrow start points and relative endpoints
  6. Order elements correctly for z-order
  7. Assign unique IDs and incrementing seeds

Complete Node Example

json
[
  {
    "id": "node1-box",
    "type": "rectangle",
    "x": 100, "y": 100, "width": 160, "height": 80,
    "strokeColor": "#1971c2",
    "backgroundColor": "#a5d8ff",
    "fillStyle": "solid",
    "strokeWidth": 2,
    "roughness": 1,
    "opacity": 100,
    "angle": 0,
    "seed": 100,
    "version": 1,
    "isDeleted": false,
    "boundElements": [{"id": "arrow1", "type": "arrow"}],
    "roundness": {"type": 3},
    "link": null,
    "locked": false
  },
  {
    "id": "node1-text",
    "type": "text",
    "x": 130, "y": 130,
    "width": 100, "height": 20,
    "text": "Process Step",
    "fontSize": 16,
    "fontFamily": 1,
    "textAlign": "center",
    "verticalAlign": "middle",
    "strokeColor": "#1e1e1e",
    "backgroundColor": "transparent",
    "fillStyle": "solid",
    "strokeWidth": 1,
    "roughness": 1,
    "opacity": 100,
    "angle": 0,
    "seed": 101,
    "version": 1,
    "isDeleted": false,
    "boundElements": null,
    "link": null,
    "locked": false
  }
]

Tips for Quality Diagrams

  1. Unique IDs: Generate random 8-16 character IDs for each element
  2. Consistent spacing: Follow spacing guidelines strictly
  3. Color harmony: Use the recommended color palette
  4. Text sizing: Match text width to container width with padding
  5. Arrow connections: Position arrow start/end points precisely
  6. Version numbers: Use random integers for versionNonce and seed

Handling Complex Requests

For large or complex diagrams:

  1. Start simple: Create core structure first
  2. Iterate: Add details progressively
  3. Group logically: Use visual grouping (colors, spacing)
  4. Limit complexity: Suggest breaking into multiple diagrams if needed
  5. Maintain readability: Ensure text doesn't overlap, adequate spacing

Resources

assets/

Templates for common diagram types:

  • flowchart-template.json
  • architecture-template.json
  • uml-class-template.json
  • mindmap-template.json

references/

  • excalidraw-format.md - Complete JSON format specification
  • elements.md - Element types and properties
  • processing-loop-template.md - Processing loop example

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Excalidraw Generator AI 技能有什么作用?

Professional Excalidraw diagram generation expert that creates complete, valid .excalidraw.json files based on user descriptions. Use ONLY when users explicitly mention "Excalidraw" or request to create diagrams specifically with Excalidraw (e.g., "用 Excalidraw 画个流程图", "generate an Excalidraw diagram", "create Excalidraw file"). Do NOT trigger for generic diagram requests without Excalidraw mention. Generates ready-to-open files instead of requiring copy-paste.

为什么在 TypingMind 中使用 Excalidraw Generator?

因为您只需安装一次,就能搭配任何模型使用。Excalidraw Generator 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Excalidraw Generator?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/kv0906/pm-kit/tree/main/.claude/skills/excalidraw。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Excalidraw Generator?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Excalidraw Generator 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Excalidraw Generator 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Excalidraw Generator AI 技能免费吗?

是的。kv0906 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇