/moonshine:diagramfrom moonshine
Designs system, relationship, or process diagrams that match an article's existing visual style. Useful when asked for architecture figures, flow diagrams, or icons.
Ships in moonshine. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A diagram in a moonshine article shows how named things relate: what talks to what, what contains what, what happens in what order, what changes between today and a proposal. This skill covers the decisions an author kept having to correct by hand across several real articles. It separates three layers, because they vary differently from article to article:
Read ../moonshine/STILL.md ("Diagrams", "How a Figure Gets Added") and ../moonshine/VISUALS.md ("Phones and touch") first. This skill adds to them.
Before designing anything, find the article's existing diagrams and any sibling article the user names ("like the one in X").
src/figures/ and content/figures/. Note which diagrams are DiagramSpecs and which are custom figures on a shared kit (a folder such as board/, kit/, prims/, or a glyph file several figures import). If the article has a kit, build on it without changing it: add a glyph or a link family in its own grammar when the subject needs one.registerGlyphs) and its choices of tone, label side and link family; copy its kit folder only if the new diagram needs something the built-in diagram cannot draw.A reader learns each mark once. A second way of drawing the same kind of thing in the same article costs them that.
Write one sentence the diagram has to make true for a reader who only looks at it. "An order is saved before it is queued, and the slow work happens at the print partner." If you need "and also" for a different kind of relation, you have two diagrams.
One kind of relation per diagram. Runtime traffic and deployment are different questions about the same boxes, and so are "who can reach it" and "what it contains". Drawn together, the lines of one obscure the other. Draw two diagrams, and keep everything they share (zones, the tiles that appear in both) in the same position in both, so the reader's eye can carry one onto the other. The same holds for a legend that mixes two vocabularies: a figure for the things, then a figure for the marks and links.
A figure does not repeat the one above it. If the previous figure shows today's state, the next shows the proposal alone. Side-by-side "today and proposed" earns its place when the two are compared mark for mark, as rows of one figure sharing a scale, or as a two-state toggle.
When one drawing has too much going on, sequence it. A dense diagram with several paths through it reads better as a stepper: the full list of steps stays visible in a column on the left, each with a short name, and the drawing shows one at a time. If the paragraphs after a figure ask the reader to run logic in their head, those paragraphs are more steps.
What gets a node. A node is a thing that persists.
Position and direction carry meaning, so use them on purpose.
Names. Use the real name of each thing, or an invented plausible one. Placeholder letters ("A", "Service 1") read strangely next to prose that uses names.
| The diagram needs | Build it as | Why |
|---|---|---|
| Nodes and links, as labelled boxes or as icon tiles, with zones, link colours, direction, badges, a dashed "not yet" state | DiagramSpec on DiagramFigure (STILL.md "Diagrams") | The author owns the arrangement in content/figures/<id>.json, and can move, relabel, re-icon and recolour everything in the browser. It has a phone arrangement and a readability floor built in. Never edit that JSON's arrangement yourself. |
| Something that changes as the reader acts: a stepper that lights one path at a time, pieces the reader links or drags, a before/after toggle | A custom figure (src/figures/drag/README.md), drawn in the same grammar | The built-in diagram shows one state. Reuse its glyphs (Glyph from diagram/glyphs) and its colour tokens so the two kinds of figure look like one family. |
| A short linear process, possibly before and after | Either. A DiagramSpec of tiles in a row is the quick way; a custom row gives exact control of two aligned rows. |
State which you chose and why when you report. Mermaid is never the answer (STILL.md).
You declare the spec; the author arranges it. Do not try to control positions from the spec, and do not write the arrangement file. Give the automatic layout a good start instead: list nodes in reading order, set direction, and group what belongs together.
A node with an icon is drawn as a tile: a rounded square holding a glyph, with the label outside it. The label belongs to the node and moves with it.
const SPEC: DiagramSpec = {
direction: 'RIGHT',
groups: [{ id: 'shop', label: 'Shop account' }, { id: 'partner', label: 'Print partner' }],
nodes: [
{ id: 'customer', label: 'Customer', icon: 'person' },
{ id: 'storefront', label: 'Storefront', icon: 'service', tone: 'flow', group: 'shop' },
{ id: 'orders', label: 'Orders', icon: 'database', tone: 'data', group: 'shop' },
{ id: 'jobs', label: 'Print jobs', icon: 'queue', tone: 'data', group: 'shop' },
{ id: 'renderer', label: 'Renderer', icon: 'service', tone: 'flow', group: 'partner', badge: '4' },
{ id: 'proof', label: 'Proof check', icon: 'function', group: 'partner', dashed: true },
],
edges: [
{ from: 'customer', to: 'storefront', label: 'orders', family: 'flow' },
{ from: 'storefront', to: 'orders', label: 'reads, writes', family: 'data', arrows: 'both' },
{ from: 'storefront', to: 'jobs', family: 'flow' },
{ from: 'jobs', to: 'renderer', label: 'one at a time', family: 'flow' },
{ from: 'renderer', to: 'proof', label: 'checks', dashed: true },
],
}
Fields: icon, labelSide (above, below, left, right; by default below, or to the right in a DOWN diagram), tone (the glyph's colour family), badge (a short mark such as a count), dashed on a node; family (colour) and arrows (end by default, both, start, none) on an edge; style (box, corners, tint, dashed) and tone on a group. An icon is a built-in glyph (person, service, database, store, queue, document, function, key, browser, cloud, folder, gear, clock, bolt), any Tabler icon as tabler:<name>, or any other text drawn as written, which is how an emoji is used. The template's content/diagrams.md shows each of these; read src/figures/DiagramGallery.tsx for specs to copy. The colour families are flow, data, control, access, defined as tokens (--dg-flow and so on) with dark values.
What the look consists of, and the reason for each part. When you match an existing article, these are the things to compare.
registerGlyphs({ name: <g>…</g> }) from a figure file. Otherwise look for the kind in the Tabler set before reaching for a generic shape, and keep emoji for articles whose tone suits them, since they render differently on every platform and ignore the colour families. A handful of kinds is enough.arrows: 'both' is a two-way relation, arrows: 'none' is an association with no direction.Named alternatives, and when each fits:
icon) when the nodes are sentences: decisions, options, quoted requirements, a step that is a formula. The seven box kinds in STILL.md are for these.kind: 'note' or an annotation for the one remark the diagram needs.:::figure block after the ### title. A paragraph under a figure that describes the figure is a caption in the wrong place; the prose after a figure moves the argument on. Keep the two close: a paragraph that explains a mark belongs directly under the figure that has the mark.<Glyph name="database" tone="data" /> (from diagram/glyphs) as an :inline-viz, and put the mark beside the word where the prose first names each thing. Once one paragraph had them, the author asked for them throughout.:term[...]{to=figure.part} for the same link from the prose.The built-in diagram draws at reading size (node labels 15px, link labels and group names 13px; shrunk to fit, node labels stop at 13px and link labels at about 11px) and has a second arrangement for narrow screens, automatic until the author saves one from the editor's "Narrow (phones)" tab. Keep to the node count in section 2 and both stay readable.
A custom figure has to do this itself. A diagram drawn into a fixed viewBox and scaled to the column renders its labels at 5 to 6px on a phone. That failure was present in diagrams accepted on a desktop screen, where nobody had looked at a phone. Give it a narrow layout (the same tiles restacked top to bottom) switched on the measured width, with sideways scroll inside the figure as the fallback. See "Phones and touch" in VISUALS.md.
Leave room. A cramped first version was a correction more than once. A labelled link needs a run longer than its label between the two tiles, and a zone needs space for its own label clear of the tiles and their labels. You do not place the nodes, so say in your report which links are labelled and may need the author to open them up.
Render the figure and read the screenshot at about 1100px and 360px, light and dark. Judge the picture, since the code will look fine. Check, in this order:
Fix what you find, then show the author. Say what you checked by screenshot and what you did not.
A correction to one diagram is usually a rule for all of them. When a comment names a pattern ("icons by type", "this should be a caption", "use the style from the other figure"), apply it to every figure in the article in the same pass and say that you did. If the author asks for a restyle across many figures, redraw one, show it, then do the rest with the same glyphs, tones and families so they stay consistent. Keep facts fixed while changing form, and list anything that changed form (a count that became a badge, a bare line that gained a tag).
What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/critiqueAdversarial critique of a moonshine article (still or shine) against the skill's editorial, visual, and pedagogy standards. Use when the user wants a moonshine article reviewed, graded, or checked for slop before publishing. Invoked as `$critique` or `$critique <path>`./moonshineHelp users create interactive explanations of technical concepts, inspired by Distill.pub/moonshine-listenListen for moonshine authorship feedback and address comments on an interval. Invoke when the author asks you to watch for feedback from the article HUD, or when prompted to start the listener. Best run under /loop (e.g. `/loop $moonshine-listen`) so it keeps ticking while the session is idle.npx claudepluginhub enjalot/moonshine --plugin moonshineOther plugins' skills for the same job