diagram-kit
Say it in your agent, get the diagram. 40 hand-built diagram templates that an AI agent can drive directly — architecture, flows, sequence, charts, planning — exported as clean 2× PNG.
You: “画一张问答系统的技术架构图,深色主题。” Agent: calls
diagram_template(c4_context, theme=dark)→c4_context-dark.png (1500×820 @2x)

What you can ask for
| Say something like | You get |
|---|---|
| “画一张问答系统的技术架构图,深色主题” | C4 context / layered architecture / deployment topology |
| “把这份评测结果画成对比图,突出提升幅度” | bar compare + score-structure, waterfall contribution |
| “帮我做一页汇报方案 PPT 的图:现状、改造、排期” | architecture delta → gantt → risk matrix (a recipe) |
| “质量问题是从哪来的,画个根因分析” | fishbone, decision tree, sankey |
| “这次迁移影响哪些服务” | component dependency, architecture delta |
Under the hood the agent picks one of 40 templates, fills a data dict, renders SVG → 2× PNG, and lints the result before handing it back.
Three ways to use it
1. As a skill (Claude / Codex / any agent that reads SKILL.md)
git clone https://github.com/lsr911/diagram-kit.git
cp -r diagram-kit/skill ~/.claude/skills/diagram-kit
python ~/.claude/skills/diagram-kit/scripts/check_env.py
Then just ask. The skill knows which of the 40 types fits which question, what the layout rules are, and how to verify the output.
2. As a DSH plugin — four tools: diagram_render, diagram_templates, diagram_template,
diagram_check; rendering runs the linter automatically (fail_on_error: true makes it a gate).
dsh plugin install ./diagram-kit/plugin
3. Straight from the command line
python templates/c4_context.py --theme dark # → c4_context-dark.png (2×)
python templates/run_all.py --report report.md # render 40 + quality report
The 40 templates
Architecture — layered · C4 context · deployment · component dependency · DFD · event flow · architecture delta · service blueprint · DB schema · UML class · ER model
Behaviour — swimlane · request sequence · UML sequence · state machine · decision tree · flywheel · user journey · kanban
Data — bar compare · grouped bar · waterfall · sankey · line trend · radar · radar+baseline · heatmap · capacity gauge · KPI cards · treemap · funnel · fishbone
Planning — timeline · release timeline · gantt · comparison matrix · priority matrix · risk matrix · tree · org chart
3 themes, one parameter
python templates/radar.py --theme blue # default
python templates/radar.py --theme red # vermilion — covers & review decks
python templates/radar.py --theme dark # dark background — projection

Quality gate (why the output looks tidy)
python scripts/check_svg.py out/fig1.svg # a11y, overflow, diagonals, text-on-line, overlaps, budget, fonts
python scripts/check_svg.py out/*.svg --fix # auto-repair, then re-check
Current state: 40 templates, 0 errors, 0 warnings. Every figure carries a footnote, uses one accent colour, and routes connectors orthogonally.
For humans too
Edit the data dict at the top of any template and re-run — no design work needed:
ROWS = [('Query', 71.0, 94.0), ('Docs', 68.4, 88.0), ('Search', 74.2, 95.0)]
docs/map.html is an offline catalog: search, scenario filters, multi-diagram recipes,
three-theme thumbnails, one-click copy of the command or the data dict.
Credits
Design discipline (single accent, deletion over decoration, complexity budget, anti-patterns) inspired by cathrynlavery/diagram-design (MIT). That one targets browser HTML; this one targets PNG for documents.
MIT — see LICENSE.
No comments yet. Be the first to write one.