excalidraw
Original:🇺🇸 English
Translated
Generate architecture diagrams as .excalidraw files from codebase analysis. Use when the user asks to create architecture diagrams, system diagrams, visualize codebase structure, or generate excalidraw files.
5installs
Sourceooiyeefei/ccc
Added on
NPX Install
npx skill4agent add ooiyeefei/ccc excalidrawTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Excalidraw Diagram Generator
Generate architecture diagrams as files directly from codebase analysis.
.excalidrawQuick Start
User just asks:
"Generate an architecture diagram for this project"
"Create an excalidraw diagram of the system"
"Visualize this codebase as an excalidraw file"Claude Code will:
- Analyze the codebase (any language/framework)
- Identify components, services, databases, APIs
- Map relationships and data flows
- Generate valid JSON with dynamic IDs and labels
.excalidraw
No prerequisites: Works without existing diagrams, Terraform, or specific file types.
Critical Rules
1. NEVER Use Diamond Shapes
Diamond arrow connections are broken in raw Excalidraw JSON. Use styled rectangles instead:
| Semantic Meaning | Rectangle Style |
|---|---|
| Orchestrator/Hub | Coral ( |
| Decision Point | Orange ( |
2. Labels Require TWO Elements
The property does NOT work in raw JSON. Every labeled shape needs:
labeljson
// 1. Shape with boundElements reference
{
"id": "my-box",
"type": "rectangle",
"boundElements": [{ "type": "text", "id": "my-box-text" }]
}
// 2. Separate text element with containerId
{
"id": "my-box-text",
"type": "text",
"containerId": "my-box",
"text": "My Label"
}3. Elbow Arrows Need Three Properties
For 90-degree corners (not curved):
json
{
"type": "arrow",
"roughness": 0, // Clean lines
"roundness": null, // Sharp corners
"elbowed": true // 90-degree mode
}4. Arrow Edge Calculations
Arrows must start/end at shape edges, not centers:
| Edge | Formula |
|---|---|
| Top | |
| Bottom | |
| Left | |
| Right | |
Detailed arrow routing: See
references/arrows.mdElement Types
| Type | Use For |
|---|---|
| Services, databases, containers, orchestrators |
| Users, external systems, start/end points |
| Labels inside shapes, titles, annotations |
| Data flow, connections, dependencies |
| Grouping boundaries, separators |
Full JSON format: See
references/json-format.mdWorkflow
Step 1: Analyze Codebase
Discover components by looking for:
| Codebase Type | What to Look For |
|---|---|
| Monorepo | |
| Microservices | |
| IaC | Terraform/Pulumi resource definitions |
| Backend API | Route definitions, controllers, DB models |
| Frontend | Component hierarchy, API calls |
Use tools:
- →
Glob,**/package.json,**/Dockerfile**/*.tf - →
Grep,app.get,@ControllerCREATE TABLE - → README, config files, entry points
Read
Step 2: Plan Layout
Vertical flow (most common):
Row 1: Users/Entry points (y: 100)
Row 2: Frontend/Gateway (y: 230)
Row 3: Orchestration (y: 380)
Row 4: Services (y: 530)
Row 5: Data layer (y: 680)
Columns: x = 100, 300, 500, 700, 900
Element size: 160-200px x 80-90pxOther patterns: See
references/examples.mdStep 3: Generate Elements
For each component:
- Create shape with unique
id - Add referencing text
boundElements - Create text with
containerId - Choose color based on type
Color palettes: See
references/colors.mdStep 4: Add Connections
For each relationship:
- Calculate source edge point
- Plan elbow route (avoid overlaps)
- Create arrow with array
points - Match stroke color to destination type
Arrow patterns: See
references/arrows.mdStep 5: Add Grouping (Optional)
For logical groupings:
- Large transparent rectangle with
strokeStyle: "dashed" - Standalone text label at top-left
Step 6: Validate and Write
Run validation before writing. Save to or user-specified path.
docs/Validation checklist: See
references/validation.mdQuick Arrow Reference
Straight down:
json
{ "points": [[0, 0], [0, 110]], "x": 590, "y": 290 }L-shape (left then down):
json
{ "points": [[0, 0], [-325, 0], [-325, 125]], "x": 525, "y": 420 }U-turn (callback):
json
{ "points": [[0, 0], [50, 0], [50, -125], [20, -125]], "x": 710, "y": 440 }Arrow width/height = bounding box of points:
points [[0,0], [-440,0], [-440,70]] → width=440, height=70Multiple arrows from same edge - stagger positions:
5 arrows: 20%, 35%, 50%, 65%, 80% across edge widthDefault Color Palette
| Component | Background | Stroke |
|---|---|---|
| Frontend | | |
| Backend/API | | |
| Database | | |
| Storage | | |
| AI/ML | | |
| External APIs | | |
| Orchestration | | |
| Message Queue | | |
| Cache | | |
| Users | | |
Cloud-specific palettes: See
references/colors.mdQuick Validation Checklist
Before writing file:
- Every shape with label has boundElements + text element
- Text elements have containerId matching shape
- Multi-point arrows have ,
elbowed: trueroundness: null - Arrow x,y = source shape edge point
- Arrow final point offset reaches target edge
- No diamond shapes
- No duplicate IDs
Full validation algorithm: See
references/validation.mdCommon Issues
| Issue | Fix |
|---|---|
| Labels don't appear | Use TWO elements (shape + text), not |
| Arrows curved | Add |
| Arrows floating | Calculate x,y from shape edge, not center |
| Arrows overlapping | Stagger start positions across edge |
Detailed bug fixes: See
references/validation.mdReference Files
| File | Contents |
|---|---|
| Element types, required properties, text bindings |
| Routing algorithm, patterns, bindings, staggering |
| Default, AWS, Azure, GCP, K8s palettes |
| Complete JSON examples, layout patterns |
| Checklists, validation algorithm, bug fixes |
Output
- Location: or user-specified
docs/architecture/ - Filename: Descriptive, e.g.,
system-architecture.excalidraw - Testing: Open in https://excalidraw.com or VS Code extension