Excalidraw Diagram Generator
Generate valid .excalidraw JSON files representing system architecture from codebase analysis.
Quick Start
Works without existing diagrams, Terraform, or specific file types. Analyzes any codebase structure. If the codebase has more than ~30 distinct components, limit scope to top-level packages or services only to keep the diagram readable.
Implementation Constraints
These are the constraints for this skill, stated once. Apply them while generating; they are
not repeated as a checklist afterward.
No Diamond Shapes: Diamond arrow connections are broken in raw Excalidraw JSON. Use styled rectangles instead:
- Orchestrators: coral background with thick stroke
- Decision points: orange background with dashed stroke
Label Architecture: The label property does NOT work in raw JSON. Every labeled element requires:
- A shape with
boundElements referencing the text element
- A separate text element with
containerId pointing to the shape
Arrow Formatting: Multi-point arrows need:
"elbowed": true
"roundness": null
"roughness": 0
Edge Positioning: Arrows must start/end at shape edges, not centers:
- Top:
(x + width/2, y)
- Bottom:
(x + width/2, y + height)
- Left:
(x, y + height/2)
- Right:
(x + width, y + height/2)
Unique element IDs, and every label needs both halves of the binding in rule 2.
The output is a JSON file, so the one check worth doing is the one you cannot do from memory:
confirm the written file parses. Everything else above is a generation-time constraint, not a
post-hoc review item.
Generation Workflow
- Analyze codebase structure - Identify components, services, and relationships
- Plan layout grid - Determine rows, columns, and spacing
- Generate shape elements - Create rectangles, ellipses, text labels; derive element IDs from component names (e.g.,
api-server, api-server-text) and verify all IDs are unique
- Add connection arrows - Connect components with proper edge positioning
- Apply grouping - Group related elements (namespaces, services, etc.)
- Write the output file - then confirm it parses as JSON
Input Parsing
Extract from user's request:
scope: What part of codebase to diagram (full, specific module, etc.)
type: Type of diagram (architecture, data flow, deployment, etc.)
depth: Level of detail (high-level overview vs detailed)
output: Output file path (defaults to ./architecture.excalidraw)
Output Format
Generate a valid .excalidraw JSON file with:
- Proper file structure (type, version, elements, appState)
- All shapes with unique IDs
- Proper text bindings for labels
- Correct arrow connections at shape edges
- Logical groupings with dashed rectangles
Reference Documentation
For detailed implementation guidance, see:
- JSON Format Reference - Complete element structure
- Arrow Routing Guide - Arrow positioning and patterns
- Color Palettes - Component type color schemes
- Examples - Layout patterns and templates
- Validation Rules - Debugging a diagram that renders wrong
1---2name: diagram-excalidraw3description: Generate Excalidraw architecture diagrams from codebase analysis. Use when user says "create an architecture diagram", "visualize the system design", "generate an excalidraw diagram", "draw the component structure", "create a visual representation of the codebase", or "diagram the data flow".4---56# Excalidraw Diagram Generator78Generate valid `.excalidraw` JSON files representing system architecture from codebase analysis.910## Quick Start1112Works without existing diagrams, Terraform, or specific file types. Analyzes any codebase structure. If the codebase has more than ~30 distinct components, limit scope to top-level packages or services only to keep the diagram readable.1314## Implementation Constraints1516These are the constraints for this skill, stated once. Apply them while generating; they are17not repeated as a checklist afterward.18191. **No Diamond Shapes**: Diamond arrow connections are broken in raw Excalidraw JSON. Use styled rectangles instead:2021 - Orchestrators: coral background with thick stroke22 - Decision points: orange background with dashed stroke23242. **Label Architecture**: The `label` property does NOT work in raw JSON. Every labeled element requires:2526 - A shape with `boundElements` referencing the text element27 - A separate text element with `containerId` pointing to the shape28293. **Arrow Formatting**: Multi-point arrows need:3031 - `"elbowed": true`32 - `"roundness": null`33 - `"roughness": 0`34354. **Edge Positioning**: Arrows must start/end at shape edges, not centers:3637 - Top: `(x + width/2, y)`38 - Bottom: `(x + width/2, y + height)`39 - Left: `(x, y + height/2)`40 - Right: `(x + width, y + height/2)`41425. **Unique element IDs**, and every label needs both halves of the binding in rule 2.4344The output is a JSON file, so the one check worth doing is the one you cannot do from memory:45confirm the written file parses. Everything else above is a generation-time constraint, not a46post-hoc review item.4748## Generation Workflow49501. **Analyze codebase structure** - Identify components, services, and relationships512. **Plan layout grid** - Determine rows, columns, and spacing523. **Generate shape elements** - Create rectangles, ellipses, text labels; derive element IDs from component names (e.g., `api-server`, `api-server-text`) and verify all IDs are unique534. **Add connection arrows** - Connect components with proper edge positioning545. **Apply grouping** - Group related elements (namespaces, services, etc.)556. **Write the output file** - then confirm it parses as JSON5657## Input Parsing5859Extract from user's request:6061- `scope`: What part of codebase to diagram (full, specific module, etc.)62- `type`: Type of diagram (architecture, data flow, deployment, etc.)63- `depth`: Level of detail (high-level overview vs detailed)64- `output`: Output file path (defaults to `./architecture.excalidraw`)6566## Output Format6768Generate a valid `.excalidraw` JSON file with:6970- Proper file structure (type, version, elements, appState)71- All shapes with unique IDs72- Proper text bindings for labels73- Correct arrow connections at shape edges74- Logical groupings with dashed rectangles7576## Reference Documentation7778For detailed implementation guidance, see:7980- [JSON Format Reference](references/json-format.md) - Complete element structure81- [Arrow Routing Guide](references/arrows.md) - Arrow positioning and patterns82- [Color Palettes](references/colors.md) - Component type color schemes83- [Examples](references/examples.md) - Layout patterns and templates84- [Validation Rules](references/validation.md) - Debugging a diagram that renders wrong