/agentkit:diagramfrom agentkit
Craft high-quality diagrams — hand-drawn Excalidraw sketches, D2 technical figures, or, for Hugo docs sites, YAML specs rendered at build time by the agentkit hugo/diagrams module. Use AUTOMATICALLY when the user asks to visualize, draw, diagram, or sketch anything — system architectures, workflows, protocols, timelines, comparisons, mental models — or when a task needs a visual that outclasses mermaid/box kits. Never writes Mermaid for docs figures. Renders headlessly at generation time; output embeds anywhere HTML or markdown does.
Ships in agentkit. 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.
Read when SKILL.md points to them.
Turn concepts into diagrams that make an argument. The structure must carry the meaning: cover the labels and the shape should still tell the story. If a diagram is five identical boxes with different names, it has said nothing.
Method inspired by coleam00/excalidraw-diagram-skill; text and tooling here are original.
Open references/selection.md and copy the notation recipe for the type you
land on. It defines the three axes, crosses altitude against relationship
into the named type, and holds the recipes — crow's-foot cardinality, C4
boundary semantics, trust zones — that make the figure correct rather than
merely tidy. Write the classification line first:
altitude / relationship / audience → type
Generic boxes-and-arrows is what comes out when this step was skipped, and a figure that mixes two altitudes is misclassified rather than thorough.
Where the figure lives picks the output before the register does. A figure
for a Hugo docs site (the docs/, a hugo.yaml, a Hextra theme) is written as a
YAML spec and rendered by the site's own build through the hugo/diagrams module
in this repository: data/diagrams/<name>.yaml, placed with
{{< diagram "<name>" >}}. The build draws it in the house style, validates it,
adds the text version and /architecture.json, and fails on a ```mermaid
block. Read references/hugo-module.md before writing the first spec. Never
write Mermaid for a docs figure; it ships megabytes of runtime to every page and
draws in its own look. Every other destination keeps the registers below.
The type also picks the register. ERD, C4 context, C4 container and deployment topology route to the technical register below — and one narrowing of deployment topology goes on to the stencil register after it; every other type stays in the sketch register this file describes, where a correct glyph teaches more than any icon. Then set the depth, which the audience term drives:
PUT /api/pages/:slug and RUN_STARTED, not "endpoint" and "event".Those four types render D2 to a self-contained SVG instead of hand-written Excalidraw:
bun <skill-dir>/scripts/d2-render.ts --in topology.d2 --out topology.svg \
--png topology.png --label "Production deployment topology"
Orientation is not yours to guess. A source that sets no board-level
direction is rendered both ways and the wrapper keeps whichever the page will
display larger — the window is about 977 px of column by 540 px of height, and
a figure is fitted inside it on both axes, so the scale it is shown at is what
happens to its type. It prints the two it compared:
orientation: down (707x1303) beat right (2789x234). Write direction: in the
source, or pass --direction right|down, when you want to pick it yourself; a
direction the source sets is never overridden.
Before writing a line of that D2, ask whether the project can produce it. When the classification lands on a technical type and the system's shape is already recorded somewhere — a module graph, a live schema, a state file, a manifest directory — an extractor derives the D2 and you never author the graph at all:
depcruise --no-config --output-type json 'src/**/*.ts' \
| bun <skill-dir>/scripts/extract.ts deps --focus src --out modules.d2
extract.ts deps | schema | infra | k8s covers C4 component, ERD and
deployment topology; references/selection.md names the extractor beside each
type it serves. Choosing the scope is your job and the graph is never your
invention — which is the whole difference between a diagram that documents the
system and one that documents your memory of it. Reach for hand-written D2 only
when no such source exists, and see references/technical-register.md for what
these tools genuinely cannot know.
Renderer is pinned to d2 v0.8.2; the wrapper refuses any other version,
inlines vendored CC0 icons (icon: @postgres), and fails the render if the
output is not self-contained. The render-LOOK-fix discipline of step 5 applies
unchanged — read the PNG, never the SVG. Full-colour vendor logos are never
recoloured or theme-filtered; that is why D2 output is exempt from the page's
light-mode inversion.
Never guess an icon name, and never paint a plate behind a mark. Search the manifest — it reports the licence and whether a hit is brand artwork or a single-colour mark, and monochrome marks are re-inked to follow the page theme automatically:
bun <skill-dir>/scripts/find-icon.ts traefik
A hardcoded style.fill behind an icon cannot follow the theme, so it leaves a
white box in dark mode. If the search finds nothing, the mark is not vendored —
say so rather than substituting another vendor's look-alike.
Azure and GCP icons are vendor-licensed, so none are committed. Fetch a pack
once, on the machine that needs it, then use @azure:… / @gcp:… like any
other icon:
bun <skill-dir>/scripts/fetch-icons.ts azure --accept-terms
The fetch is opt-in — no install step runs it — and prints the vendor's terms
unless --accept-terms is given. Referencing an unfetched pack fails the render
naming this command. See references/VENDOR-LICENSES.md.
One narrowing of deployment topology leaves D2: a figure whose argument is the
reader recognising a vendor's own mark — an AWS ALB, an Azure Front Door, a
Cisco switch — where no extractor covers the source and the CC0 packs do not
carry the mark. That renders .drawio through draw.io Desktop:
bun <skill-dir>/scripts/drawio-render.ts --in topology.drawio --out topology.svg \
--png topology.png --label "Cloud topology — ALB to EKS to RDS"
Pinned to draw.io Desktop v31.3.2; the wrapper refuses any other version,
screens the source for label styles that would export as <foreignObject>,
which the technical register already refuses, and fails the render if the output
is not self-contained — the same gate D2 output passes. draw.io is shelled out to,
never vendored: its stencil licence exempts exported diagram output but grants
no redistribution, so no draw.io artwork is committed here.
It is the last resort of the three, not the first. references/selection.md
holds the three questions that route a topology to it, and
references/stencil-register.md holds the install recipe, how to find a style
string, and the authoring rules.
Steps 2–6 below are the sketch register's. A technical figure leaves here and
follows references/technical-register.md end to end — authoring rules,
notation conventions, the icon manifest, the trademark rule and how the SVG is
inlined into a page. A stencil figure follows
references/stencil-register.md the same way.
The type from step 1 fixes the notation; this table picks the shape for each concept drawn inside it. Pick the shape that behaves like the concept. In one diagram, no two major concepts should reuse the same pattern.
| Concept behaves like… | Draw it as… |
|---|---|
| one source feeding many | fan-out: center node, radiating arrows |
| many inputs producing one | merge: arrows converging into a single node |
| containment / hierarchy | tree: trunk lines + free-floating labels, no boxes |
| ordered steps in time | timeline: one line, dots, labels above/below |
| repetition that improves | cycle: loop of arrows returning to start |
| input transformed to output | pipeline: before → machine → after, visibly different ends |
| two options weighed | side-by-side halves with mirrored structure |
| phases with a hard boundary | zones separated by whitespace or a divider line |
| fuzzy context or state | overlapping ellipses (cloud), no hard border |
Boxes are earned, not default. Free-floating text with size/weight hierarchy beats a box unless the element is a focal point, an arrow target, or a true container.
The table is a floor, not a ceiling. For the concept that matters most, invent the visual metaphor that IS that concept: a review gate drawn as an actual gate across the flow; backpressure as a pipe narrowing; a cache as a shadow copy sitting between planes; fan-out that visibly loses order. Two tests before you keep a metaphor: strip the labels — does the structure still say it? and would a newcomer learn the mechanism from the picture alone? If either fails, the metaphor is decoration; redesign it.
Trace the eye-path before writing any JSON: where does the viewer start, what do they follow, where do they end.
Hand-write .excalidraw JSON — never generate the whole file in one pass (a
comprehensive diagram exceeds a single response's output budget and truncates):
type, version, appState, files) and
the first zone's elements.worker_rect, arrow_put) and namespace seed per
zone (100x, 200x…). When a new arrow binds to an earlier element, update
that element's boundElements in the same edit.Palette: match the destination. For AgentKit Pages author the dark house
palette only — the page derives the light-theme rendering itself
(invert + hue-rotate on svg[role="img"]), so there is still exactly one
variant to produce and it must be the dark one: strokes #eeeeee, muted
#9aa0aa, accents #79a8e7 (blue) / #f5a742 (amber), fills transparent
or #1b1d22, background transparent. For READMEs/light surfaces:
near-black strokes with classic pastel fills (#a5d8ff, #b2f2bb, #ffec99).
The ink above is baked into the export either way — there is no page-driven
theme switch on this side of the register. A host that toggles its own theme
(not Pages, which supplies the island) needs a real ground under a baked
palette or the wrong-theme case shows bare strokes on a page of the opposite
color. Set the scene's appState.viewBackgroundColor (or pass render.ts --background) to the palette's own surface color; leave it transparent
only when the destination is known to supply one, the way Pages does.
Contrast rules — the governing worst case is the DERIVED light rendering (the filter darkens every color; the palette above was tuned so ink, muted and both accents stay ≥4.5:1 there — an off-palette color has no such guarantee, so check both renderings before keeping one):
#e06c75 is a stroke color, not a text color — its derived light form
lands near 3.1:1, the graphics floor. Use it at strokeWidth ≥2 on
shapes/arrows, never for text.#9aa0aa or are dropped — amber
under amber reads as a smear. Prefer size and weight over decoration.#eeeeee, never the fill's own
color family; reserve the accent for a single data value.Hand placement stays the default. When the figure really is a graph, though — nodes, edges, at most three zones, no invented metaphor — write the spec and let dagre compute every coordinate.
Open references/auto-layout.md before writing one. It is the only complete
field list: every role, shape and flag, which characters each font carries,
the width each rank costs, what the layout guarantees and what it refuses. The
grammar below is the shape, not the vocabulary.
title: How a signed request becomes an answer # optional
direction: down # right | down | auto (default auto)
palette: dark # dark | light (default dark)
roughness: 1 # 0 crisp | 1 sketch (default 1)
background: "#ffffff" # optional backdrop; omit for transparent
zones:
- { id: core, label: Core } # at most 3
nodes:
- id: verify # at most 12
label: signature valid?
note: one line of detail under the label # optional
role: decision # neutral start success decision agent inactive error evidence
shape: diamond # rect | ellipse | diamond
zone: core # optional; must name a declared zone
mono: true # label in the mono font, for evidence artifacts
edges:
- { from: gateway, to: verify, label: mTLS, dashed: false, role: error }
notes:
- a muted line stacked under the figure
bun <skill-dir>/scripts/layout.ts --in figure.diagram.yaml --out figure.excalidraw
bun <skill-dir>/render.ts --in figure.excalidraw --out figure.svg --png figure.png \
--label "Ingest pipeline, source to warehouse"
The layout measures each label against the font the renderer actually embeds, sizes each box to its own text, draws the zone frames, routes the arrows and binds them at both ends. It refuses rather than draws when it cannot be right: a broken density budget, a self-edge, a character no embedded font carries, a spec key it does not recognise.
Left to right fits four ranks, not five. Each rank costs its own box width
plus 92 px of gap, so a chain of minimum-width boxes warns at five ranks and is
refused at six; boxes carrying a note warn at four and are refused at five.
Leave direction unset and the layout runs both ways and keeps the one the
page displays larger, restacking the chain for you once the row costs more than
the column and saying so; direction: down names that restack by hand.
examples/sketch-pipeline.diagram.yaml is a worked spec that had to do exactly
that.
Step 5 still applies. Auto-layout removes the placement round, not the judgement about whether the figure argues anything.
direction,
both renderers weigh that trade for you and keep whichever orientation renders
larger.JSON cannot be judged as JSON. Render, view the PNG with the Read tool, fix, repeat — expect 2–4 rounds; one pass is never the final pass.
bun <skill-dir>/render.ts --in diagram.excalidraw --out diagram.svg --png diagram.png \
--label "Ingest pipeline, source to warehouse"
Each round, in order:
x/y for
spacing; add waypoints to arrow points to route around shapes; pull
labels next to their subjects; resize to rebalance visual weight.Stop only when the render matches the planned design, nothing is clipped or ambiguous, arrows land exactly, spacing is deliberate — and you would show it to a staff engineer without a single caveat. "No critical bugs" is not the bar; "couldn't be composed better" is.
(One-time setup: cd <skill-dir> && bun install && bun run build; rendering
needs a local Chromium — set AGENTKIT_CHROMIUM if it isn't auto-found.)
The SVG is fully self-contained (fonts embedded as data: URIs), and every
renderer already writes the house root: the natural integer width and
height, the viewBox, role="img", the aria-label from --label, and
style="max-width:100%;height:auto". Leave that root alone. Never
replace the width with width="100%" — it upscales any figure narrower
than the column, which is how a tall sketch balloons. The theme caps a wide
figure to the column and leaves a narrow one at its own size, and the
lightbox reads the viewBox to expand back to natural size.
Inline it directly into a page (when publishing via publish-page, wrap it in
<div class="figure"> with a semantic figcaption), drop it into a repo's
docs, or attach the PNG where images are needed. Caption by content, never
by tool.
assets/font-metrics.json (opens in a new tab)assets/iconify/LICENSE.CC0-1.0.txt (opens in a new tab)assets/iconify/icon-selection.json (opens in a new tab)assets/iconify/logos/NOTICE (opens in a new tab)assets/iconify/logos/ansible.svg (opens in a new tab)assets/iconify/logos/argo.svg (opens in a new tab)assets/iconify/logos/auth0.svg (opens in a new tab)assets/iconify/logos/aws-api-gateway.svg (opens in a new tab)assets/iconify/logos/aws-cloudformation.svg (opens in a new tab)assets/iconify/logos/aws-cloudfront.svg (opens in a new tab)assets/iconify/logos/aws-cloudwatch.svg (opens in a new tab)assets/iconify/logos/aws-dynamodb.svg (opens in a new tab)assets/iconify/logos/aws-ec2.svg (opens in a new tab)assets/iconify/logos/aws-ecs.svg (opens in a new tab)assets/iconify/logos/aws-eks.svg (opens in a new tab)assets/iconify/logos/aws-elasticache.svg (opens in a new tab)assets/iconify/logos/aws-fargate.svg (opens in a new tab)assets/iconify/logos/aws-iam.svg (opens in a new tab)assets/iconify/logos/aws-kinesis.svg (opens in a new tab)assets/iconify/logos/aws-lambda.svg (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub developerinlondon/agentkit --plugin agentkit20 skills in this plugin
/agentauthzAdminister an agentauthz host over its MCP tools (authz_describe, authz_check, authz_grant, authz_grants, authz_revoke, authz_policies, authz_audit_query): read the descriptor before touching vocabulary, grant curated policies bounded down, probe-check both directions after every change, verify in the audit trail. Triggers: granting or revoking access, authoring or validating authz policy, "why was this denied", bounds, condition keys, agentauthz, authz MCP tools./architectStudy a system and produce living architecture documentation — explanatory pages with high-quality diagrams. Use AUTOMATICALLY when the user asks to document, explain, map, or review an architecture ("how does this system work", "architecture diagram of this repo", "create/refresh the design docs"), or to keep architecture pages current after changes. Orchestrates the diagram and publish-page skills./autonomous-workflowOther plugins' skills for the same job