# D2 Diagrams

> Ask for a diagram and get a clean SVG that the agent has already checked and fixed.

D2 Diagrams is a paid AI agent skill on Agensi by Kevin Hollingworth, in Technical Documentation. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Kevin Hollingworth](https://www.agensi.io/creators/kevin-hollingworth)
- Category: [Technical Documentation](https://www.agensi.io/skills/technical-documentation)
- Version: 1.0
- Last updated: 2026-10-19
- Security: scan passed (2026-10-19); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/d2-diagrams
- Tags: documentation, devops, d2-lang, architecture-diagrams, svg-rendering, diagrams

## About this skill

Ask your agent for a diagram and it writes D2 source, renders it to SVG, then looks at its own render and fixes overlaps, crossed edges and cramped labels before handing it over. You get the SVG plus the `.d2` source, so the diagram stays editable.

### What it draws

- Architecture and system diagrams
- Flowcharts and state machines
- Sequence diagrams
- Database schemas (ERDs)
- Network and cloud topologies, and C4

### How it works

1. **Toolchain check.** Confirms the d2 CLI is installed and works out which layout engine you have. If d2 is missing, it installs it through Homebrew when you have Homebrew, and otherwise prints the install command for you to run.
2. **Write the source.** Picks the right diagram type and structure from its pattern guide.
3. **Render.** Uses TALA when you have a licence and ELK otherwise. It never ships a watermarked render.
4. **Check and repair.** Renders a PNG preview, inspects it, and fixes what it finds. It repeats until the diagram is clean.
5. **Deliver.** Gives you the SVG and the source, and offers a dark-mode version for GitHub READMEs.

### What's in the package

- `SKILL.md` with the full workflow
- `scripts/setup.sh` and `scripts/render.sh` for the toolchain check and rendering
- Three reference files: D2 syntax and the mistakes that compile but render wrong, layout engines, and diagram patterns

### Requirements

The d2 CLI, version 0.7.0 or later (free and open source). TALA is optional and licensed separately by Terrastruct. The PNG self-check downloads a headless browser the first time it runs.

Not for data charts such as bar, line or scatter plots.

## Requires

- d2 CLI 0.7.0 or later
- Optional: TALA

## Known limitations

Needs the d2 CLI, version 0.7.0 or later. Not for data charts such as bar, line or scatter plots. The PNG self-check downloads a headless browser the first time it runs. TALA is optional and needs its own licence from Terrastruct; without it the skill uses ELK.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the D2 Diagrams skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What does the self-check look for?

The agent renders a PNG preview and reads it in two passes. First, does the diagram tell the story in the right order, with the groupings you planned? Second, layout defects: edge labels drifting away from their edge, edges crossing through shapes, cut-off text, cramped or empty regions. It fixes them by changing the D2 source (direction, containers, shorter labels) and renders again, usually two to four times.

### Do I need a TALA licence?

No. Without TALA the skill renders with ELK, which is free and ships with d2. If you have a TALA licence it uses TALA automatically. It won't deliver a render carrying TALA's evaluation watermark unless you ask for one.

### What do I get?

The full skill: SKILL.md with the workflow, two shell scripts for the toolchain check and rendering, and three reference files covering D2 syntax pitfalls, layout engines and diagram patterns. Each diagram comes back as an SVG plus its .d2 source, so you can keep editing it.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
