d2
Skill5 starsChanged 8 months agoMITView on GitHub
MUST USE when creating or editing diagrams in D2. Covers sequence diagrams, flowcharts, architecture diagrams, ERDs, UML class diagrams, grid layouts, and other text-defined diagrams rendered with D2 syntax. Do NOT use for Mermaid, PlantUML, draw.io, or image-editing tasks unless the user explicitly wants D2 output.
- Installs packages
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- charm-vhsSkill
- cloud-foundation-fabricSkill
- duckdbSkill
- github-profile-architectSkill
- jqSkill
- opencode-devSkill
- playwright-cliSkill
- skill-crawlerSkill
- skill-registry-syncSkill
- tech-writerSkill
- terminal-ui-engineerSkill
- terraformSkill
- worktrunkSkill
- writingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 8 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Create professional diagrams using D2 (Declarative Diagramming) syntax.
- Very specific: line 25
Add to your ~/.config/mise/config.toml:
- Distinctive: line 49
Use this skill when you need to:
- Distinctive: line 50
Create sequence diagrams showing temporal flow between actors
- Distinctive: line 53
Create entity-relationship diagrams (ERDs)
- Distinctive: line 57
Create multi-board compositions (layers, scenarios, steps)
- Distinctive: line 242
Group related components: - Use containers to organize complex diagrams
- Very specific: line 243
Use block strings for multiline: - Use | followed by content and closing |
- Distinctive: line 244
Apply consistent styling: - Use the professional color palette
- Very specific: line 247
Quote labels with special characters: - Always wrap labels containing slashes, spaces, SQL, URLs, or % in double quotes: BackendAPI -> …
- Very specific: line 248
Classes and labels are separate: - Use Node: {class: myclass.
- Very specific: line 249
Groups wrap connections, not define them: - Use group name: { actor -> actor: message } for grouping sequences
- Distinctive: line 253
If D2 compilation fails:
- Very specific: line 260
Check glob filter syntax: - Use & for filters, !& for inverse
- Very specific: line 269
Invalid text beginning unquoted key: - When using semicolons in labels (e.g., AGN-01.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
D2 Diagramming
Create professional diagrams using D2 (Declarative Diagramming) syntax. D2 generates clean, readable diagrams from text definitions.
Installation
This skill requires the D2 CLI tool. We use mise to manage all tools.
Using mise (Preferred)
Add to your ~/.config/mise/config.toml:
[tools]
"go:oss.terrastruct.com/d2" = { version = "latest" }Then install:
mise install
# Verify installation:
mise list | grep d2Alternative: Go Install
go install oss.terrastruct.com/d2@latestWhen to use me
Use this skill when you need to:
- Create sequence diagrams showing temporal flow between actors
- Generate flowcharts for process visualization
- Build architecture diagrams
- Create entity-relationship diagrams (ERDs)
- Visualize system interactions
- Design UML class diagrams
- Build grid-based diagrams
- Create multi-board compositions (layers, scenarios, steps)
Quick Start
Basic Connections
direction: right
A -> B: connection label
B -> C: another connectionConnection types:
--- Line connection->- Arrow connection<-- Reverse arrow connection<->- Bidirectional arrow connection
Simple Shapes
imAShape
my_shape: Custom Label Here
PostgreSQL: {shape: cylinder}
User: {shape: person}
API: {shape: cloud}Professional Styling Standards
Brand Colors
{
"Primary Blue": "#9FA7D0",
"Light Blue": "#00A7E1",
"Pink": "#E82370",
"Teal": "#66CAD8",
"Indigo": "#404FA2",
"Green": "#00CC40",
"Lime": "#CBDB2A",
"Yellow": "#F9EB00",
"Orange": "#FAA61A",
"Red": "#F22000",
"Dark Blue": "#00205C",
"Slate": "#465669",
"Black": "#000000",
"Stroke": "#2A2A33"
}Reusable Classes
classes: {
professional-person: {
shape: person
style.fill: "#66CAD8"
style.stroke: "#2A2A33"
style.stroke-width: 1
}
professional-service: {
style.fill: "#9FA7D0"
style.stroke: "#2A2A33"
style.stroke-width: 1
}
professional-database: {
shape: cylinder
style.fill: "#E82370"
style.stroke: "#2A2A33"
style.stroke-width: 1
}
professional-external: {
shape: cloud
style.fill: "#00A7E1"
style.stroke: "#2A2A33"
style.stroke-width: 1
}
}Common Patterns
System Architecture
direction: right
classes: {
service: {
style.fill: "#9FA7D0"
style.stroke: "#2A2A33"
}
}
Client -> LoadBalancer: HTTPS
LoadBalancer -> API: route
API -> Database: querySequence Diagram
shape: sequence_diagram
User -> Frontend: click button
Frontend -> Backend: POST /api/data
Backend --> Frontend: JSON response
Frontend --> User: display dataSequence Diagram with API Calls and SQL
shape: sequence_diagram
classes: {
person: {shape: person}
service: {}
database: {shape: cylinder}
}
User: {class: person}
Frontend: {class: service}
Backend: {class: service}
Database: {class: database}
User -> Frontend: "Enter credentials"
Frontend -> Backend: "POST /api/auth/sync"
Backend -> Database: "SELECT id FROM users WHERE firebase_uid = ?"
Database --> Backend: "User record or null"
Backend --> Frontend: "Return user with NanoID"CLI Commands
Generate outputs
# SVG (default)
d2 input.d2 output.svg
# PNG, PDF, PPTX
d2 input.d2 output.png
d2 input.d2 output.pdf
# Watch mode
d2 -w input.d2 output.svg
# Themes
d2 input.d2 output.svg --theme=1
d2 themes # List themesLayout engines
d2 input.d2 output.svg --layout=dagre # default
d2 input.d2 output.svg --layout=elk
d2 input.d2 output.svg --layout=talaReference Documentation
For detailed information on specific topics, load the relevant reference:
| Reference | File | Contents |
| Shapes & Styling | references/shapes.md | Complete shapes catalog, style keywords, arrowheads |
| Sequence Diagrams | references/sequence.md | Spans, groups, notes, self-messages |
| Database & UML | references/database.md | SQL tables, ERDs, UML classes, constraints |
| Advanced Features | references/advanced.md | Variables, globs, composition, imports, models |
| Examples Gallery | references/examples.md | Complete working examples for all diagram types |
When to load references:
- Creating complex diagrams with specialized shapes → Load
shapes.md - Building sequence diagrams with groups/spans → Load
sequence.md - Designing database schemas or UML → Load
database.md - Using variables, globs, or composition → Load
advanced.md - Need inspiration or templates → Load
examples.md
Best Practices
- Use classes for consistent styling - Define reusable styles in
classesblock - Quote JSON-like strings -
{key: value}should be"{key: value}" - Keep labels concise - Shorter is better for readability
- Group related components - Use containers to organize complex diagrams
- Use block strings for multiline - Use
|followed by content and closing| - Apply consistent styling - Use the professional color palette
- Use vars for reusable values - Define colors, names in vars section
- Leverage globs for global changes - Apply styles to multiple shapes at once
- Quote labels with special characters - Always wrap labels containing slashes, spaces, SQL, URLs, or
%in double quotes:BackendAPI -> Database: "SELECT * FROM users WHERE id = ?" - Classes and labels are separate - Use
Node: {class: myclass; label: text}syntax with semicolon separator - Groups wrap connections, not define them - Use
group name: { actor -> actor: message }for grouping sequences
Debugging
If D2 compilation fails:
- Check for unquoted JSON-like strings - Wrap in quotes
- Ensure no trailing colons without values
- Verify all shapes are properly closed
- Block strings must be terminated - Closing
|on its own line - Use double quotes for special characters -
$,#,%, etc. - Check glob filter syntax - Use
&for filters,!&for inverse - Quote connection labels with special characters - Labels containing
/,?,=,%, SQL keywords (SELECT, FROM, WHERE), or paths MUST be quoted:- ❌
BackendAPI -> Database: GET /api/users?id=123 - ✅
BackendAPI -> Database: "GET /api/users?id=123" - ❌
BackendAPI -> Database: SELECT * FROM users - ✅
BackendAPI -> Database: "SELECT * FROM users" - ❌
Backend -> DB: Sample 50% of data - ✅
Backend -> DB: "Sample 50% of data"
- ❌
- Cannot create edge inside edge - In sequence diagrams with
group, define the connections inside the group, don't nest groups within connection labels - Invalid text beginning unquoted key - When using semicolons in labels (e.g.,
AGN-01; Router), the parser may fail - use separate label field or quotes
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

