D2 is a modern diagram scripting language that turns text into diagrams. It compiles declarative text files into SVG, PNG, and PDF outputs with automatic layout, multiple themes, and support for sequence diagrams, class diagrams, and network topologies.
Scanned 6/8/2026
Install via CLI
openskills install agentskillexchange/skills---
name: "D2 Modern Diagram Scripting Language and CLI"
slug: "d2-diagram-scripting-language-cli"
description: "D2 is a modern diagram scripting language that turns text into diagrams. It compiles declarative text files into SVG, PNG, and PDF outputs with automatic layout, multiple themes, and support for sequence diagrams, class diagrams, and network topologies."
github_stars: 23316
verification: "security_reviewed"
source: "https://github.com/terrastruct/d2"
category: "Developer Tools"
framework: "Multi-Framework"
tool_ecosystem:
github_repo: "terrastruct/d2"
github_stars: 23316
npm_package: "@terrastruct/d2"
npm_weekly_downloads: 14050
---
# D2 Modern Diagram Scripting Language and CLI
D2 is a modern diagram scripting language that turns text into diagrams. It compiles declarative text files into SVG, PNG, and PDF outputs with automatic layout, multiple themes, and support for sequence diagrams, class diagrams, and network topologies.
## Installation
Use the upstream install or setup path that matches your environment:
- go install oss.terrastruct.com/d2@latest
Requirements and caveats from upstream:
- particularly suited for node-link diagrams with an inherent direction and ports.
- specifically for software architecture diagrams. Requires separate install, visit the
- **Python D2 diagram builder**: [https://github.com/MrBlenny/py-d2](https://github.com/MrBlenny/py-d2)
Basic usage or getting-started notes:
- <img width="400px" src="./docs/assets/example.svg" alt="D2 render example" />
- The most convenient way to use D2 is to just run it as a CLI executable to
- produce SVGs from .d2 files.
- Source: https://github.com/terrastruct/d2
- Extracted from upstream docs: https://raw.githubusercontent.com/terrastruct/d2/HEAD/README.md
## Source
- [Agent Skill Exchange](https://agentskillexchange.com/skills/d2-diagram-scripting-language-cli/)
No comments yet. Be the first to comment!