Back to Architecture & Design Patterns

excalidraw

excalidrawdiagramsarchitecturevisualizationai agentcontext managementflowchartsdocumentation
⭐ 2.0kπŸ“„ MITπŸ•’ 2026-03-05Source β†—

Install this skill

npx skills add softaworks/agent-toolkit

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

The Excalidraw skill optimizes agent context management by strictly prohibiting main agents from processing raw .excalidraw JSON files directly. These files contain heavy visual metadataβ€”such as coordinate positioning, styling, and version seedsβ€”which often constitute over 90% of the file content while consuming massive token budgets. By mandating the use of specialized subagents, this architecture isolates parsing logic and high-cost token consumption from the primary reasoning loop. Instead of loading complex JSON structures into the main context, subagents focus on extracting semantic labels and architectural relationships. This workflow keeps the main workspace clear of noisy metadata, prevents excessive token spend during routine diagram operations, and maintains architectural focus while interacting with visual system documentation.

When to Use This Skill

  • β€’Extracting system component lists from complex flowcharts
  • β€’Updating architecture diagrams after service modifications
  • β€’Comparing design variations across multiple diagram files
  • β€’Generating visual representations of documented service flows

How to Invoke This Skill

Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:

  • β€œExplain the architecture in the flow diagram
  • β€œAdd a database service to the existing system map
  • β€œCompare the flowcharts for the two microservice approaches
  • β€œCreate a new diagram illustrating the authentication path
  • β€œSummarize the components found in the system design file

Pro Tips

  • πŸ’‘When requesting changes, be as specific as possible about the textual content or key relationships, rather than visual styling, to guide the subagent efficiently.
  • πŸ’‘Leverage this skill for large, multi-file Excalidraw projects; the delegation prevents your main agent from exceeding token limits across numerous diagrams.
  • πŸ’‘Combine with documentation generation skills to automatically embed diagram explanations alongside your code documentation.

What this skill does

  • β€’Isolated parsing of .excalidraw JSON structures
  • β€’Semantic extraction of text labels and component relationships
  • β€’Automated architectural diagram updates
  • β€’Cross-file architectural comparison summaries
  • β€’Programmatic generation of new system diagrams

When not to use it

  • βœ•Manually editing visual styling, positioning, or colors
  • βœ•Rendering actual browser-based images for direct user viewing
  • βœ•Handling non-JSON based image formats like PNG or SVG

Example workflow

  1. Main agent receives a request to analyze a .excalidraw diagram.
  2. Main agent initiates a subagent task specifically for file parsing.
  3. Subagent reads the JSON and discards visual metadata like coordinates.
  4. Subagent maps the semantic relationships and text labels.
  5. Subagent returns a concise summary of components and dependencies to the main agent.
  6. Main agent proceeds with the system task using only the relevant architectural insights.

Prerequisites

  • –Target file must be in .excalidraw or .excalidraw.json format
  • –Configured agent-toolkit environment
  • –Subagent delegation capabilities active

Pitfalls & limitations

  • !Accidentally loading full JSON into main context triggers extreme token inflation.
  • !Attempting to manually parse elements leads to misinterpretation of visual data.
  • !Over-reliance on visual style descriptions instead of functional relationships.

FAQ

Why can't I just read the JSON file directly?
Direct reading consumes excessive tokens by including thousands of lines of coordinate and styling metadata that provide no value to the main agent's reasoning process.
Does the subagent return the full JSON structure?
No, it returns a filtered summary consisting of text elements and dependency mappings to keep the main context clean.
What happens if I forget to delegate?
You risk context overflow and potential performance degradation by forcing the model to parse high-noise, low-signal metadata.

How it compares

This skill prevents context pollution by enforcing strict separation of duties, whereas manual parsing requires high-overhead processing that frequently exceeds standard token budget limits.

Source & trust

⭐ 2.0k starsπŸ“„ MITπŸ•’ Updated 2026-03-05
πŸ“„ Full skill instructions β€” original source: softaworks/agent-toolkit
# 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.**

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/excalidraw/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/softaworks/agent-toolkit/excalidraw/SKILL.md
  • Cursor: ~/.cursor/skills/softaworks/agent-toolkit/excalidraw/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/softaworks/agent-toolkit/excalidraw/SKILL.md

πŸš€ Install with CLI:
npx skills add softaworks/agent-toolkit

Read the Master Guide: Mastering Agent Skills β†’

Recommended Rules

View more rules β†’

Recommended Workflows

View more workflows β†’

Recommended MCP Servers

View more MCP servers β†’

Take It Further

Maximize your productivity with these powerful resources

πŸ“‹

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
πŸ“–

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid architecture & design patterns issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Architecture & Design Patterns and is published by Softaworks, maintained in softaworks/agent-toolkit.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.