跪拜 Guibai
← All articles
AI Programming · AIGC

diagram-design: An AI Agent Skill That Puts Architecture Diagrams on a 4px Grid

By 小虎AI生活 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Diagram output that used to eat hours of manual alignment now comes out of an AI agent on a pixel-perfect grid, provided you scrub sensitive data before it reaches a cloud model. The token numbers—33,807 full, 12,956 compressed—give teams on metered APIs a concrete cost baseline for this workflow.

Summary

diagram-design is an AI agent skill that replaces manual box-dragging with a layout spec: 45 HTML and inline SVG templates aligned to a 4px grid, all using 1px thin lines, zero shadows, and WCAG-AA contrast. It handles architecture diagrams, sequence diagrams, state machines, ER models, swimlanes, Gantt charts, Sankey diagrams, Wardley maps, and more, exporting to HTML, SVG, or PNG, and importing .drawio, Mermaid, and .excalidraw files.

The install path is two commands—`npx skills add cathrynlavery/diagram-design` or `epx add cathrynlavery/diagram-design --skill diagram-design`. It runs inside OpenCode, Claude Code, Codex, Cursor, and GitHub Copilot, and pairs with Tencent's WorkBuddy office workbench, which integrates WeChat, WeCom, Tencent Docs, and Tencent Meeting and works across desktop and mobile. For teams worried about leaks, the skill runs locally under an MIT license with no servers or telemetry, but any workflow that calls a cloud LLM needs data anonymization first.

Token costs are concrete: a third-party test on October 21 measured 33,807 tokens for a full repo file sent directly, and 12,956 tokens after enabling local skeleton compression. Two limitations stand out: output layout can vary between runs because it depends on the underlying model, and the generated HTML/SVG isn't natively editable in draw.io or diffable in a PR.

Takeaways
— diagram-design has 59.3k GitHub stars as of October 26.
— It supplies 45 HTML/SVG templates aligned to a 4px grid, with 1px lines, zero shadows, and WCAG-AA contrast.
— Supported diagram types include architecture, architecture diff, sequence, state machine, ER, timeline, swimlane, quadrant, radar, Gantt, Sankey, fishbone, Wardley, kanban, user journey, deployment, and UML class diagrams.
— Install via `npx skills add cathrynlavery/diagram-design` or `epx add cathrynlavery/diagram-design --skill diagram-design`.
— Runs in OpenCode, Claude Code, Codex, Cursor, and GitHub Copilot, and can be combined with Tencent's WorkBuddy workbench.
— Version numbers differ across sources: plugin.json shows 2.6.136, the summary shows 2.6.120, and SKILL.md metadata shows 2.6.
— WorkBuddy uses TLS/AES-256 encryption, independent key hosting, and holds ISO 27001, SOC 2, and Chinese Class III protection certifications.
— A third-party test on October 21: a full file costs 33,807 tokens; with local skeleton compression, it drops to 12,956 tokens.
— The skill is MIT-licensed, runs locally without servers or accounts, and collects no telemetry.
— Output quality depends on the underlying LLM, and generated HTML/SVG is not natively editable in draw.io or diffable in PRs.
Conclusions

The 4px grid, 1px lines, and zero shadows are treated as hard constraints in the prompt templates, which is why the output reads as professional rather than AI-generated; the article turns aesthetics into a specification.

Compressing the codebase skeleton before sending it to the model cuts token consumption by more than half (33,807 to 12,956), so the security practice of anonymization also functions as a cost-control lever.

The version mismatch across plugin.json, the summary, and SKILL.md signals that the project hasn't standardized its release metadata, which could complicate automated installation or debugging for teams pinning exact versions.

Concepts & terms
4px grid
A layout system where every element's position and size align to multiples of 4 pixels, enforcing consistent spacing and alignment across diagram components.
Architecture diff diagram
A diagram type showing the differences between an old and a new system architecture, highlighting added, removed, and unchanged components or links.
Agent skill
A packaged set of instructions, prompts, and templates that extends an AI agent's capabilities, letting it perform specialized tasks like generating diagrams without user-written formatting logic.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗