Excalidraw skill

Use when working with *.excalidraw or *.excalidraw.json files, user mentions diagrams/flowcharts, or requests architecture visualization - delegates all Excalidraw operations to subagents to prevent context exhaustion from verbose JSON (single files: 4k-22k tokens, can exceed read limits)

by davila7·MIT license·★ 32,299 Stars on the repo·GitHub ↗

Use now

Files of Excalidraw

davila7/main1 file shown
SKILL.md
Show the full text222 lines

Excalidraw Subagent Delegation

Overview

Core principle: Main agents NEVER read Excalidraw files directly. Always delegate to subagents to isolate context consumption.

Excalidraw files are JSON with high token cost but low information density. Single files range from 4k-22k tokens (largest can exceed read tool limits). Reading multiple diagrams quickly exhausts context budget (7 files = 67k tokens = 33% of budget).

The Problem

Excalidraw JSON structure:

  • Each shape has 20+ properties (x, y, width, height, strokeColor, seed, version, etc.)
  • Most properties are visual metadata (positioning, styling, roughness)
  • Actual content: text labels and element relationships (<10% of file)
  • Signal-to-noise ratio is extremely low

Example: 14-element diagram = 596 lines, 16K, ~4k tokens. 79-element diagram = 2,916 lines, 88K, ~22k tokens (exceeds read limit).

When to Use

Trigger on ANY of these:

  • File path contains .excalidraw or .excalidraw.json
  • User requests: "explain/update/create diagram", "show architecture", "visualize flow"
  • User mentions: "flowchart", "architecture diagram", "Excalidraw file"
  • Architecture/design documentation tasks involving visual artifacts

Use delegation even for:

  • "Small" files (smallest is 4k tokens - still significant)
  • "Quick checks" (checking component names still loads full JSON)
  • Single file operations (isolation prevents context pollution)
  • Modifications (don't need full format understanding in main context)

Delegation Pattern

Main Agent Responsibilities

NEVER:

  • ❌ Use Read tool on *.excalidraw files
  • ❌ Parse Excalidraw JSON in main context
  • ❌ Load multiple diagrams for comparison
  • ❌ Inspect file to "understand the format"

ALWAYS:

  • ✅ Delegate ALL Excalidraw operations to subagents
  • ✅ Provide clear task description to subagent
  • ✅ Request text-only summaries (not raw JSON)
  • ✅ Keep diagram analysis isolated from main work
Subagent Task Templates
Read/Understand Operation
Task: Extract and explain the components in [file.excalidraw.json]

Approach:
1. Read the Excalidraw JSON
2. Extract only text elements (ignore positioning/styling)
3. Identify relationships between components
4. Summarize architecture/flow

Return:
- List of components/services with descriptions
- Connection/dependency relationships
- Key insights about the architecture
- DO NOT return raw JSON or verbose element details
Modify Operation
Task: Add [component] to [file.excalidraw.json], connected to [existing-component]

Approach:
1. Read file to identify existing elements
2. Find [existing-component] and its position
3. Create new element JSON for [component]
4. Add arrow elements for connections
5. Write updated file

Return:
- Confirmation of changes made
- Position of new element
- IDs of created elements
Create Operation
Task: Create new Excalidraw diagram showing [description]

Approach:
1. Design layout for [number] components
2. Create rectangle elements with text labels
3. Add arrows showing relationships
4. Use consistent styling (colors, fonts)
5. Write to [file.excalidraw.json]

Return:
- Confirmation of file created
- Summary of components included
- File location
Compare Operation
Task: Compare architecture approaches in [file1] vs [file2]

Approach:
1. Read both files
2. Extract text labels from each
3. Identify structural differences
4. Compare component relationships

Return:
- Key differences in architecture
- Components unique to each approach
- Relationship/flow differences
- DO NOT return full element details from both files

Common Rationalizations (STOP and Delegate Instead)

Excuse Reality What to Do
"Direct reading is most efficient" Consumes 4k-22k tokens unnecessarily Delegate to subagent
"It's token-efficient to read directly" Baseline tests showed 9-45% budget used Always delegate
"This is optimal for one-time analysis" "One-time" still pollutes main context Subagent isolation
"The JSON is straightforward" Simplicity ≠ token efficiency Delegate anyway
"I need to understand the format" Format understanding not needed in main agent Subagent handles format
"Within reasonable bounds" (18k tokens) "Reasonable" is subjective rationalization Hard rule: delegate
"Just a quick check of components" "Quick check" still loads full JSON Extract text via subagent
"File is small (16K)" 4k tokens is NOT small Size threshold doesn't matter

Red Flags - STOP and Delegate

Catch yourself about to:

  • Use Read tool on .excalidraw file
  • "Quickly check" what components exist
  • "Understand the structure" before modifying
  • Load file to "see what's there"
  • Compare multiple diagrams side-by-side
  • Parse JSON to "extract just the text"

All of these mean: Use Task tool with subagent instead.

Quick Reference

Operation Main Agent Action Subagent Returns
Understand diagram Delegate with "Extract and explain" template Component list + relationships
Modify diagram Delegate with "Add [X] connected to [Y]" template Confirmation + changes made
Create diagram Delegate with "Create showing [description]" template File location + summary
Compare diagrams Delegate with "Compare [A] vs [B]" template Key differences (not raw JSON)

Token Analysis (Why This Matters)

Real data from baseline testing:

Scenario Without Delegation With Delegation Savings
Single large file 22k tokens (45% budget) ~500 tokens (subagent summary) 98%
Two-file comparison 18k tokens (9% budget) ~800 tokens (diff summary) 96%
Modification task 14k tokens (7% budget) ~300 tokens (confirmation) 98%

Context pollution impact:

  • Reading all 7 project diagrams: 67k tokens (33% of 200k budget)
  • With delegation: ~2k tokens (isolated in subagents)
  • Savings: 97% context budget preserved

Implementation Example

❌ BAD (Direct Read):

User: "What architecture is shown in detailed-architecture.excalidraw.json?"
Agent: Let me read that file... [reads 22k tokens into main context]

✅ GOOD (Subagent Delegation):

User: "What architecture is shown in detailed-architecture.excalidraw.json?"
Agent: I'll use a subagent to extract the architecture details.

[Dispatches Task tool with general-purpose subagent]
Task: Extract and explain components in .ryanquinn3/ticketing/detailed-architecture.excalidraw.json

[Receives ~500 token summary with component list and relationships]
[Responds to user with architecture explanation, main context preserved]

Why "Straightforward JSON" Doesn't Matter

Agents often rationalize: "The format is simple, I can just read it."

The problem isn't complexity - it's verbosity:

  • Simple structure with 20+ properties per element
  • Repetitive metadata (seed, version, nonce, roughness)
  • Positioning data (x, y, width, height) not semantically useful
  • Visual styling (strokeColor, opacity, fillStyle) irrelevant to content

Token cost comes from volume, not complexity.

Even "straightforward" JSON consumes 4k-22k tokens because:

  • 79 elements × ~280 tokens/element = 22k tokens
  • Most tokens are metadata noise
  • Only text labels and relationships matter (~10% of content)

The Iron Law

Main agents NEVER read Excalidraw files. No exceptions.

Not for:

  • "Quick checks"
  • "Small files"
  • "Understanding format"
  • "One-time analysis"
  • "Optimal efficiency"

Always delegate. Isolation is free via subagents.

1---
2name: excalidraw
3description: "Use when working with *.excalidraw or *.excalidraw.json files, user mentions diagrams/flowcharts, or requests architecture visualization - delegates all Excalidraw operations to subagents to prevent context exhaustion from verbose JSON (single files: 4k-22k tokens, can exceed read limits)"
4---
5 
6# Excalidraw Subagent Delegation
7 
8## Overview
9 
10**Core principle:** Main agents NEVER read Excalidraw files directly. Always delegate to subagents to isolate context consumption.
11 
12Excalidraw files are JSON with high token cost but low information density. Single files range from 4k-22k tokens (largest can exceed read tool limits). Reading multiple diagrams quickly exhausts context budget (7 files = 67k tokens = 33% of budget).
13 
14## The Problem
15 
16Excalidraw JSON structure:
17- Each shape has 20+ properties (x, y, width, height, strokeColor, seed, version, etc.)
18- Most properties are visual metadata (positioning, styling, roughness)
19- Actual content: text labels and element relationships (<10% of file)
20- **Signal-to-noise ratio is extremely low**
21 
22Example: 14-element diagram = 596 lines, 16K, ~4k tokens. 79-element diagram = 2,916 lines, 88K, ~22k tokens (exceeds read limit).
23 
24## When to Use
25 
26**Trigger on ANY of these:**
27- File path contains `.excalidraw` or `.excalidraw.json`
28- User requests: "explain/update/create diagram", "show architecture", "visualize flow"
29- User mentions: "flowchart", "architecture diagram", "Excalidraw file"
30- Architecture/design documentation tasks involving visual artifacts
31 
32**Use delegation even for:**
33- "Small" files (smallest is 4k tokens - still significant)
34- "Quick checks" (checking component names still loads full JSON)
35- Single file operations (isolation prevents context pollution)
36- Modifications (don't need full format understanding in main context)
37 
38## Delegation Pattern
39 
40### Main Agent Responsibilities
41 
42**NEVER:**
43- ❌ Use Read tool on *.excalidraw files
44- ❌ Parse Excalidraw JSON in main context
45- ❌ Load multiple diagrams for comparison
46- ❌ Inspect file to "understand the format"
47 
48**ALWAYS:**
49- ✅ Delegate ALL Excalidraw operations to subagents
50- ✅ Provide clear task description to subagent
51- ✅ Request text-only summaries (not raw JSON)
52- ✅ Keep diagram analysis isolated from main work
53 
54### Subagent Task Templates
55 
56#### Read/Understand Operation
57```
58Task: Extract and explain the components in [file.excalidraw.json]
59 
60Approach:
611. Read the Excalidraw JSON
622. Extract only text elements (ignore positioning/styling)
633. Identify relationships between components
644. Summarize architecture/flow
65 
66Return:
67- List of components/services with descriptions
68- Connection/dependency relationships
69- Key insights about the architecture
70- DO NOT return raw JSON or verbose element details
71```
72 
73#### Modify Operation
74```
75Task: Add [component] to [file.excalidraw.json], connected to [existing-component]
76 
77Approach:
781. Read file to identify existing elements
792. Find [existing-component] and its position
803. Create new element JSON for [component]
814. Add arrow elements for connections
825. Write updated file
83 
84Return:
85- Confirmation of changes made
86- Position of new element
87- IDs of created elements
88```
89 
90#### Create Operation
91```
92Task: Create new Excalidraw diagram showing [description]
93 
94Approach:
951. Design layout for [number] components
962. Create rectangle elements with text labels
973. Add arrows showing relationships
984. Use consistent styling (colors, fonts)
995. Write to [file.excalidraw.json]
100 
101Return:
102- Confirmation of file created
103- Summary of components included
104- File location
105```
106 
107#### Compare Operation
108```
109Task: Compare architecture approaches in [file1] vs [file2]
110 
111Approach:
1121. Read both files
1132. Extract text labels from each
1143. Identify structural differences
1154. Compare component relationships
116 
117Return:
118- Key differences in architecture
119- Components unique to each approach
120- Relationship/flow differences
121- DO NOT return full element details from both files
122```
123 
124## Common Rationalizations (STOP and Delegate Instead)
125 
126| Excuse | Reality | What to Do |
127|--------|---------|------------|
128| "Direct reading is most efficient" | Consumes 4k-22k tokens unnecessarily | Delegate to subagent |
129| "It's token-efficient to read directly" | Baseline tests showed 9-45% budget used | Always delegate |
130| "This is optimal for one-time analysis" | "One-time" still pollutes main context | Subagent isolation |
131| "The JSON is straightforward" | Simplicity ≠ token efficiency | Delegate anyway |
132| "I need to understand the format" | Format understanding not needed in main agent | Subagent handles format |
133| "Within reasonable bounds" (18k tokens) | "Reasonable" is subjective rationalization | Hard rule: delegate |
134| "Just a quick check of components" | "Quick check" still loads full JSON | Extract text via subagent |
135| "File is small (16K)" | 4k tokens is NOT small | Size threshold doesn't matter |
136 
137## Red Flags - STOP and Delegate
138 
139Catch yourself about to:
140- Use Read tool on .excalidraw file
141- "Quickly check" what components exist
142- "Understand the structure" before modifying
143- Load file to "see what's there"
144- Compare multiple diagrams side-by-side
145- Parse JSON to "extract just the text"
146 
147**All of these mean: Use Task tool with subagent instead.**
148 
149## Quick Reference
150 
151| Operation | Main Agent Action | Subagent Returns |
152|-----------|-------------------|------------------|
153| **Understand diagram** | Delegate with "Extract and explain" template | Component list + relationships |
154| **Modify diagram** | Delegate with "Add [X] connected to [Y]" template | Confirmation + changes made |
155| **Create diagram** | Delegate with "Create showing [description]" template | File location + summary |
156| **Compare diagrams** | Delegate with "Compare [A] vs [B]" template | Key differences (not raw JSON) |
157 
158## Token Analysis (Why This Matters)
159 
160Real data from baseline testing:
161 
162| Scenario | Without Delegation | With Delegation | Savings |
163|----------|-------------------|-----------------|---------|
164| Single large file | 22k tokens (45% budget) | ~500 tokens (subagent summary) | 98% |
165| Two-file comparison | 18k tokens (9% budget) | ~800 tokens (diff summary) | 96% |
166| Modification task | 14k tokens (7% budget) | ~300 tokens (confirmation) | 98% |
167 
168**Context pollution impact:**
169- Reading all 7 project diagrams: 67k tokens (33% of 200k budget)
170- With delegation: ~2k tokens (isolated in subagents)
171- **Savings: 97% context budget preserved**
172 
173## Implementation Example
174 
175**❌ BAD (Direct Read):**
176```
177User: "What architecture is shown in detailed-architecture.excalidraw.json?"
178Agent: Let me read that file... [reads 22k tokens into main context]
179```
180 
181**✅ GOOD (Subagent Delegation):**
182```
183User: "What architecture is shown in detailed-architecture.excalidraw.json?"
184Agent: I'll use a subagent to extract the architecture details.
185 
186[Dispatches Task tool with general-purpose subagent]
187Task: Extract and explain components in .ryanquinn3/ticketing/detailed-architecture.excalidraw.json
188 
189[Receives ~500 token summary with component list and relationships]
190[Responds to user with architecture explanation, main context preserved]
191```
192 
193## Why "Straightforward JSON" Doesn't Matter
194 
195Agents often rationalize: "The format is simple, I can just read it."
196 
197**The problem isn't complexity - it's verbosity:**
198- Simple structure with 20+ properties per element
199- Repetitive metadata (seed, version, nonce, roughness)
200- Positioning data (x, y, width, height) not semantically useful
201- Visual styling (strokeColor, opacity, fillStyle) irrelevant to content
202 
203**Token cost comes from volume, not complexity.**
204 
205Even "straightforward" JSON consumes 4k-22k tokens because:
206- 79 elements × ~280 tokens/element = 22k tokens
207- Most tokens are metadata noise
208- Only text labels and relationships matter (~10% of content)
209 
210## The Iron Law
211 
212**Main agents NEVER read Excalidraw files. No exceptions.**
213 
214Not for:
215- "Quick checks"
216- "Small files"
217- "Understanding format"
218- "One-time analysis"
219- "Optimal efficiency"
220 
221**Always delegate. Isolation is free via subagents.**
222 

Discussion