---
name: "d2-declarative-architecture-diagrams"
description: "Design clean, modern developer architecture diagrams with D2 declarative language."
metadata:
  author: "Terrastruct"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "write d2 diagram syntax"
  - "compile d2 to svg"
  - "create multi-layer d2 architecture"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# D2 Modern Architecture Diagramming Engine

Authors modern technical diagrams with D2: human-readable syntax, automated layout engines (TALA, ELK, Dagre), animated step-by-step connections, and dark mode themes.

## When to Invoke
Invoke this skill whenever you need to:
- write d2 diagram syntax
- compile d2 to svg
- create multi-layer d2 architecture

## Execution SOP & Rules
1. Declare connections cleanly using intuitive arrow syntax: server -> database: "Reads user data".
2. Group resources inside nested containers using container_name: { ... }.
3. Apply built-in professional themes with d2 --theme 200 input.d2 output.svg.
4. Leverage markdown formatting inside node labels using |md ... |.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
