agentleFS
AvinavaAvinava/document-design-system/skills/diagram-design/SKILL.md

diagram-design

Skill2 starsChanged 3 months agoMITView on GitHub

Design editorial-quality diagrams as self-contained inline SVG — architecture diagrams, flows, sequences, state machines, data models, timelines, layer stacks, quadrants, comparisons, and system maps. Use when explaining how a system is arranged, how a process moves, how components depend on each other, or how options compare; when a Mermaid or draw.io diagram needs to be converted into a document's design system; or when an existing diagram looks auto-generated and needs editorial judgment. Do not use for quantitative charts of measured data (use chart-design), for the surrounding report structure (use analytical-document-design), for UI mockups or wireframes, or for producing editable .drawio files.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use grilling, agent-browser and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AWSSkill

    grilling

    Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

    Also in 4 projects that use this

  • VercelSkill

    agent-browser

    Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

    Also in 3 projects that use this

  • VercelSkill

    web-design-guidelines

    Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

    Also in 3 projects that use this

  • StrayDragonSkill

    ui-ux-pro-max

    UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the answer is "nothing," write the prose.

    line 12
  2. Distinctive:

    If the answer is "several of these," the diagram is doing too much.

    line 41

“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Diagram Design

A diagram earns its place when the arrangement itself carries meaning that a sentence or a list cannot carry as fast.

That is the whole test. Boxes-and-arrows restating a numbered list is slower than the list. A flowchart of a linear three-step process is worse than three sentences. Before drawing anything, say what the reader will understand from the shape that they would not get from the prose.

If the answer is "nothing," write the prose.

The standard

The highest-quality move is usually deletion. Every node earns its place. Target density around 4/10 — a diagram that fills its frame is almost always doing too much.

The accent color is reserved for the one or two things the reader should look at first. Everything else is ink and hairlines.

(This standard is adapted from cathrynlavery/diagram-design, MIT. See Credits.)

Choosing a form

Match the form to the relationship being shown, not to the data you happen to have.

The reader needs to understandForm
How parts are arranged and what talks to whatArchitecture / system map
How something moves through steps, with branchesFlow
Who calls whom, in what order, over timeSequence
What states exist and what transitions between themState machine
How entities relate and what they holdData model
What happened when, and in what orderTimeline
How responsibility is divided across actorsSwimlane
How options compare on two independent axesQuadrant
What sits on top of whatLayer stack
How something narrows or concentratesFunnel
How sets overlapVenn
How one thing decomposes into partsTree / nested

If the answer is "several of these," the diagram is doing too much. Split it. Two clear diagrams beat one complete one — a reader who has to decode a diagram has already lost the time the diagram was meant to save.

For per-form construction rules — what to label, where to place the accent, how to handle overflow — read references/diagram-families.md.

Output

Inline SVG in the document. Not a linked image, not a canvas, not a client-side renderer.

Inline SVG is the only form that scales into print without blurring, inherits the document's tokens, stays selectable and searchable, and survives being emailed as a single file.

Every diagram:

<svg role="img" aria-labelledby="dg-ingest-title dg-ingest-desc" viewBox="0 0 720 380">
  <title id="dg-ingest-title">Ingestion path</title>
  <desc id="dg-ingest-desc">Events enter through the gateway, buffer in the queue, and land in the warehouse. The queue is the only component without a failover.</desc>
  ...
</svg>

<title> first, unique IDs prefixed with the diagram's slug, and a viewBox on every SVG. The <desc> states what the arrangement shows — including the thing the accent is pointing at. See core/a11y.md.

Inline or <img> changes the rules

An SVG referenced through <img src="…"> — a README banner, an email, an embed on a site you do not control — renders as an isolated document. The host page's custom properties never reach it, so fill="var(--accent)" resolves to nothing and the shape disappears.

DestinationColorsTheming
Inline in the documentvar(--…) referencesFollows the document's data-theme
<img>, email, external embedLiteral valuesSelf-contained; use @media (prefers-color-scheme: dark) inside the SVG's own <style>

Decide the destination before drawing, because it is not a cosmetic difference — the same file cannot do both. assets/banner.svg is the worked example of the second case.

Visual rules

The token contract is in core/tokens.md and applies in full. Diagram-specific rules:

  • One accent. Reserved for the one or two elements the reader should see first — the bottleneck, the boundary, the thing that changed. An accent on every node is the same as no accent.
  • Hairlines. 1px strokes, var(--rule) for structure and var(--rule-strong) for boundaries. Thick borders read as UI chrome.
  • No shadows, no gradients, no glow. Depth comes from grouping and whitespace.
  • Everything on a 4px grid. Positions, sizes, gaps. Off-grid geometry is the single most reliable tell of an auto-generated diagram.
  • Three type roles. var(--display) for the diagram title, var(--sans) for node labels, var(--mono) for technical identifiers, ports, and versions. Nothing else.
  • Label every edge that isn't obvious. An unlabelled arrow means "leads to," and nothing else. If it means "on failure," "async," or "read-only," say so.
  • Direction is a decision. Left-to-right for process and time. Top-to-bottom for hierarchy and layers. Do not mix within one diagram.
  • No orphan nodes. Anything unconnected either needs an edge or does not belong.

Full geometry, node, edge, and callout specifications are in references/primitives.md.

Mermaid is an input, not an output

Mermaid is a good notation. Its default rendering is not — stock output brings its own fonts, its own colors, and its own spacing, none of which know about the document they land in. Shipping that into a designed document is visible immediately.

So: accept Mermaid as a source, convert it to a themed SVG, ship the SVG.

SourcePath
Sequence, state, class, ER, flowchart where auto-layout is honestscripts/render_diagram.mjs — renders via beautiful-mermaid into an SVG whose colors are var(--…) references, so it inherits the document's theme with zero JavaScript
Architecture, quadrant, layer stack, timeline, comparison — anything where position carries meaningHand-author from templates/diagram.svg. Auto-layout does not know that "closer" means "coupled," so it will destroy the point of the diagram
Existing .mmd, .drawio, or a diagram in a docConvert, then apply the rules above — do not embed as-is

The rule underneath: auto-layout is acceptable when the arrangement is arbitrary, and unacceptable when the arrangement is the message.

See references/mermaid-bridge.md for the renderer, its theme bridge, and its coverage limits.

Sizing and audience

Two dials worth setting deliberately, because they change what belongs in the diagram:

Size — doc-inline (fits a text column, ~720px wide), full-width (~1100px), print-portrait, print-landscape. A diagram drawn for full width and dropped into a text column becomes unreadable rather than smaller.

Audience — an engineer diagram can name protocols, ports, and versions; an executive diagram cannot, and showing them is not rigor, it is noise. When both audiences need it, make two diagrams from the same model rather than one that half-serves each.

Before delivering

  • The arrangement carries meaning prose could not carry as fast.
  • Every node earns its place; nothing is there for symmetry.
  • The accent marks one or two things, not a category.
  • Every non-obvious edge is labelled.
  • Geometry sits on the 4px grid.
  • viewBox, <title> first, <desc>, unique IDs.
  • Legible in grayscale and at print width.
  • No color-only encoding.
  • No shadows, gradients, or glow.
  • Renders correctly at the intended size, not just at authoring size.

Paths in this skill

core/… and scripts/… are relative to the repo root. When this is installed as a plugin your working directory is your own project, not the plugin, so prefix them:

node "${CLAUDE_PLUGIN_ROOT}/scripts/render_diagram.mjs" in.mmd --id x --title "…" --desc "…" --out x.svg

${CLAUDE_PLUGIN_ROOT} is Claude Code's portable reference to the plugin's own directory. Working inside the repo itself, the bare paths are correct as written.

Reference files

  • references/diagram-families.md — per-form construction rules and failure modes.
  • references/primitives.md — node, edge, label, callout, and grid specifications.
  • references/mermaid-bridge.md — Mermaid and draw.io import, the renderer, theme bridging, coverage limits.

Credits

The editorial standard here — deletion as the highest-quality move, every node earning its place, one accent for the one or two things that matter, density around 4/10, hairlines and a 4px grid — is adapted from cathrynlavery/diagram-design (MIT), which established it for Claude Code.

This skill differs in scope: it is one member of a document design system, so its diagrams consume the same core/ tokens as the reports, charts, and decks they sit inside, rather than carrying a diagram-specific style of their own.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.