excalidraw-diagram
Use when the user wants a workflow, architecture, protocol, concept, or Mermaid diagram converted into or out of Excalidraw, especially when the result should teach through structure, flow, and concrete evidence.
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- excalidraw-diagram
- metadata
- { "owner": "tze", "status": "active", "authors": [ "tze", "Claude Fable 5" ], "last_reviewed": "2026-06-12" }
- description
- Use when the user wants a workflow, architecture, protocol, concept, or Mermaid diagram converted into or out of Excalidraw, especially when the result should teach through structure, flow, and concrete evidence.
- compatibility
- Requires Python 3.11+, uv, and Playwright Chromium setup on first render. The Excalidraw browser bundle is vendored into the skill, so rendering stays local after setup. Refresh that bundle from the repo-level scripts/refresh.sh when needed.
02 资源文件 35
- 其他.gitignore40 B
- 参考文档README.md4.1 KB
- 参考文档references/design-patterns.md1.1 KB
- 参考文档references/element-templates.md3.3 KB
- 参考文档references/json-schema.md887 B
- 参考文档references/mermaid-interoperability.md3.0 KB
- 参考文档references/render_template.html1.9 KB
- 参考文档references/render-checklist.md1.0 KB
- 参考文档references/theme-catalog.md1.2 KB
- 参考文档references/themes/abyss.json876 B
- 参考文档references/themes/catalog.json501 B
- 参考文档references/themes/default.json878 B
- 参考文档references/themes/kimbie-dark.json882 B
- 参考文档references/themes/midnight.json879 B
- 参考文档references/themes/monokai.json878 B
- 参考文档references/themes/quiet-light.json883 B
- 参考文档references/themes/red.json874 B
- 参考文档references/themes/solarized-dark.json885 B
- 参考文档references/themes/solarized-light.json887 B
- 参考文档references/themes/tomorrow-night-blue.json890 B
- 参考文档references/themes/vscode-dark.json882 B
- 参考文档references/themes/vscode-light.json884 B
- 脚本scripts/excalidraw_to_mermaid.py7.8 KB
- 脚本scripts/extract.py2.0 KB
- 脚本scripts/render_excalidraw.py16.9 KB
- 其他tests/fixtures/skill-workflow.excalidraw15.5 KB
- 资产文件tests/fixtures/skill-workflow.svg27.8 KB
- 资产文件tests/output/skill-workflow-default.svg27.4 KB
- 资产文件tests/output/skill-workflow-midnight.svg27.4 KB
- 其他tests/output/skill-workflow.excalidraw15.5 KB
- 其他tests/output/skill-workflow.mmd703 B
- 脚本tests/test_render_excalidraw.py12.1 KB
- 脚本tests/test_skill_docs.py2.9 KB
- 脚本tests/test_skill_end_to_end.py3.5 KB
- 脚本tests/test_skill_package.py3.9 KB
03 SKILL.md 正文
Excalidraw Diagram Creator
Generate .excalidraw files that argue visually instead of turning prose into labeled boxes.
Sample trigger phrasings: "draw a diagram of this architecture", "visualize this workflow in Excalidraw", "convert this Mermaid flowchart to Excalidraw", "turn this Excalidraw scene into Mermaid".
Setup
If the renderer is not initialized in this environment, run:
uv run scripts/render_excalidraw.py --install-browser
The Excalidraw browser bundle is vendored locally; the renderer serves it from a local HTTP endpoint during export so Chromium loads the packaged module correctly. Refresh it from the repo root with scripts/refresh.sh for the latest upstream JS state from npm.
Theme Selection
- Read
references/theme-catalog.md. - If the user does not request a theme, use the catalog default theme:
default(dark). - Read the selected theme file from
references/themes/. - Use only colors from that theme. Do not invent hex values.
- Set both of these in the
.excalidrawfile:appState.viewBackgroundColor= theme backgroundappState.excalidrawDiagramTheme= selected theme name
Theme implies mode. Do not use a separate dark-mode switch.
Core Principles
- Diagrams should show relationships, causality, and flow that would be weaker in prose.
- Shape should match meaning. If removing the text destroys the idea, redesign the structure.
- Technical diagrams teach with concrete evidence: real event names, payloads, API calls, or UI states.
- Default to free-floating text. Use containers only when they carry meaning or need bindings.
- Mermaid interoperability is semantic, not literal. Preserve graph meaning; don't blindly mimic Mermaid's layout when Excalidraw teaches it better.
- For a quick structural Mermaid derivation from an existing
.excalidrawscene, useuv run scripts/excalidraw_to_mermaid.py path/to/file.excalidrawas a starting point, then refine.
Decide The Depth
Use a simple conceptual diagram when:
- Explaining a mental model
- Giving a fast overview
- The audience does not need implementation details
Use a comprehensive technical diagram when:
- Explaining a real system, protocol, or architecture
- The audience needs to learn how parts actually connect
- The diagram should stand on its own as a teaching artifact
For technical diagrams, research the real spec first and include evidence artifacts.
Workflow
1. Understand The System
- Identify the key transformation, decision points, and outputs.
- For technical topics, look up the real data shape, event names, methods, or API surface.
- Decide what the viewer must see, not just what they must read.
- If input or output is Mermaid, read
references/mermaid-interoperability.mdand choose the Mermaid form that best matches the diagram semantics.
2. Pick A Theme And A Visual Plan
- Choose the theme before generating any colors.
- Choose a different visual pattern for each major concept.
- Prefer lines, clusters, timelines, trees, fan-outs, or comparisons over uniform card grids.
- Use
references/design-patterns.mdfor the pattern library.
3. Plan Multi-Zoom Structure
For comprehensive diagrams, include:
- A summary flow
- Section boundaries
- Detail inside each section
This keeps the diagram readable from afar and useful up close.
4. Build Large Diagrams Section By Section
For larger diagrams:
- Create the file wrapper and first section.
- Add one section per edit.
- Use descriptive IDs.
- Keep section spacing balanced.
- Update cross-section bindings when arrows connect across sections.
Do not generate a large technical diagram in one pass.
5. Generate The JSON
Required document shape:
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [],
"appState": {
"viewBackgroundColor": "#ffffff",
"gridSize": 20,
"excalidrawDiagramTheme": "default"
},
"files": {}
}
Rules:
textandoriginalTextcontain only readable text.- Use
fontFamily: 3. - Prefer
roughness: 0andopacity: 100. - Every real relationship gets an arrow or structural line.
- In a container, keep bound text under about 70-75% of container width and 60-65% of container height.
- For boxed labels, aim for at least 24px horizontal and 14px vertical padding.
- If a boxed label is too tight, shorten the wording first, then add a line break, then widen the container. Reduce font size only as a last resort.
- Pull element shapes and field structure from
references/element-templates.mdandreferences/json-schema.md.
6. Render And Iterate
Render after generating or editing the diagram:
uv run scripts/render_excalidraw.py path/to/file.excalidraw
To render with a non-default theme:
uv run scripts/render_excalidraw.py path/to/file.excalidraw --theme midnight
Then inspect the exported image and fix:
- clipping
- overlap
- ambiguous labels
- boxed labels that feel edge-to-edge
- weak hierarchy
- awkward whitespace
- bad arrow routing
- unreadable evidence artifacts
The renderer emits layout warnings before export when bound text is likely too tight inside a container. Treat warnings as fix-me items, not ignorable noise.
Use references/render-checklist.md for the full loop.
Common Mistakes
- Using generic placeholders for technical systems instead of real formats or event names
- Putting every label inside a box
- Using the same visual structure for every concept
- Skipping theme selection and inventing colors ad hoc
- Forgetting
appState.excalidrawDiagramTheme - Treating render as a final export instead of an iterative design check
Required References
Load each file at the workflow step that calls for it:
references/theme-catalog.md: theme selection and authoring — load before generating any colorsreferences/themes/catalog.json: available themesreferences/design-patterns.md: visual pattern library — load when planning the visual structurereferences/mermaid-interoperability.md: Mermaid to/from Excalidraw prompting workflow — load when the input or output is Mermaidreferences/element-templates.md: Excalidraw element scaffolds — load when generating JSONreferences/json-schema.md: JSON shape notes — load when generating JSONreferences/render-checklist.md: render-view-fix loop — load when iterating on the export
Scripts
scripts/render_excalidraw.py: render a.excalidrawfile to an image; run after every generation or edit (--install-browseron first use)scripts/excalidraw_to_mermaid.py: deterministic structural Mermaid export from an existing scene; run when deriving Mermaid from Excalidraw
04 同仓库更多 Skills
user-run
Use when a step needs privileges this session lacks (docker, sudo, another user's checkout or secrets, host access) and the owner must run it as tze. Writes a reviewable /home/orca/.tmp/<slug>/run.sh that impersonates tze (USER_TO_IMPERSONATE overrides), tees timestamped logs plus latest.log and collects artifacts there; Claude presents it with a risk and time brief, then continues from the logs. Triggers: "I'll run it for you", "permission denied on docker.sock", "needs sudo", "sudo: a password is required", "run as tze", "/user-run".
requesting-code-review
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
receiving-code-review
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
finishing-a-development-branch
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
executing-plans
Use when you have a written implementation plan to execute in a separate session with review checkpoints
dispatching-parallel-agents
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies