Diagram Generator logo

Diagram Generator

CommunityPopular
zhaoxuya520
diagram-generator

generate, refine, validate, and render diagrams from natural language, notes, code snippets, schemas, tables, or existing diagram source. use for flowcharts, swimlanes, sequence diagrams, state diagrams, er diagrams, class diagrams, architecture/c4-style diagrams, dependency graphs, gantt charts, mind maps, user journeys, sankey-style flows, org charts, network graphs, and other visual models. supports mermaid by default, graphviz dot for complex graph layout, plantuml for uml-heavy engineering diagrams, and svg output when direct markup is more reliable.

Overview

Publisherzhaoxuya520
Repositoryreverse-skill
Skill namediagram-generator
Stars
36.3K
Forks
5K
Bundled files
4
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by zhaoxuya520 on GitHub. Read the source before you install it.

Installation

Install the Diagram Generator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zhaoxuya520/reverse-skill.git /tmp/reverse-skill
mkdir -p .claude/skills
cp -r /tmp/reverse-skill/skills/diagram-generator .claude/skills/diagram-generator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Diagram Generator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Diagram Generator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Diagram Generator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Diagram Generator

ACTION REQUIRED(读完后立刻执行)

  1. NOW:确认当前任务是否命中本 skill 的适用范围
  2. NOW:读取 ../tool-index.md,校验工具可用性和实际路径
  3. NEXT:缺工具时调用 bootstrap,不要猜路径
  4. ACT:进入"工作流"第一步并执行,不要停在确认状态

Purpose

Create clear, editable diagrams from messy or structured inputs. Prefer text-based diagram source first so the result can be reviewed, versioned, and refined. Render to files only when the user asks for an image/PDF or when a downloadable artifact would materially help.

Default workflow

  1. Identify the user's intent, audience, and source material.
  2. Choose the diagram family and language using the decision table below.
  3. Normalize entities, relationships, labels, states, branches, and time/order information before writing diagram code.
  4. Generate concise, readable diagram source.
  5. Validate the syntax mentally and, when creating files, run scripts/render_diagram.py.
  6. Return the diagram source plus a short note about assumptions. When files are generated, include links to the output files.

Do not over-ask for clarification. If the request is underspecified, make reasonable assumptions and label them briefly.

Diagram language decision table

Use Mermaid unless another language is clearly better.

User wantsPreferWhy
process flow, decision tree, simple swimlaneMermaid flowchartreadable and easy to paste into Markdown
sequence of system/user interactionsMermaid sequenceDiagram or PlantUML sequenceMermaid for docs; PlantUML for UML formality
lifecycle, state machine, transitionsMermaid stateDiagram-v2 or PlantUML statecompact transition syntax
database schema, entities, relationshipsMermaid erDiagramportable ER notation
class/interface/object modelMermaid classDiagram or PlantUML classMermaid for docs; PlantUML for detailed UML
project scheduleMermaid ganttconcise timeline syntax
hierarchy, ideas, notesMermaid mindmapgood default for idea maps
customer/product journeyMermaid journeybuilt-in journey notation
git historyMermaid gitGraphbuilt-in git notation
dependency graph, package graph, large networkGraphviz DOTbetter layout engines for dense graphs
architecture with layers, clusters, boundariesMermaid flowchart with subgraphs, Graphviz clusters, or PlantUML C4-stylechoose based on requested fidelity
weighted flow/sankey-like relationshipMermaid sankey-beta when supported, otherwise SVG or GraphvizMermaid support may vary by renderer
custom visual where source languages fit poorlySVGprecise control over layout and styling

Output policy

  • Always provide editable source unless the user explicitly asks only for an image.
  • Default to a single best diagram. Offer alternatives only when genuinely useful.
  • Prefer stable, simple syntax over fancy features that may not render in older Mermaid/PlantUML versions.
  • Use short labels. Split long text into notes outside the diagram when needed.
  • Avoid ambiguous node IDs. Use ASCII IDs and human-readable labels.
  • Preserve user terminology, but standardize capitalization within a diagram.
  • For technical diagrams, include boundaries such as client, service, database, queue, external API, and operator/user when they are implied.
  • For business-process diagrams, distinguish happy path, decision points, failures, retries, and manual steps when present.
  • For diagrams created from uncertain text, include an Assumptions section after the code.

Mermaid generation rules

Consult references/diagram-patterns.md for compact templates.

General Mermaid rules:

  • Start with the correct diagram directive, for example flowchart TD, sequenceDiagram, erDiagram, gantt, mindmap, or journey.
  • For flowcharts, use flowchart TD unless the user asks for left-to-right; use flowchart LR for architecture and pipelines.
  • Use subgraphs for swimlanes or architecture layers. Name subgraphs with readable labels.
  • Keep node IDs stable and ASCII-only, for example ingest_service[Ingest Service].
  • Quote labels that contain punctuation likely to confuse the parser.
  • Use decision diamonds for branching: decision{Condition?}.
  • Use consistent edge labels: -- yes -->, -- no -->, -. async .->, or == critical ==> only when meaningful.
  • In sequence diagrams, declare participants before messages. Use actor for humans and participant for systems.
  • Use alt/else/end, opt/end, loop/end, and par/and/end blocks for conditional, optional, repeated, and parallel flows.

Graphviz DOT generation rules

Use Graphviz for large, dense, or layout-sensitive relationship diagrams.

  • Prefer digraph G for directed relationships and graph G for undirected networks.
  • Set layout-friendly graph attributes at the top: rankdir=LR, nodesep, ranksep, and splines=true when helpful.
  • Use subgraph cluster_name for boundaries and subsystems.
  • Use plain labels and restrained styling.
  • Use edge labels only when they add meaning.
  • For many nodes, group by domain with clusters and avoid crossing-heavy all-to-all edges.

PlantUML generation rules

Use PlantUML when the user asks for UML or needs formal UML notation.

  • Wrap diagrams with @startuml and @enduml.
  • Use actor, participant, database, queue, collections, or component stereotypes when useful.
  • Use package, rectangle, or node for architecture boundaries.
  • For class diagrams, include only important fields/methods unless the user asks for exhaustive detail.
  • For activity diagrams, use clear start/end markers and explicit branch labels.

SVG generation rules

Use SVG only when text diagram languages cannot express the requested visual reliably.

  • Keep SVG simple, accessible, and editable.
  • Include <title> and meaningful text labels.
  • Prefer rectangles, lines, arrows, and groups over complex paths.
  • Do not embed external fonts or remote images.

Rendering files

When the user asks for PNG/SVG/PDF, create a source file and run:

bash
python "<SKILL_ROOT>/diagram-generator/scripts/render_diagram.py" input.mmd --format svg --out output.svg
python "<SKILL_ROOT>/diagram-generator/scripts/render_diagram.py" input.dot --format png --out output.png
python "<SKILL_ROOT>/diagram-generator/scripts/render_diagram.py" input.puml --format svg --out output.svg

<SKILL_ROOT> 是本包 skills/ 目录的实际路径,AI 应自动检测。

The renderer is intentionally dependency-tolerant. It tries common local tools and reports actionable installation hints if a renderer is unavailable. Do not claim an image was rendered unless the script completed successfully and the output file exists.

Validation checklist

Before finalizing:

  • The diagram type matches the user's task.
  • The source is syntactically plausible for the chosen language.
  • Labels are short enough to fit.
  • Edges and message order reflect the input accurately.
  • Assumptions are called out when the input was incomplete.
  • For generated files, the output exists and opens or has nonzero size.

Common response template

Use this structure for most diagram answers:

markdown
下面是可编辑的 [language] 版本:

```[language]
[source]

Assumptions:

  • [only if needed]

Rendered file: [link] [only if generated]


For English user requests, respond in English. For Chinese user requests, respond in Chinese unless they ask otherwise.

---

## 按需自举(On-Demand Bootstrap)

### 自动化能力边界

| 工具 | 可自动安装 | 安装方式 | 说明 |
|------|-----------|---------|------|
| Mermaid CLI (mmdc) | ✓ | npm install -g @mermaid-js/mermaid-cli | 渲染 Mermaid 为 PNG/SVG |
| Graphviz (dot) | ✗ | 手动安装 | https://graphviz.org/download/ |
| PlantUML | ✗ | 需要 Java + plantuml.jar | https://plantuml.com/download |
| Python (render script) | ✓ | 已在 bootstrap 中 | `scripts/render_diagram.py` 依赖 |

### 说明

本 skill 主要输出文本格式的图表源码(Mermaid/DOT/PlantUML),不一定需要本地渲染工具。只有当用户明确要求生成 PNG/SVG/PDF 文件时才需要对应的渲染器。

如果渲染器不可用,`scripts/render_diagram.py` 会输出安装提示而不是报错。

---

## 路由上下文

**上游入口**: `skills/SKILL.md`(总控)、`routing.md`
**触发条件**: 用户说"画图"、"流程图"、"架构图"、"攻击路径图"、"时序图"、"Mermaid"、"Graphviz"、"PlantUML"
**下游出口**:
- 生成的图表可嵌入 `docs-generator/` 的报告中
- 攻击路径图可配合 `pentest-tools/` 的渗透报告

**同级关联模块**: `docs-generator/`(报告中嵌入图表)


## 任务完成自检(声称完成前 MUST 通过)

- [ ] 我是否执行了工作流中的每一步(而不是只阅读)?
- [ ] 我是否基于 `tool-index` 使用了真实工具路径?
- [ ] 我是否产出了可复现证据(命令/脚本/截图/报告)?
- [ ] 我是否完成并回写了 RULES 要求的 Checklist 项?

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Diagram Generator AI skill do?

generate, refine, validate, and render diagrams from natural language, notes, code snippets, schemas, tables, or existing diagram source. use for flowcharts, swimlanes, sequence diagrams, state diagrams, er diagrams, class diagrams, architecture/c4-style diagrams, dependency graphs, gantt charts, mind maps, user journeys, sankey-style flows, org charts, network graphs, and other visual models. supports mermaid by default, graphviz dot for complex graph layout, plantuml for uml-heavy engineering diagrams, and svg output when direct markup is more reliable.

Why use Diagram Generator on TypingMind?

Because you install it once and use it with any model. Diagram Generator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Diagram Generator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/zhaoxuya520/reverse-skill/tree/main/skills/diagram-generator. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Diagram Generator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Diagram Generator?

As many as you like. As long as a model supports skills, you can use Diagram Generator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Diagram Generator AI skill free?

Yes. It is published on GitHub by zhaoxuya520 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇