SVG Diagram Generation 标志

SVG Diagram Generation

组织热门
CopilotKit
SVG Diagram Generation

生成丰富的内嵌 SVG 图表,以直观的方式解释系统、流程、架构和抽象概念。

Add to TypingMind

概览

发布者CopilotKit
代码仓库OpenGenerativeUI
技能名称SVG Diagram Generation
星标数
1.6K
复刻数
202
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

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

  • 兼容任何大语言模型

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

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

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

安装

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

1

安装到 TypingMind

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

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

安装到其他智能体

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

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CopilotKit/OpenGenerativeUI.git /tmp/OpenGenerativeUI
mkdir -p .claude/skills
cp -r /tmp/OpenGenerativeUI/apps/agent/skills/svg-diagrams .claude/skills/copilotkit-svg-diagram-generation
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

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

一旦请求与技能匹配,模型就会自动加载 SVG Diagram Generation。

兼容任何 AI 模型

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

  • 仅在需要时加载

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

  • 在聊天中切换模型

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

技能指令

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

SVG Diagram Generation Skill

You can generate rich, inline SVG diagrams to visually explain concepts. Use this skill whenever a visual would help the user understand a system, process, architecture, or mechanism better than text alone.


Delivery

Diagrams ship through the generateSandboxedUi tool: the SVG markup goes in the html parameter, where it streams to the user element by element. SVG presentation attributes (fill, stroke, font-size) carry all styling here — if a diagram needs CSS animation classes, declare them in the css parameter, never in a <style> block inside html. Static diagrams need no jsFunctions or jsExpressions.


When to Use

  • Explaining how something works (load paths, circuits, pipelines, algorithms)
  • Showing architecture or structure (system diagrams, component layouts)
  • Illustrating processes or flows (flowcharts, data flow, decision trees)
  • Building intuition for abstract concepts (attention mechanisms, gradient descent, recursion)

SVG Setup

Always use this template:

svg
<svg width="100%" viewBox="0 0 680 H" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5"
            markerWidth="6" markerHeight="6" orient="auto-start-reverse">
      <path d="M2 1L8 5L2 9" fill="none" stroke="context-stroke"
            stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    </marker>
  </defs>
  <!-- Content here -->
</svg>
  • Width is always 680px via viewBox. Set width="100%" so it scales responsively.
  • H (height) = bottom-most element's y + height + 40px padding. Don't guess — compute it.
  • Safe content area: x=40 to x=640, y=40 to y=(H-40).
  • No wrapping divs, no <html>, <head>, <body>, or DOCTYPE.
  • Background is transparent — the host provides the background.

Core Design Rules

Typography

  • Two sizes only: 14px for titles/labels, 12px for subtitles/descriptions.
  • Two weights only: 400 (regular), 500 (medium/bold). Never use 600 or 700.
  • Font: Use font-family="system-ui, -apple-system, sans-serif" or inherit from host.
  • Always set text-anchor="middle" and dominant-baseline="central" for centered text in boxes.
  • Sentence case always. Never Title Case or ALL CAPS.

Text Width Estimation

At 14px, each character ~ 8px wide. At 12px, each character ~ 7px wide.

  • "Load Balancer" (13 chars) at 14px ~ 104px -> needs rect ~ 140px wide (with padding).
  • Always compute: rect_width = max(title_chars x 8, subtitle_chars x 7) + 48px padding.

Colors (Light/Dark Mode Safe)

Use these semantic color sets that work in both modes:

Teal:    fill="#E1F5EE" stroke="#0F6E56" text="#085041"  (dark: fill="#085041" stroke="#5DCAA5" text="#9FE1CB")
Purple:  fill="#EEEDFE" stroke="#534AB7" text="#3C3489"  (dark: fill="#3C3489" stroke="#AFA9EC" text="#CECBF6")
Coral:   fill="#FAECE7" stroke="#993C1D" text="#712B13"  (dark: fill="#712B13" stroke="#F0997B" text="#F5C4B3")
Amber:   fill="#FAEEDA" stroke="#854F0B" text="#633806"  (dark: fill="#633806" stroke="#EF9F27" text="#FAC775")
Blue:    fill="#E6F1FB" stroke="#185FA5" text="#0C447C"  (dark: fill="#0C447C" stroke="#85B7EB" text="#B5D4F4")
Gray:    fill="#F1EFE8" stroke="#5F5E5A" text="#444441"  (dark: fill="#444441" stroke="#B4B2A9" text="#D3D1C7")
Red:     fill="#FCEBEB" stroke="#A32D2D" text="#791F1F"  (dark: fill="#791F1F" stroke="#F09595" text="#F7C1C1")
Green:   fill="#EAF3DE" stroke="#3B6D11" text="#27500A"  (dark: fill="#27500A" stroke="#97C459" text="#C0DD97")
Pink:    fill="#FBEAF0" stroke="#993556" text="#72243E"  (dark: fill="#72243E" stroke="#ED93B1" text="#F4C0D1")

Color meaning, not sequence: Don't rainbow-cycle. Use 2-3 colors per diagram. Map colors to categories or physical properties (warm = heat/energy, cool = calm/cold, gray = structural/neutral).

If you're rendering inside a system that supports CSS variables, prefer:

  • var(--color-text-primary) for primary text
  • var(--color-text-secondary) for muted text
  • var(--color-border-tertiary) for light borders

Shapes & Layout

  • Stroke width: 0.5px for borders, 1.5px for arrows/connectors.
  • Corner radius: rx="4" for subtle rounding, rx="8" for emphasized. rx="20" for large containers.
  • Spacing: 60px minimum between boxes, 24px padding inside boxes, 12px text-to-edge clearance.
  • Single-line box: 44px tall. Two-line box: 56px tall.
  • Max 4-5 nodes per row at 680px width. If more, split into multiple diagrams.
  • All connectors need fill="none" — SVG defaults fill to black, which turns paths into black blobs.

Component Patterns

Single-Line Node

svg
<g>
  <rect x="100" y="20" width="180" height="44" rx="8"
        fill="#EEEDFE" stroke="#534AB7" stroke-width="0.5"/>
  <text x="190" y="42" text-anchor="middle" dominant-baseline="central"
        font-size="14" font-weight="500" fill="#3C3489">Node title</text>
</g>

Two-Line Node

svg
<g>
  <rect x="100" y="20" width="200" height="56" rx="8"
        fill="#E6F1FB" stroke="#185FA5" stroke-width="0.5"/>
  <text x="200" y="38" text-anchor="middle" dominant-baseline="central"
        font-size="14" font-weight="500" fill="#0C447C">Title</text>
  <text x="200" y="56" text-anchor="middle" dominant-baseline="central"
        font-size="12" fill="#185FA5">Short subtitle</text>
</g>

Arrow Connector

svg
<line x1="200" y1="76" x2="200" y2="120"
      stroke="#534AB7" stroke-width="1.5" marker-end="url(#arrow)"/>

Dashed Flow Indicator

svg
<line x1="200" y1="76" x2="200" y2="120"
      stroke="#534AB7" stroke-width="1.5" stroke-dasharray="4 3"/>

Leader Line with Label (for annotations)

svg
<line x1="440" y1="100" x2="500" y2="130"
      stroke="currentColor" stroke-width="0.5" stroke-dasharray="4 4" opacity="0.5"/>
<circle cx="440" cy="100" r="2" fill="currentColor" opacity="0.5"/>
<text x="506" y="134" font-size="12" fill="currentColor" opacity="0.7">Annotation text</text>

Large Container (for structural diagrams)

svg
<rect x="80" y="40" width="520" height="300" rx="20"
      fill="#E1F5EE" stroke="#0F6E56" stroke-width="0.5"/>
<text x="340" y="68" text-anchor="middle"
      font-size="14" font-weight="500" fill="#085041">Container name</text>

Diagram Types & When to Use Each

1. Flowchart

When: Sequential processes, decision trees, pipelines. Layout: Top-to-bottom or left-to-right. Single direction only. Rules:

  • Arrows must never cross unrelated boxes. Route around with L-bends if needed.
  • Keep all same-type boxes the same height.
  • Max 4-5 nodes per diagram. Break complex flows into multiple diagrams.

2. Structural Diagram

When: Containment matters — things inside other things (architecture, org charts, system components). Layout: Nested rectangles. Outer = container, inner = regions. Rules:

  • Max 2-3 nesting levels.
  • 20px minimum padding inside every container.
  • Use different color ramps for parent vs child to show hierarchy.

3. Illustrative Diagram

When: Building intuition. "How does X actually work?" Layout: Freeform — follows the subject's natural geometry. Rules:

  • Shapes can be freeform (paths, ellipses, polygons), not just rects.
  • Color encodes intensity, not category (warm = active, cool = dormant).
  • Overlap shapes for depth, but never let strokes cross text.
  • Labels go in margins with leader lines pointing to the relevant part.

Critical Checks Before Finalizing

  1. ViewBox height: Find your lowest element (max y + height). Set H = that + 40px.
  2. No content past x=640 or below y=(H-40).
  3. Text fits in boxes: (char_count x 8) + 48 < rect_width for 14px text.
  4. No arrows through boxes: Trace every line's path — if it crosses a rect, reroute.
  5. All <path> connectors have fill="none".
  6. All text has appropriate fill color — never rely on inheritance (SVG defaults to black).
  7. Colors work in dark mode: If using hardcoded colors, provide both light and dark variants. If using CSS variables, you're fine.

Multi-Diagram Approach

For complex topics, use multiple smaller SVGs instead of one dense one:

  • Each SVG should have 3-5 nodes max.
  • Write explanatory text between diagrams.
  • First diagram = overview, subsequent = zoom into subsections.
  • Never promise diagrams you don't deliver.

Example: Simple 3-Step Flow

svg
<svg width="100%" viewBox="0 0 680 260" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5"
            markerWidth="6" markerHeight="6" orient="auto-start-reverse">
      <path d="M2 1L8 5L2 9" fill="none" stroke="context-stroke"
            stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    </marker>
  </defs>

  <!-- Step 1 -->
  <rect x="230" y="20" width="220" height="56" rx="8"
        fill="#E1F5EE" stroke="#0F6E56" stroke-width="0.5"/>
  <text x="340" y="38" text-anchor="middle" dominant-baseline="central"
        font-size="14" font-weight="500" fill="#085041">User request</text>
  <text x="340" y="56" text-anchor="middle" dominant-baseline="central"
        font-size="12" fill="#0F6E56">HTTP POST /api/data</text>

  <!-- Arrow 1->2 -->
  <line x1="340" y1="76" x2="340" y2="100" stroke="#534AB7"
        stroke-width="1.5" marker-end="url(#arrow)"/>

  <!-- Step 2 -->
  <rect x="230" y="106" width="220" height="56" rx="8"
        fill="#EEEDFE" stroke="#534AB7" stroke-width="0.5"/>
  <text x="340" y="124" text-anchor="middle" dominant-baseline="central"
        font-size="14" font-weight="500" fill="#3C3489">Server processing</text>
  <text x="340" y="142" text-anchor="middle" dominant-baseline="central"
        font-size="12" fill="#534AB7">Validate and transform</text>

  <!-- Arrow 2->3 -->
  <line x1="340" y1="162" x2="340" y2="186" stroke="#854F0B"
        stroke-width="1.5" marker-end="url(#arrow)"/>

  <!-- Step 3 -->
  <rect x="230" y="192" width="220" height="56" rx="8"
        fill="#FAEEDA" stroke="#854F0B" stroke-width="0.5"/>
  <text x="340" y="210" text-anchor="middle" dominant-baseline="central"
        font-size="14" font-weight="500" fill="#633806">Database write</text>
  <text x="340" y="228" text-anchor="middle" dominant-baseline="central"
        font-size="12" fill="#854F0B">INSERT into table</text>
</svg>

Tips for Great Diagrams

  • Less is more: A clean 4-node diagram teaches better than a cramped 12-node one.
  • Color = meaning: Warm colors for active/hot/important, cool for passive/cold/secondary, gray for structural.
  • Streaming effect: Since SVGs render top-to-bottom as tokens arrive, structure your elements top-down for a natural build-up animation.
  • Annotations on the side: Put explanatory labels in the right margin (x > 560) with leader lines pointing to the relevant element.
  • Consistent heights: All boxes of the same type should be the same height.
  • Whitespace is your friend: Don't fill every pixel. Breathing room makes diagrams readable.

常见问题

SVG Diagram Generation AI 技能有什么作用?

生成丰富的内嵌 SVG 图表,以直观的方式解释系统、流程、架构和抽象概念。

为什么在 TypingMind 中使用 SVG Diagram Generation?

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

如何在 TypingMind 中安装 SVG Diagram Generation?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/CopilotKit/OpenGenerativeUI/tree/main/apps/agent/skills/svg-diagrams。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 SVG Diagram Generation?

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

SVG Diagram Generation 可以搭配多少个 AI 模型使用?

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

SVG Diagram Generation AI 技能免费吗?

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

什么是 AI 技能?

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

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

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

查看全部

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

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