export-diagram

export-diagram is a command for Claude Code from nikeyes/stepwise-dev. It costs 16 tokens per session (848 once invoked), scanned A, original, Apache-2.0.

A command for converting a Diagram Design HTML file into SVG and PNG image files. SVG is a scalable image format, while PNG is a raster image format commonly used for sharing and documents.

In plain words
What is it for?
Use it to create SVG or PNG copies of a diagram for documents, presentations, websites, or image-based workflows.
Why use it?
It provides image files from an HTML diagram without requiring you to capture or convert the page manually.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Part of the diagram-design plugin — 1 skill, 5 commands shipped together

Good fit Use it to create SVG or PNG copies of a diagram for documents, presentations, websites, or image-based workflows.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/nikeyes/stepwise-dev/export-diagram
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/nikeyes/stepwise-dev

Made for: Claude Code.

Or install diagram-design, the plugin that ships this one along with the rest of its 1 skill, 5 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for export-diagram

README.md
[![agentmods](https://agentmods.dev/badge/commands/nikeyes/stepwise-dev/export-diagram/github.svg)](https://agentmods.dev/commands/nikeyes/stepwise-dev/export-diagram)
Your own site
<a href="https://agentmods.dev/commands/nikeyes/stepwise-dev/export-diagram"><img src="https://agentmods.dev/badge/commands/nikeyes/stepwise-dev/export-diagram/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for export-diagram

Your own site · 80×15
<a href="https://agentmods.dev/commands/nikeyes/stepwise-dev/export-diagram"><img src="https://agentmods.dev/badge/commands/nikeyes/stepwise-dev/export-diagram.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 848 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00016 $0.00848
Opus 5 $0.00008 $0.00424
Sonnet 5 $0.00003 $0.00170
Haiku 4.5 $0.00002 $0.00085

Measured today against content hash 7395e3cb2277, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

export-diagram scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

diagrams/commands/export-diagram.md · 41 lines

How it starts

The opening of the file, as written. The whole thing — 41 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Export the diagram HTML at $1 to .svg and/or .png, following the procedure documented in skills/diagram-design/references/export.md. Treat that reference as the source of truth — don't reimplement the logic here. If --registry is present, also follow skills/diagram-design/references/export-registry.md to emit the metadata sidecar — a separate procedure from the SVG/PNG rasterization above.

Full argument string: $ARGUMENTS

Defaults

  • With no format flags, or with --svg-only/--png-only/--scale/--output but no --registry: produce both .svg and .png next to the source (e.g. diagram.htmldiagram.svg + diagram.png).
  • PNG renders at device_scale_factor=2.
  • --registry given by itself, with neither --svg-only nor --png-only also present, produces only the registry JSON. The SVG/PNG defaults above do not also apply, and Playwright is never required for a registry-only call. To get an image alongside the registry, add --svg-only and/or --png-only explicitly.

Flags

  • --svg-only — emit only the SVG. Skip Playwright entirely.
  • --png-only — emit only the PNG.
  • --scale=1 / --scale=2 / --scale=3 — override the PNG device scale factor. Default 2.
  • --output=<path> — override the output base path; the format extension is appended. Applies to both formats when both are produced.
  • --registry — emit <basename>.registry.json, a metadata sidecar of every block's data-block-* attributes. Follows skills/diagram-design/references/export-registry.md, a procedure independent of the SVG/PNG rasterization above — it never needs Playwright. Used alone (see Defaults), it is the only output produced. Combine with --svg-only and/or --png-only to also produce an image in the same call.

Required behaviour

  1. No source path provided → ask the user which .html file to export. Don't guess.
  2. Source is assets/index.html (the gallery, multiple SVGs in one file) → refuse and ask which specific diagram file. Per the reference's edge-case section.
  3. Source has no <svg> block → refuse and tell the user; don't write anything.
  4. PNG requested but Playwright not installed → surface the install instruction from the reference verbatim and stop. Do not auto-install.
  5. PNG requested with --scale outside {1,2,3} → reject; valid values are 1, 2, 3.
  6. --registry requested but source has no data-block-id attributes → refuse and tell the user; don't emit an empty or partial registry file. Per the export-registry reference's edge-case section.
  7. --registry is the only flag given (no --svg-only/--png-only) → emit only the registry JSON. Do not also produce SVG/PNG, and do not check for Playwright — a registry-only call must succeed on a host that doesn't have it installed at all.

Read the full file on GitHub · 41 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 41 lines · 16 tokens per session scan A 7395e3cb2277

Subscribe to this mod's changes

export-diagram is a command published in the GitHub repository nikeyes/stepwise-dev (24 stars, last pushed yesterday), licensed Apache-2.0. It adds 16 tokens to every session and 848 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-09.