Excalidraw

softaworks/agent-toolkit/skills/excalidraw

作者 softaworks3027f20f3181758385a1bb8c022d4041dfb4de84無授權條款2.5K 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫7 個月前更新

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)

僅含說明AI & Agents
AI 產生的概覽

將 Excalidraw 圖表檔案操作委派給子代理,避免主代理上下文耗盡。

功能
此技能為處理 Excalidraw 檔案(*.excalidraw 與 *.excalidraw.json)定義了一套委派模式。它要求主代理絕不直接讀取這些冗長的 JSON 檔案,而是派發子代理來讀取、修改、建立或比較圖表,只回傳文字摘要。技能為每種操作提供任務範本與 token 成本說明。
適用情境
當任務涉及 Excalidraw 檔案,或使用者要求解釋、更新、建立或比較圖表、流程圖或架構視覺化時使用。它適用於任何 Excalidraw 操作,包括小檔案和快速檢查。
執行需求
除代理的子代理/Task 能力外,無需指令碼或特殊工具;此技能僅為指示。

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 JSON2. Extract only text elements (ignore positioning/styling)3. Identify relationships between components4. 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 elements2. Find [existing-component] and its position3. Create new element JSON for [component]4. Add arrow elements for connections5. 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] components2. Create rectangle elements with text labels3. Add arrows showing relationships4. 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 files2. Extract text labels from each3. Identify structural differences4. 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)

ExcuseRealityWhat to Do
"Direct reading is most efficient"Consumes 4k-22k tokens unnecessarilyDelegate to subagent
"It's token-efficient to read directly"Baseline tests showed 9-45% budget usedAlways delegate
"This is optimal for one-time analysis""One-time" still pollutes main contextSubagent isolation
"The JSON is straightforward"Simplicity ≠ token efficiencyDelegate anyway
"I need to understand the format"Format understanding not needed in main agentSubagent handles format
"Within reasonable bounds" (18k tokens)"Reasonable" is subjective rationalizationHard rule: delegate
"Just a quick check of components""Quick check" still loads full JSONExtract text via subagent
"File is small (16K)"4k tokens is NOT smallSize 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

OperationMain Agent ActionSubagent Returns
Understand diagramDelegate with "Extract and explain" templateComponent list + relationships
Modify diagramDelegate with "Add [X] connected to [Y]" templateConfirmation + changes made
Create diagramDelegate with "Create showing [description]" templateFile location + summary
Compare diagramsDelegate with "Compare [A] vs [B]" templateKey differences (not raw JSON)

Token Analysis (Why This Matters)

Real data from baseline testing:

ScenarioWithout DelegationWith DelegationSavings
Single large file22k tokens (45% budget)~500 tokens (subagent summary)98%
Two-file comparison18k tokens (9% budget)~800 tokens (diff summary)96%
Modification task14k 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.

來源與署名

來源:softaworks/agent-toolkit位於skills/excalidraw提交3027f20

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架