d2

d2 is a skill for Claude Code from h0rv/d2-mcp. It costs 49 tokens per session (867 once invoked), scanned A, original, MIT.

A workflow for creating, checking, rendering, and revising D2 diagrams. D2 is a text-based diagram language for showing systems, processes, dependencies, sequences, and data flows.

In plain words
What is it for?
Use it to document software architecture, workflows, dependencies, sequences, and data movement. It also helps revise an existing D2 diagram and investigate reported syntax or layout errors.
Why use it?
It removes the need to draw these diagrams by hand and helps catch errors in the diagram source. It can produce source text or PNG, SVG, and ASCII outputs when the connected diagram service supports them.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the d2 plugin — 1 skill, 1 MCP server shipped together

Good fit Use it to document software architecture, workflows, dependencies, sequences, and data movement. It also helps revise an existing D2 diagram and investigate reported syntax or layout errors.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/h0rv/d2-mcp/d2
View source ↗ h0rv/d2-mcp
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.

Any agent
npx skills add h0rv/d2-mcp --skill d2
Clone the repo
git clone --depth 1 https://github.com/h0rv/d2-mcp

Made for: Claude Code.

Or install d2, the plugin that ships this one along with the rest of its 1 skill, 1 MCP server.

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 d2

README.md
[![agentmods](https://agentmods.dev/badge/skills/h0rv/d2-mcp/d2/github.svg)](https://agentmods.dev/skills/h0rv/d2-mcp/d2)
Your own site
<a href="https://agentmods.dev/skills/h0rv/d2-mcp/d2"><img src="https://agentmods.dev/badge/skills/h0rv/d2-mcp/d2/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 d2

Your own site · 80×15
<a href="https://agentmods.dev/skills/h0rv/d2-mcp/d2"><img src="https://agentmods.dev/badge/skills/h0rv/d2-mcp/d2.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 867 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.00049 $0.00867
Opus 5.5 $0.00020 $0.00347
Sonnet 5.5 $0.00010 $0.00173
Haiku 4.5 $0.00005 $0.00087

Measured 8d ago against content hash 1c599e248d24, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

d2 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 8d ago.

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.

agents/package/skills/d2/SKILL.md · 34 lines

How it starts

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

D2 diagrams

Use the connected d2-mcp tools. If they are unavailable, explain that the MCP connection must be installed; do not claim a diagram was rendered. Discover compile-d2, render-d2, and fetch_d2_cheat_sheet; clients may add a prefix or normalize hyphens to underscores.

Inspect the advertised tool schemas before selecting options. This workflow targets the refreshed server; older releases may lack layout choices, structured diagnostics, or native PNG. If a requested feature is unavailable, explain the version limitation and use only options the connected server advertises.

  1. Identify the audience, relationships, and requested artifact. Infer reasonable layout choices from the task; ask only for missing facts that change the diagram.
  2. Read fetch_d2_cheat_sheet when syntax or supported features are uncertain. Write the complete D2 source. Keep labels short, group related nodes, and make arrow direction meaningful. Start with dagre; try elk for dense hierarchies or tala when its layout improves readability.
  3. Call compile-d2 with code and the intended layout/options. Read isError and structuredContent.error, including one-based diagnostic locations. Fix the source and validate again. Do not retry unchanged invalid input or silently remove requested content.
  4. Call render-d2 with the same complete source/options. Prefer PNG for viewing, SVG for a scalable downloadable artifact, and ASCII for text-only output. Inspect the returned artifact when the client permits; report rendering success separately from visual inspection.
  5. Return the artifact and complete source, or save source to a user-requested local file when your client has file tools. Explain material assumptions and any limitation that prevented the requested result. For revisions, resubmit the full source and options.

Inputs, files, and state

  • code works with local or remote servers and agents without files. file_path means a relative .d2 file on the server, within its configured input root; it does not upload a client file. Use exactly one input. Resolve imports into self-contained source for a remote server unless its operator has configured the required files.
  • Each HTTP request is independent. Preserve the source and rendering options in the conversation or user-controlled files. The default server has no document store. Use document_id and revision only if a configured server advertises a document backend; handles work only within that backend and its authorization namespace.
  • PNG is MCP image content, SVG is an embedded resource containing XML, and ASCII is text. A urn:sha256:... identifies returned content; it is not a download URL. A returned file: path is server-local. Do not invent a hosted artifact link.
  • Use output_name only when the user wants a server-local artifact and the server has an output root. Overwrite needs both server opt-in and explicit request intent. Saving returned bytes with client file tools does not require server output configuration.
  • Assets require server opt-in. Never fetch arbitrary network images or bypass configured file roots. If an asset is unavailable, describe the limitation and offer a text/native-shape alternative without silently changing the requested diagram.
  • Multi-board source needs an explicit board_path when selecting a nested board; inspect the tool schema for its path representation. One render returns one artifact, not a board collection.

Read the full file on GitHub · 34 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. 8d ago First seen · 34 lines · 49 tokens per session scan A 1c599e248d24

Subscribe to this mod's changes

d2 is a skill published in the GitHub repository h0rv/d2-mcp (22 stars, last pushed today), licensed MIT. It adds 49 tokens to every session and 867 once invoked, about $0.0002 per session on Opus 5.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-10-13.

Related

Other skills, from other repositories

webgl-holographic-foil

A self-contained WebGL2 hero: thin-film interference over a crushed-foil surface whose palette shifts with the viewing angle; move the cursor to tilt the film.

nexu-io/open-design · 41 tokens

html-ppt-hermes-cyber-terminal

OpenDesign + BYOK: choosing and wiring your own model, hands-on — cost, quality, and the routing decision. Built as a decision-grade AI literacy deck for engineers, IT, applied-AI teams.

nexu-io/open-design · 53 tokens

html-ppt-taste-brutalist

16:9 HTML deck in tactical-telemetry / CRT-terminal taste. Deactivated-CRT charcoal slides, white-phosphor monospace, hazard-red accent, scanline overlay, ASCII syntax, density over decoration. Distilled from Leonxlnx/taste-skill brutalist-skill (Tactical Telemetry mode).

nexu-io/open-design · 78 tokens

visual-ralph

Visual Ralph orchestration for frontend UI from generated references, static references, or live URL targets, using $ultragoal with built-in visual verdict and pixel-diff evidence until the implementation matches and leaves a reproducible design system.

Yeachan-Heo/oh-my-codex · 52 tokens

glance-canonical-layouts

Use this skill to create home screen widgets using Jetpack Glance Canonical Layouts from the Android Platform Samples project, or when asked to implement standard widget layout patterns (including Check List, Image Grid, Snap Scrolling, and Standard Toolbar).

android/skills · 56 tokens

accessibility

Consolidated accessibility skill entrypoint for WCAG 2.2, ARIA Authoring Practices, cognitive accessibility, Section 508, EN 301 549, design intent verification, and the Accessibility Planner workflow.

microsoft/hve-core · 47 tokens