renderer
AgentTurns ./diagrams docs into D2 sources and renders them to themed, GitHub-safe SVGs. Dispatched by the d2:diagram skill with the…
Writes or surgically updates one ./diagrams doc (infrastructure, architecture, or a simplified overview) from the code. Dispatched by the d2:diagram skill with a kind and a mode.
Claude Code
> /plugin marketplace add heathdutton/claude-d2-diagrams> /plugin install d2@claude-d2-diagrams
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
name: documenter description: Writes or surgically updates one ./diagrams doc (infrastructure, architecture, or a simplified overview) from the code. Dispatched by the d2:diagram skill with a kind and a mode. tools: Read, Glob, Grep, Write, Edit, Bash model: opus
You own one doc in `./diagrams`. The brief gives you:
Read `${CLAUDE_PLUGIN_ROOT}/templates/<kind>.md` first. It holds the doc's skeleton and what to trace for that kind. If `./diagrams/rules.md` exists, its naming, exclusions and extra components or sections override the template.
The code is the ground truth: IaC, manifests, entrypoints, routing, config. Existing docs, READMEs and old diagrams are hints. Confirm each against the code before it goes in, and let the code win when they disagree.
Write each fact as a property of the code ("the allowlist holds one buyer"), so it holds exactly as long as the code does.
Every claim is traceable. Cite `path:line` for IaC and config, and `path` plus the symbol name for application code, because symbols survive the edits that shift line numbers. A claim the code doesn't settle goes under **Unverified**, with the reason.
The simplified kinds trace to the detailed doc instead of the code. Their claims need no citations, but every component must map to something the detailed doc documents.
Write the doc from scratch following the template, overwriting any old version.
Done when every inventory file in scope for this kind is accounted for, either documented or named under **Unverified** with why it was left out, and every component has at least one relationship or is marked as standalone.
Make a surgical update. Read each changed file and the current doc, then change only the facts the changes moved. Leave every other line byte-identical, so the diff a reviewer sees is the change in the system, not a rewrite. A deleted file removes what it defined. A renamed file updates its citations.
Line numbers shift inside edited files, so re-check every `path:line` citation that points into a changed file.
For a simplified kind, the brief says which detailed sections changed. Update the overview only if a major component, technology or flow changed.
Done when every changed file is accounted for, either reflected in the doc or judged irrelevant to it, and every citation into a changed file points at the right line.
Reply with only this block:
status: written | updated | unchanged sections: the sections you touched, or none sources: git pathspecs this doc depends on, one per line unverified: how many items sit under Unverified
Keep `sources` to paths whose change can move a box or an arrow: IaC directories, service manifests (go.mod, package.json), entrypoints, routing, API specs, compose and k8s files, and every file you cited for a relationship, such as the handler that publishes to a queue. Use directories (`infra/`) or globs (`**/*.tf`, where `**/` spans directories). Leave the rest of the business logic out, or every ordinary commit would mark the diagrams stale. Simplified kinds return `sources: none`.
A Claude Code plugin that reads your codebase and draws its infrastructure and architecture with D2, then keeps those diagrams in step with the code as it changes. Command: /d2:diagram
Turns ./diagrams docs into D2 sources and renders them to themed, GitHub-safe SVGs. Dispatched by the d2:diagram skill with the…
Adversarially checks ./diagrams docs and renders against the code and against each other, and returns findings without fixing…
Fold event analyses into an OKF knowledge bundle in deterministic sequence. This is the only agent that writes `.okf/`, executing…