d2
Installation
SKILL.md
D2 — Diagram Composition Policies
Global rules for all D2 diagram generation. Every specialist and generation flow MUST enforce these. They are not optional.
CRITICAL — Every Diagram Must
- Use snake_case IDs —
api_gw: "API Gateway", NOT"API Gateway"as ID. Emojis go in labels only. - Set
directionexplicitly —direction: rightfor flows,direction: downfor hierarchies. If unsure, usedirection: right. Never omit. - Stay at one abstraction level — don't mix context actors with component internals.
- Stay under visual budget — max 12 top-level nodes, 7 per group, 3 nesting levels, 4 outgoing edges.
Abstraction Levels
Every diagram operates at exactly ONE of these levels: