An editorial diagram design system for AI coding agents
Diagram Design is a skill package for AI coding agents (Claude Code, Codex, Factory Droid, and Pi) that produces editorial-grade, self-contained HTML+SVG diagrams. It tackles the generic, cheap-looking output that agents usually generate by codifying a tight design system — one accent color, hairline borders, strict 4px geometry, no shadows, and three static variants across 38 diagram types. A 60-second onboarding flow pulls colors and fonts from your website into semantic tokens; import commands redraw draw.io or Mermaid sources with adjustable format, size, detail, and audience; accessibility checks (WCAG AA contrast, accessible SVG names) are enforced by default. For engineers and writers who want AI-generated diagrams that don't need manual cleanup.
Diagram Design is a skill/plugin that gives AI coding agents—Claude Code, Codex, Factory Droid, and Pi—the ability to produce editorial-quality diagrams. It ships 38 visual types, each rendered as self-contained HTML + SVG files with no build step, no JavaScript runtime, and no external image dependencies. The output is meant to look like a polished publication, not a generic flowchart tool.
Diagram Design 是一个面向 AI 编程代理的技能/插件,让 Claude Code、Codex、Factory Droid 和 Pi 能产出编辑级质量的图表。它内置 38 种视觉类型,每种都渲染为自包含的 HTML + SVG 文件:无需构建步骤、无需 JavaScript 运行时、也没有外部图片依赖。输出目标是看起来像一本精良的出版物,而不是通用的流程图工具。
The author kept needing diagrams for her blog and products, but AI assistants returned generic rounded-box diagrams that clashed with her site's design. Fixing them in Figma took 30 minutes; skipping them lost the communication value. This project encodes an editorial standard—one accent color, 1–2 focal elements, 1px hairlines, no shadows, 4px grid—so agents can produce diagrams that match a brand and are actually pleasant to publish.
作者在写博客和做产品时经常需要图表,但 AI 助手生成的总是千篇一律的圆角框,和网站的视觉风格格格不入。用 Figma 改要花 30 分钟,不改又损失表达效果。于是她把一套编辑级标准写进了这个项目:一个强调色、每图 1–2 个焦点元素、1px 细线、无阴影、4px 网格。代理据此生成的图表既能贴合品牌,也真的适合拿出去发布。
The skill covers 38 diagram types, from architecture, flowchart, sequence, and state machine to Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, and database schema. Each type ships in three static variants: minimal light, minimal dark, and full-editorial. A key design decision is that behavior is described by semantic patterns independently of layout—queue, policy trace, trust boundary, and other recurring situations reuse the nearest visual type instead of multiplying the type count. Static HTML is the default; optional accessible motion (reveal, step, loop) is available for ordered explanations.
这份技能覆盖 38 种图表类型,从架构图、流程图、时序图、状态机,到 Sankey 图、鱼骨图、Wardley 地图、看板、用户旅程、部署图、依赖图、UML 类图、故事地图和数据库 schema。每种类型都有三个静态变体:极简浅色、极简深色、完整编辑风。一个关键设计决策是:行为由独立于布局的语义模式描述——队列、策略轨迹、信任边界等反复出现的场景复用最近的视觉类型,而不是不断扩张类型数量。默认输出静态 HTML;对于需要有序讲解的场景,可选用带无障碍支持的交互动效(reveal / step / loop)。
After installation, you can run onboarding with a URL: the agent fetches the homepage, extracts the dominant palette and font stack, maps them to semantic tokens (paper, ink, muted, accent, link), and writes the result into references/style-guide.md after showing a diff. It also checks WCAG AA contrast for text on background and proposes adjusted values when needed. The SVG output is accessible by default: role="img", aria-labelledby, title/desc slots, and prefixed IDs to avoid collisions. Saved brand profiles can be reused across projects via ~/.diagram-design/profiles/ and a .diagram-design marker.
安装后,你可以用一个 URL 完成品牌接入:代理抓取首页,提取主色调和字体栈,映射为语义 token(paper / ink / muted / accent / link),展示 diff 后写入 references/style-guide.md。它还会检查文本与背景的 WCAG AA 对比度,不达标时给出调整建议。SVG 输出天生支持无障碍:role="img"、aria-labelledby、title/desc 占位符,并用带前缀的 ID 避免同页冲突。保存的品牌 profile 可通过 ~/.diagram-design/profiles/ 和 .diagram-design 标记在多个项目间复用。
The repo is structured as a skill package with a small SKILL.md that loads references only when needed. At startup an agent sees just the skill name and description; a flowchart request loads only SKILL.md plus type-flowchart.md, while importing a draw.io file pulls in import-drawio.md, output-spec.md, and the chosen type reference. Plugin manifests for Claude Code, Codex, Factory Droid, and prompt templates for Pi live in their own directories; Python scripts in scripts/ verify geometry, treemap area accuracy, Mermaid/draw.io imports, and documentation sync in CI.
仓库结构是一个技能包:核心 SKILL.md 非常精简,只在需要时加载对应参考资料。代理启动时只看到技能名称和描述;请求流程图只加载 SKILL.md + type-flowchart.md,而导入 draw.io 文件会把 import-drawio.md、output-spec.md 和对应类型参考一起拉进来。Claude Code、Codex、Factory Droid 的插件清单和 Pi 的 prompt 模板各居其位;scripts/ 下的 Python 脚本在 CI 里校验几何布局、treemap 面积准确度、Mermaid/draw.io 导入以及文档同步。
Install via each client's plugin mechanism. Claude Code:
/plugin marketplace add cathrynlavery/diagram-design
/plugin install diagram-design@diagram-design
Codex:
codex plugin marketplace add cathrynlavery/diagram-design
codex plugin add diagram-design@diagram-design
Factory Droid:
droid plugin marketplace add https://github.com/cathrynlavery/diagram-design
droid plugin install diagram-design@diagram-design --scope user
Pi:
pi install https://github.com/cathrynlavery/diagram-design
Once installed, open the gallery at skills/diagram-design/assets/index.html or just ask in natural language: "Make me an architecture diagram of my app: frontend, backend, database, Redis cache." You can also start from a template: cp skills/diagram-design/assets/template.html my-diagram.html.
按各客户端的插件机制安装。Claude Code:
/plugin marketplace add cathrynlavery/diagram-design
/plugin install diagram-design@diagram-design
Codex:
codex plugin marketplace add cathrynlavery/diagram-design
codex plugin add diagram-design@diagram-design
Factory Droid:
droid plugin marketplace add https://github.com/cathrynlavery/diagram-design
droid plugin install diagram-design@diagram-design --scope user
Pi:
pi install https://github.com/cathrynlavery/diagram-design
装好后可以打开画廊 skills/diagram-design/assets/index.html 浏览全部 38 种图,也可以直接用自然语言提需求:"Make me an architecture diagram of my app: frontend, backend, database, Redis cache." 还可以从模板开始:cp skills/diagram-design/assets/template.html my-diagram.html。
If you already have diagrams in draw.io/diagrams.net or Mermaid, the skill can redraw them in this design system. It parses .drawio, .drawio.xml, .drawio.png/.svg and Mermaid .mmd/.mermaid or fenced blocks in Markdown. Four dials control the output: format (html/svg/png/html+png), size (doc-inline, slide-16x9, social-og, etc.), detail (faithful/balanced/simplified), and audience (engineer/mixed/executive). Every import ends with a fidelity ledger summarizing what was merged, collapsed, or dropped. Exporting the generated HTML to SVG or PNG is supported via /export-diagram.
如果已经有 draw.io / diagrams.net 或 Mermaid 图表,这个技能可以按同一套设计体系重新绘制。它能解析 .drawio、.drawio.xml、.drawio.png/.svg,以及 .mmd/.mermaid 文件或 Markdown 里的 fenced Mermaid 代码块。四个旋钮控制输出:格式(html/svg/png/html+png)、尺寸(doc-inline、slide-16x9、social-og 等)、详细度(faithful/balanced/simplified)和受众(engineer/mixed/executive)。每次导入都会生成一份 fidelity ledger,说明哪些节点被合并、折叠或丢弃。生成的 HTML 还可以通过 /export-diagram 导出为 SVG 或 PNG。
Use this skill when you need a polished, brandable diagram for a blog post, deck, documentation, or social card, and you're already working in an agent like Claude Code or Codex. It is not for quick unicode diagrams for tweets or terminal output, lists (use a table), before/after comparisons (use a table), or single-box "diagrams" that are better written as a sentence. The rule of thumb: if a reader would learn more from a well-written paragraph, don't draw. Output files carry a Google Fonts reference, so fully offline use is limited to the system fonts fallback. Static output is guaranteed; motion is an opt-in extra with a strict review.
当你需要为博客、幻灯片、文档或社交媒体卡片做一张精致、可品牌化的图表,而且你已经在使用 Claude Code 或 Codex 这类代理时,这套技能很合适。但如果你需要的是推特/终端里的快速 unicode 图、任何列表(用表格)、前后对比(用表格)或者单个框的“图”(不如写一句话),它并不适用。经验法则:如果读者从一段好段落里学到的更多,就不要画图。输出文件会引用 Google Fonts,因此完全离线时会回退到系统字体;静态输出是默认保证,交互动效则是需严格审核的可选项。