diagram
Skill2 starsChanged 9 months agoMITView on GitHub
Draw structural diagrams with D2 — process lifecycles and sequence/swimlane diagrams (who does what, in what order), flowcharts and decision trees, causal/event networks (what drives what), state machines, layered or market-structure maps, and step-by-step walkthroughs — rendered in the qk palette to light and dark SVG + PNG (plus PDF/GIF) for Typst, HTML, Markdown, slides or standalone use. Use whenever the user wants a 流程图, 时序图, 泳道图, 生命周期图, 拓扑图, 因果图, 传导链, 关系图, state diagram, or asks to "visualize how X works / how A affects B / the steps of X", in any project — even without the word "diagram". Not for data charts (dataviz), mind maps (/mindmap) or dated timelines (Typst herodot/timeliney).
- Installs packages
51 other projects use a version of this.
Adopted by
Most recently taken up by
- jame-hv/brse-toolkittheir own version, first seen Nov 8, 2026
- domengabrovsek/agent-configtheir own version, first seen Nov 8, 2026
- domengabrovsek/claudetheir own version, first seen Nov 8, 2026
- ActuallyNodejam/openpaperworktheir own version, first seen Nov 8, 2026
- seayniclabs/homelab-infra-mcptheir own version, first seen Nov 8, 2026
- timurgaleev/vibestacktheir own version, first seen Nov 8, 2026
Used with
Projects with it also use ios-sync, benchmark-models and 10 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.
Saqlain-811Skillios-sync
Regenerate the iOS debug bridge against the latest upstream gstack templates. (gstack)
Also in 4 projects that use this
ShreyRaviSkillbenchmark-models
Cross-model benchmark for gstack skills. Runs the same prompt through Claude, GPT (via Codex CLI), and Gemini side-by-side — compares latency, tokens, cost, and optionally quality via LLM judge. Answers "which model is actually best for this skill?" with data instead of vibes. Separate from /benchmark, which measures web page performance. Use when: "benchmark models", "compare models", "which model is best for X", "cross-model comparison", "model shootout". (gstack) Voice triggers (speech-to-text aliases): "compare models", "model shootout", "which model is best".
Also in 5 projects that use this
ShreyRaviSkilllanding-report
Read-only queue dashboard for workspace-aware ship. Shows which VERSION slots are currently claimed by open PRs, which sibling Conductor workspaces have WIP work likely to ship soon, and what slot /ship would pick next. No mutations — just a snapshot. Use when asked to "landing report", "what's in the queue", "show me open PRs", or "which version do I claim next". (gstack)
Also in 5 projects that use this
timurgaleevSkilldocument-generate
Generate missing docs for a feature, module or project as tutorials, how-tos, reference and explanation.
Also in 4 projects that use this
Saqlain-811Skillios-clean
Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. (gstack)
Also in 3 projects that use this
seek888Skillopen-gstack-browser
Launch GStack Browser — AI-controlled Chromium with the sidebar extension baked in. Opens a visible browser window where you can watch every action in real time. The sidebar shows a live activity feed and chat. Anti-bot stealth built in. Use when asked to "open gstack browser", "launch browser", "connect chrome", "open chrome", "real browser", "launch chrome", "side panel", or "control my browser". Voice triggers (speech-to-text aliases): "show me the browser".
Also in 4 projects that use this
- +2 more from ShreyRavi
- +1 more from Saqlain-811
Other versions51 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 51
- garrytan/gstack★ 141ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 41ksame name
- Yeachan-Heo/oh-my-claudecode★ 41ksame name
- HybridAIOne/hybridclaw★ 159same name
- Kastalien-Research/thoughtbox★ 64same name
- jantichy/claude★ 45same name
- domengabrovsek/agent-config★ 22same name
- domengabrovsek/claude★ 22same name
- heathdutton/claude-d2-diagrams★ 16same name
- johnlindquist/claude-workshop-skills★ 16same name
41 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- compileSkill
- context-statusSkill
- create-documentSkill
- deploySkill
- devils-advocateSkill
- doc-reviewSkill
- excellenceSkill
- extract-diagramsSkill
- finishSkill
- google-tasksSkill
- image-searchSkill
- learnSkill
- mindmapSkill
- pedagogy-reviewSkill
- proofreadSkill
- qaSkill
- sec-edgarSkill
- translateSkill
- typstSkill
- validate-bibSkill
- verifySkill
- visual-auditSkill
- waybackSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 43 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
Not here: data charts → dataviz.
- Distinctive: line 50
Read the matching example first.
- Very specific: line 73
When a figure uses colour or dash to encode meaning (causal signs, exception paths), add a legend under vars.d2-legend (see the causal …
- Very specific: line 86
Run d2 fmt on the file. The render refuses unformatted sources.
- Distinctive: line 87
Avoid forced crossings by structure, not by tweaking.
- Distinctive: line 94
Every causal edge and lifecycle step must come from the user's material or a checked source.
- Very specific: line 111
Default output location: inside a git repo, ./diagrams/<slug>.d2 (kebab-case subject, at most 40 characters), so the source gets committed.
- Distinctive: line 119
Read the PNGs (light and dark, or every page) and judge them in this order.
“Common” is measured: kept by at least 6 in 10 of the 43 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.
Files
Diagram (D2)
One .d2 source per figure, kept next to the deliverable so it stays editable. scripts/render.sh
prepends the palette (theme/light.d2 or theme/dark.d2) and the semantic classes
(theme/classes.d2), renders with D2, patches the SVG, and rasterises it in headless Chrome.
A diagram makes an argument that prose cannot: what causes what, who acts when, where a thing can go next. Two tests decide whether it works. With every label deleted, does the shape alone still say something (a fan-out, a cycle, a hand-off between lanes)? And could the reader learn a concrete fact from it, or does it only name boxes?
1. Decide depth and type
Depth first.
- A sketch explains a structure the reader already half knows. Use generic labels and keep it under about 10 nodes.
- A teaching diagram (study notes, a walkthrough, a system explained to someone new) must carry concrete content: real numbers from a worked example, real event or field names, the formula itself. "Initial margin 4,950, falls to 4,450 < 4,500 maintenance, deposit 500" teaches; "margin → call" does not. Take the numbers from the source material, never invent them.
Then the type. Pick by the question the figure answers, and start from the matching example:
| The question being answered | Type | Pattern inside it | Start from | Layout |
| Who does what, in what order (parties × time) | sequence / lifecycle | hand-offs between lanes; spans for busy stretches | examples/sequence-futures-lifecycle.d2 | (fixed) |
| What happens next, with yes/no branches | flow / decision | tree; one end node per branch | examples/flow-option-exercise.d2 | elk |
| What drives what | causal / event network | fan-out from one trigger, convergence onto one outcome | examples/causal-rate-hike.d2 | elk |
| Which states a thing passes through | state machine | chain plus loops | examples/state-swap-trade.d2 | tala |
| Which parts sit in which layer or venue | layers / lanes | side-by-side containers | examples/layers-market-structure.d2 | elk |
| How a chain unfolds, one link at a time | step walkthrough | the same board growing per step | examples/steps-rate-transmission.d2 | elk |
Not here: data charts → dataviz; mind maps / topic trees → /mindmap; timelines on a real date
axis → Typst herodot/timeliney; a Typst flowchart of 10 nodes or fewer with no crossings →
fletcher (see typst/references/tool-routing.md).
Size. 5–15 nodes reads well. Past 15, split by phase or zoom level, or turn it into a step walkthrough. Don't shrink the text.
2. Write the source
Read the matching example first; it carries the idioms for its type.
Text and boxes:
- Labels are
中文 English(or the user's language plus the standard term). Node labels are at most 2 lines; edge labels are at most about 12 characters. The mechanism goes on the edge, the state on the node. - Box only things that carry meaning. Titles and annotations are
shape: text, and a root-level title can takenear: top-center.nearwith a position constant only works on root-level shapes. - Formulas are LaTeX:
|latex F_0 = S_0(1+r)^T|. Keep CJK outside the LaTeX (it turns serif). For a labelled formula, nest it:fwd: 远期价格 ↑ { style.font-size: 16; f: |latex ...| {shape: text} }.
Colour and grouping:
- Colour comes only through classes, never raw hex. The render lints for hex, because hex doesn't
follow dark mode.
- Node classes:
accentfor the trigger or focus (one per figure),warn,good,mutedfor the inactive path, andlanefor containers. - Edge classes:
pos(raises / leads to),neg(lowers / blocks),alert(the exception path),weak(optional). - Raw tokens such as
${accent}and${soft}work instylewhen no class fits.
- Node classes:
- Globs save repetition.
*: {&leaf: false; class: lane}turns every container into a lane.*: {&shape: diamond; ...}styles every decision. - When a figure uses colour or dash to encode meaning (causal signs, exception paths), add a
legend under
vars.d2-legend(see the causal example). Its title stays "Legend".
Content:
- In a sequence,
actor.span -> otherdraws an activation bar for a busy stretch, such as the CCP during mark-to-market. An unconnected child (long.check: "...") is a note. - Steps:
steps: { 1: {...}; 2: {...} }. Each step inherits the one before, so add only the new link in each.
Rules the render enforces or depends on:
- No
vars.d2-configin the source: the palette owns it. Pass the layout with-l. - Run
d2 fmton the file. The render refuses unformatted sources. - Avoid forced crossings by structure, not by tweaking. Give branches their own end nodes, and order lane children in the direction their edges leave.
- Grid layouts (
grid-columns) draw edges straight through nodes in between. Use them only when every edge joins neighbouring cells.
Sources:
- Every causal edge and lifecycle step must come from the user's material or a checked source. Cite it in a comment at the top (a CFA LO, a document section).
- For per-edge provenance in HTML, put it in
tooltip:; it shows on hover and survives into the SVG. - Mark anything unchecked
[unverified]in its label.
3. Render
${CLAUDE_SKILL_DIR}/scripts/render.sh path/to/fig.d2 [-o outdir] [-l elk|dagre|tala] [--light-only] [--pdf] [--gif]Output names and locations:
- Single-board figures get
fig.{light,dark}.{svg,png}(PNG at 2x). - A source with
steps/layers/scenariosgetsfig.pdf(one page per board) plusfig-<n>.pngper page, light only. --gifanimates the boards (1.5 s each);--pdfadds a PDF for single-board figures.- Default output location: inside a git repo,
./diagrams/<slug>.d2(kebab-case subject, at most 40 characters), so the source gets committed; otherwise next to the deliverable.
Exit 1 means one of: a lint failure (hex, d2-config, unformatted), a compile error (reported at the line in your file), or a D2 warning.
4. Look, in two passes, then fix
Read the PNGs (light and dark, or every page) and judge them in this order.
Pass 1: does it make the argument?
- With labels ignored, the structure shows the intended pattern (fan-out, hand-off, loop, branch)
- The eye lands on the
accentnode first and then follows the flow direction - A teaching diagram shows its concrete numbers or names, readable at the rendered size
- Nothing on the page is decoration: each box, colour and dash means something (the legend says what)
Pass 2: defects
- No label overlaps a node, an arrowhead or another label
- No edge passes through a non-endpoint node; crossings appear only where unavoidable
- Spacing is even, with no cramped cluster beside a large void
- The dark version has no black or white blocks, and every label is readable
- Aspect ratio is at most 3.5:1 (the script notes it); otherwise switch
directionor split
Fix the source and re-render. Expect 2–4 rounds. Stop when both passes are clean and you would show it without caveats. Don't hand over a figure you have not looked at. When delivering, show the light PNG and list the paths.
5. Embed
| Target | Snippet |
| Typst | #figure(image("fig.light.svg", width: 100%), caption: [...]) (print is light) |
| HTML / Artifact | <picture><source srcset="fig.dark.svg" media="(prefers-color-scheme: dark)"><img src="fig.light.svg" alt="..."></picture>. For a page with its own theme toggle, inline both SVGs (they carry no XML declaration) and show one per theme with CSS; tooltips work only inline |
| Markdown / GitHub | the same <picture> block, or  |
| Slides | the PNG, or --pdf / --gif for a step walkthrough |
The SVG embeds its own fonts (Source Sans plus a CJK fallback), so it does not match a Typst document's body font. When that matters for a small diagram, use fletcher.
Gotchas (verified on d2 0.9.0)
d2 validatepasses files that fail to compile (for example, a theme code such asAA4used as a style value). Trustrender.sh.render.shapplies these SVG patches; keep them if you hand-edit an SVG:- Sequence groups are drawn with
mix-blend-mode: multiply, which turns them black on dark. The dark SVG switches it toscreen. - The italic face used for edge labels slants CJK in browsers. Labels are pointed at the regular face with a sans fallback.
- The legend box is hard-coded white/black. The dark SVG recolours it.
- Sequence groups are drawn with
- On ELK and dagre,
label.nearon an edge is accepted but does nothing, and self-loop labels overlap the loop. Use-l tala. TALA ignoresdirectionon containers, so keep lanes on ELK. - PDF/GIF export dies on CJK with the system fallback font (a .ttc over D2's 128 MB limit), and one
23 MB CJK
.ttfpassed for two faces breaks the 64 MB scene limit.render.shhandles this by subsettingArial Unicode.ttfto the source's characters (about 50 KB) with fonttools viauvx. The cost: PDF/GIF lose bold, since that font has one weight; the SVG/PNG keep it. Override the font withD2_CJK_TTF=<path to a .ttf>(.otfis rejected). - Needs
d2(brew install d2) and Google Chrome (orCHROME=<path>). PDF/GIF and step boards also needuvandpdftoppm(poppler).
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
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.

