excalidraw by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill excalidraw核心原则: 主代理绝不直接读取 Excalidraw 文件。始终委托给子代理以隔离上下文消耗。
Excalidraw 文件是 JSON 格式,令牌成本高但信息密度低。单个文件范围从 4k 到 22k 令牌(最大的可能超过读取工具限制)。读取多个图表会快速耗尽上下文预算(7 个文件 = 67k 令牌 = 预算的 33%)。
Excalidraw JSON 结构:
示例:14 个元素的图表 = 596 行,16K,约 4k 令牌。79 个元素的图表 = 2,916 行,88K,约 22k 令牌(超出读取限制)。
满足以下任一条件时触发:
.excalidraw 或 .excalidraw.json即使是以下情况也使用委托:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
绝不:
始终:
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
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
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
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
| 借口 | 现实 | 应做之事 |
|---|---|---|
| "直接读取最高效" | 不必要地消耗 4k-22k 令牌 | 委托给子代理 |
| "直接读取令牌效率高" | 基线测试显示使用了 9-45% 的预算 | 始终委托 |
| "这对一次性分析是最优的" | "一次性"仍然会污染主上下文 | 子代理隔离 |
| "JSON 很简单" | 简单 ≠ 令牌效率 | 仍然委托 |
| "我需要理解格式" | 主代理不需要理解格式 | 子代理处理格式 |
| "在合理范围内"(18k 令牌) | "合理"是主观的合理化 | 硬性规则:委托 |
| "只是快速检查一下组件" | "快速检查"仍然会加载完整的 JSON | 通过子代理提取文本 |
| "文件很小(16K)" | 4k 令牌不小 | 大小阈值不重要 |
当你即将做以下事情时,请警惕:
以上所有情况都意味着:应改用任务工具配合子代理。
| 操作 | 主代理操作 | 子代理返回内容 |
|---|---|---|
| 理解图表 | 使用"提取并解释"模板委托 | 组件列表 + 关系 |
| 修改图表 | 使用"添加 [X] 连接到 [Y]"模板委托 | 确认 + 所做的更改 |
| 创建图表 | 使用"创建展示 [描述]"模板委托 | 文件位置 + 摘要 |
| 比较图表 | 使用"比较 [A] 与 [B]"模板委托 | 关键差异(非原始 JSON) |
来自基线测试的真实数据:
| 场景 | 无委托 | 有委托 | 节省 |
|---|---|---|---|
| 单个大文件 | 22k 令牌(预算的 45%) | 约 500 令牌(子代理摘要) | 98% |
| 双文件比较 | 18k 令牌(预算的 9%) | 约 800 令牌(差异摘要) | 96% |
| 修改任务 | 14k 令牌(预算的 7%) | 约 300 令牌(确认) | 98% |
上下文污染影响:
❌ 错误做法(直接读取):
User: "What architecture is shown in detailed-architecture.excalidraw.json?"
Agent: Let me read that file... [reads 22k tokens into main context]
✅ 正确做法(子代理委托):
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]
代理经常合理化:"格式很简单,我可以直接读取。"
问题不在于复杂性 - 而在于冗长:
令牌成本来自数量,而非复杂性。
即使是"简单"的 JSON 也会消耗 4k-22k 令牌,因为:
主代理绝不读取 Excalidraw 文件。没有例外。
不适用于:
始终委托。通过子代理进行隔离是免费的。
每周安装量
330
仓库
GitHub 星标
22.6K
首次出现
Jan 25, 2026
安全审计
安装于
opencode272
claude-code253
gemini-cli246
codex234
cursor206
github-copilot198
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).
Excalidraw JSON structure:
Example: 14-element diagram = 596 lines, 16K, ~4k tokens. 79-element diagram = 2,916 lines, 88K, ~22k tokens (exceeds read limit).
Trigger on ANY of these:
.excalidraw or .excalidraw.jsonUse delegation even for:
NEVER:
ALWAYS:
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
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
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
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
| 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 |
Catch yourself about to:
All of these mean: Use Task tool with subagent instead.
| 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) |
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:
❌ 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]
Agents often rationalize: "The format is simple, I can just read it."
The problem isn't complexity - it's verbosity:
Token cost comes from volume, not complexity.
Even "straightforward" JSON consumes 4k-22k tokens because:
Main agents NEVER read Excalidraw files. No exceptions.
Not for:
Always delegate. Isolation is free via subagents.
Weekly Installs
330
Repository
GitHub Stars
22.6K
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode272
claude-code253
gemini-cli246
codex234
cursor206
github-copilot198
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
54,900 周安装
Rust调用关系图生成器 - 可视化函数调用层次结构,提升代码分析效率
539 周安装
parallel-web-extract:并行网页内容提取工具,高效抓取网页数据
595 周安装
腾讯云CloudBase AI模型Web技能:前端调用混元/DeepSeek模型,实现流式文本生成
560 周安装
Apollo Connectors 模式助手:GraphQL API 连接器开发与集成指南
565 周安装
GitHub Trending 趋势分析工具:实时发现热门项目、技术洞察与开源机会
556 周安装
GSAP React 集成教程:useGSAP Hook 动画库与 React 组件开发指南
546 周安装