kerta1n

excalidraw

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

kerta1n 0 Updated 3mo ago
GitHub

Install

npx skillscat add kerta1n/excalidraw-skill

Install via the SkillsCat registry.

SKILL.md

Excalidraw Subagent Delegation

Iron Law

Main agents NEVER read Excalidraw files. No exceptions. Always delegate via Task tool.
Excalidraw JSON has extreme verbosity (4k-22k tokens per file) with <10% signal. Subagents isolate this cost.

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 (4k tokens minimum), "quick checks", single file ops, modifications.

Critical Format Rules

Subagents must know these before writing/modifying Excalidraw JSON:

  1. Labels need TWO elements - label property broken in raw JSON. Shape needs boundElements: [{type:"text", id:"x-text"}] + separate text element with containerId: "x"
  2. NEVER use diamond shapes - Arrow connections broken in raw JSON. Use styled rectangles instead (coral for orchestrators, orange+dashed for decisions)
  3. Elbow arrows need THREE properties - roughness: 0, roundness: null, elbowed: true for 90-degree corners
  4. Arrow x,y = source shape edge, not center - Bottom: (x + width/2, y + height), Right: (x + width, y + height/2), etc.
  5. Arrow width/height = bounding box of points - width = max(abs(p[0])), height = max(abs(p[1]))
  6. Stagger multiple arrows from same edge - Spread at 20%-80% across edge width

Default color palette (most common):

TypeBGStroke
Frontend#a5d8ff#1971c2
Backend/API#d0bfff#7048e8
Database#b2f2bb#2f9e44
Storage#ffec99#f08c00
External#ffc9c9#e03131
Orchestration#ffa8a8#c92a2a

Reference Files

Subagents should read these before working on Excalidraw files:

FilePurposeUsed By
references/json-format.mdElement types, required properties, label binding, groupingCreate, Modify
references/arrows.mdRouting algorithm, edge formulas, patterns, staggering, bindingsCreate, Modify
references/colors.mdDefault + AWS/Azure/GCP/K8s palettesCreate
references/examples.mdFull 3-tier JSON example, layout patterns, complexity guidelinesCreate
references/validation.mdPre-flight algorithm, checklists, common bugs + fixesCreate, Modify

Delegation Pattern

Main Agent NEVER / ALWAYS

NEVER: Read .excalidraw files, parse Excalidraw JSON, load multiple diagrams, inspect files to "understand the format"

ALWAYS: Delegate via Task tool, provide clear task description, request text-only summaries (not raw JSON), keep diagram analysis isolated

Subagent Templates

Create Operation

Task: Create new Excalidraw diagram showing [description]

Context: Excalidraw JSON requires TWO elements per label (shape + text), elbow arrows need roughness:0/roundness:null/elbowed:true, NEVER use diamonds. Arrow x,y starts at shape edge not center.

Steps:
1. Read references/json-format.md, references/arrows.md, references/colors.md, references/examples.md
2. Analyze codebase to identify components and relationships
3. Plan layout (vertical flow most common: rows at y=100,230,380,530,680)
4. Generate elements with proper label bindings and arrow routing
5. Validate against references/validation.md before writing
6. Write to [file.excalidraw.json]

Return: File location + component summary

Modify Operation

Task: Add/update [component] in [file.excalidraw.json]

Context: Excalidraw JSON requires TWO elements per label (shape + text), elbow arrows need roughness:0/roundness:null/elbowed:true, NEVER use diamonds. Arrow x,y starts at shape edge not center.

Steps:
1. Read references/json-format.md and references/arrows.md
2. Read existing file, identify elements and positions
3. Make changes preserving existing element structure
4. Validate against references/validation.md before writing
5. Write updated file

Return: Confirmation + changes made

Read/Understand Operation

Task: Extract and explain the components in [file.excalidraw.json]

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

Return: Component list + relationships. DO NOT return raw JSON.

Compare Operation

Task: Compare architecture in [file1] vs [file2]

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

Return: Key differences only. DO NOT return raw element details.

Anti-Rationalization

ThoughtReality
"Direct reading is most efficient"Consumes 4k-22k tokens, use subagent
"It's a small file / quick check"Minimum 4k tokens, still pollutes context
"I need to understand the format"Format knowledge belongs in subagent, not main context
"The JSON is straightforward"Problem is verbosity not complexity: 79 elements x ~280 tokens = 22k
"Just parsing text labels"Still loads full JSON to extract 10% signal
"Within reasonable bounds""Reasonable" is rationalization. Hard rule: delegate

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

Token Analysis

ScenarioWithout DelegationWith DelegationSavings
Single large file22k tokens (45% budget)~500 tokens (summary)98%
Two-file comparison18k tokens~800 tokens (diff)96%
Modification task14k tokens~300 tokens (confirmation)98%
All 7 project diagrams67k tokens (33% budget)~2k tokens97%