Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问许可证需确认审计提醒

excalidraw-skillExcalidraw 技能

Agent Skill

excalidraw-skill 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

238

周安装

10

GitHub Stars

35

下载量

83
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:excalidraw-skill(Excalidraw 技能)
来源仓库:https://github.com/lingzhi227/claude-skills
仓库路径:skills/excalidraw-skill
安装命令:
npx skills add https://github.com/lingzhi227/claude-skills --skill excalidraw-skill
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/lingzhi227/claude-skills --skill excalidraw-skill

简介

excalidraw-skill 支持通过 MCP Server、REST API 或直接引导安装方式创建 Excalidraw 元素。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中需要动态添加图形、连线或文本框时使用。
  • 优先检测 MCP 工具可用性,其次尝试本地 REST 服务,最后提供安装指引。
  • 若无法连接服务,将指导用户安装 Excalidraw Canva 桌面应用以继续操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Excalidraw Skill

Step 0: Detect Connection Mode

Before doing anything, determine which mode is available. Run these checks in order:

Check 1: MCP Server (Best experience)

mcp-cli tools | grep excalidraw

If you see tools like excalidraw/batch_create_elementsuse MCP mode. Call MCP tools directly.

Check 2: REST API (Fallback — works without MCP server)

curl -s http://localhost:3000/health

If you get {"status":"ok"}use REST API mode. Use HTTP endpoints (curl / fetch) from the cheatsheet.

Check 3: Nothing works → Guide user to install

If neither works, tell the user:

The Excalidraw canvas server is not running. To set up: 1. Clone: git clone https://github.com/yctimlin/mcp_excalidraw && cd mcp_excalidraw 2. Build: npm ci && npm run build 3. Start canvas: HOST=0.0.0.0 PORT=3000 npm run canvas 4. Open http://localhost:3000 in a browser 5. (Recommended) Install the MCP server for the best experience: claude mcp add excalidraw -s user -e EXPRESS_SERVER_URL=http://localhost:3000 -- node /path/to/mcp_excalidraw/dist/index.js

MCP vs REST API Quick Reference

OperationMCP ToolREST API Equivalent
Create elementsbatch_create_elementsPOST /api/elements/batch with {"elements": [...]}
Get all elementsquery_elementsGET /api/elements
Get one elementget_elementGET /api/elements/:id
Update elementupdate_elementPUT /api/elements/:id
Delete elementdelete_elementDELETE /api/elements/:id
Clear canvasclear_canvasDELETE /api/elements/clear
Describe scenedescribe_sceneGET /api/elements (parse manually)
Export sceneexport_sceneGET /api/elements (save to file)
Import sceneimport_scenePOST /api/elements/sync with {"elements": [...]}
Snapshotsnapshot_scenePOST /api/snapshots with {"name": "..."}
Restore snapshotrestore_snapshotGET /api/snapshots/:name then POST /api/elements/sync
Screenshotget_canvas_screenshotOnly via MCP (needs browser)
Design guideread_diagram_guideNot available — see cheatsheet for guidelines
Viewportset_viewportPOST /api/viewport (needs browser)
Export imageexport_to_imagePOST /api/export/image (needs browser)
Export URLexport_to_excalidraw_urlOnly via MCP

REST API Gotchas (Critical — read before using REST API)

  1. Labels: Use "label": {"text": "My Label"} (not "text": "My Label"). MCP tools auto-convert, REST API does not.
  2. Arrow binding: Use "start": {"id": "svc-a"}, "end": {"id": "svc-b"} (not "startElementId"/"endElementId"). MCP tools accept startElementId and convert, REST API requires the start/end object format directly.
  3. fontFamily: Must be a string (e.g. "1") or omit it entirely. Do NOT pass a number like 1.
  4. Updating labels: When updating a shape via PUT /api/elements/:id, include the full label in the update body to preserve it. Omitting label from the update won't delete it, but re-sending ensures it renders correctly.
  5. Screenshot in REST mode: POST /api/export/image returns {"data": "<base64>"}. Save to file and read it back for visual verification. Requires browser open.

Quality Gate (MANDATORY — read before creating any diagram)

After EVERY iteration (each batch of elements added), you MUST run a quality check before proceeding. NEVER say "looks great" unless ALL checks pass.

Quality Checklist — verify ALL before adding more elements:

  1. Text truncation: Is ALL text fully visible? Labels must fit inside their shapes. If text is cut off or wrapping badly → increase width and/or height.
  2. Overlap: Do ANY elements overlap each other? Check that no rectangles, ellipses, or text elements share the same space. Background zones must fully contain their children with padding.
  3. Arrow crossing: Do arrows cross through unrelated elements or overlap with text labels? If yes → use curved/elbowed arrows with waypoints to route around obstacles (see "Arrow Routing" section). Never accept crossing arrows.
  4. Arrow-text overlap: Do any arrow labels ("charge", "event", etc.) overlap with shapes? Arrow labels are positioned at the midpoint — if they overlap, either remove the label, shorten it, or adjust the arrow path.
  5. Spacing: Is there at least 40px gap between elements? Cramped layouts are unreadable.
  6. Readability: Can all labels be read at normal zoom? Font size >= 16 for body text, >= 20 for titles.

If ANY issue is found:

  • STOP adding new elements
  • Fix the issue first (resize, reposition, delete and recreate)
  • Re-verify with a new screenshot
  • Only proceed to next iteration after ALL checks pass

Sizing Rules (prevent truncation):

  • Shape width: max(160, labelTextLength * 9) pixels. For multi-word labels like "API Gateway (Kong)", count all characters.
  • Shape height: 60px for single line, 80px for 2 lines, 100px for 3 lines.
  • Background zones: Add 50px padding on ALL sides around contained elements.
  • Element spacing: 60px vertical between tiers, 40px horizontal between siblings.
  • Side panels: Place at least 80px away from main diagram elements.
  • Arrow labels: Keep labels short (1-2 words). Long arrow labels overlap with other elements.

Layout Planning (prevent overlap):

Before creating elements, plan your coordinate grid on paper first:

  • Tier 1 (y=50-130): Client apps
  • Tier 2 (y=200-280): Gateway/Edge
  • Tier 3 (y=350-440): Services (spread wide: each service ~180px apart)
  • Tier 4 (y=510-590): Data stores
  • Side panels: x < 0 (left) or x > mainDiagramRight + 80 (right)

Do NOT place side panels (observability, external APIs) at the same x-range as the main diagram — they WILL overlap.

Quick Start

  1. Run Step 0 above to detect your connection mode.
  2. Open the canvas URL in a browser (required for image export/screenshot).
  3. MCP mode: Use MCP tools for all operations. REST mode: Use HTTP endpoints from cheatsheet.
  4. For full tool/endpoint reference, read references/cheatsheet.md.

Workflow: Draw A Diagram

MCP Mode

  1. Call read_diagram_guide first to load design best practices.
  2. Plan your coordinate grid (see Quality Gate → Layout Planning) before writing any JSON.
  3. Optional: clear_canvas to start fresh.
  4. Use batch_create_elements with shapes AND arrows in one call.
  5. Assign custom id to shapes (e.g. "id": "auth-svc"). Set text field to label shapes.
  6. Size shapes for their text — use width: max(160, textLength * 9).
  7. Bind arrows using startElementId / endElementId — arrows auto-route.
  8. set_viewport with scrollToContent: true to auto-fit the diagram.
  9. Run Quality Checklistget_canvas_screenshot and critically evaluate. Fix issues before proceeding.

REST API Mode

  1. Read references/cheatsheet.md for design guidelines.
  2. Plan your coordinate grid (see Quality Gate → Layout Planning) before writing any JSON.
  3. Optional: curl -X DELETE http://localhost:3000/api/elements/clear
  4. Create elements in one call (use @file.json for large payloads): curl -X POST http://localhost:3000/api/elements/batch \ -H "Content-Type: application/json" \ -d '{"elements": [{"id": "svc-a", "type": "rectangle", "x": 0, "y": 0, "width": 160, "height": 60, "label": {"text": "Service A"}}, {"id": "svc-b", "type": "rectangle", "x": 0, "y": 200, "width": 160, "height": 60, "label": {"text": "Service B"}}, {"type": "arrow", "x": 0, "y": 0, "start": {"id": "svc-a"}, "end": {"id": "svc-b"}}]}'
  5. Use "label": {"text": "..."} for shape labels (not "text": "...").
  6. Bind arrows with "start": {"id": "..."} / "end": {"id": "..."} — server auto-routes edges.
  7. Size shapes for their text — use width: max(160, labelTextLength * 9).
  8. Run Quality Checklist — take screenshot, critically evaluate. Fix issues before adding more elements.

Arrow Binding (Recommended)

Bind arrows to shapes for auto-routed edges. The format differs between MCP and REST API:

MCP Mode — use startElementId / endElementId:

{"elements": [
  {"id": "svc-a", "type": "rectangle", "x": 0, "y": 0, "width": 120, "height": 60, "text": "Service A"},
  {"id": "svc-b", "type": "rectangle", "x": 0, "y": 200, "width": 120, "height": 60, "text": "Service B"},
  {"type": "arrow", "x": 0, "y": 0, "startElementId": "svc-a", "endElementId": "svc-b", "text": "calls"}
]}

REST API Mode — use start: {id} / end: {id} and label: {text}:

{"elements": [
  {"id": "svc-a", "type": "rectangle", "x": 0, "y": 0, "width": 120, "height": 60, "label": {"text": "Service A"}},
  {"id": "svc-b", "type": "rectangle", "x": 0, "y": 200, "width": 120, "height": 60, "label": {"text": "Service B"}},
  {"type": "arrow", "x": 0, "y": 0, "start": {"id": "svc-a"}, "end": {"id": "svc-b"}, "label": {"text": "calls"}}
]}

Arrows without binding use manual x, y, points coordinates.

Arrow Routing — Avoid Overlaps (Critical for complex diagrams)

Straight arrows (2-point) cause crossing and overlap in complex diagrams. Use curved or elbowed arrows instead:

Option 1: Curved arrows — add intermediate waypoints + roundness:

{
  "type": "arrow", "x": 100, "y": 100,
  "points": [[0, 0], [50, -40], [200, 0]],
  "roundness": {"type": 2},
  "strokeColor": "#1971c2"
}

The waypoint [50, -40] pushes the arrow upward to arc over elements. roundness: {type: 2} makes it a smooth curve.

Option 2: Elbowed arrows — right-angle routing (L-shaped or Z-shaped):

{
  "type": "arrow", "x": 100, "y": 100,
  "points": [[0, 0], [0, -50], [200, -50], [200, 0]],
  "elbowed": true,
  "strokeColor": "#1971c2"
}

When to use which:

  • Fan-out arrows (one source → many targets): Use curved arrows with waypoints spread vertically to avoid overlapping each other.
  • Cross-lane arrows (connecting to side panels): Use elbowed arrows that route around the main diagram — go UP first, then ACROSS, then DOWN.
  • Inter-service arrows (horizontal connections): Use curved arrows with a slight vertical offset to avoid crossing through adjacent elements.

Rule of thumb: If an arrow would cross through an unrelated element, add a waypoint to route around it. Never accept crossing arrows — always fix them.

Workflow: Iterative Refinement (Key Differentiator)

The feedback loop that makes this skill unique. Each iteration MUST include a quality check.

MCP Mode (full feedback loop)

  1. Add elements (batch_create_elements, create_element).
  2. set_viewport with scrollToContent: true.
  3. get_canvas_screenshotcritically evaluate against the Quality Checklist.
  4. If issues found → fix them (update_element, delete_element, resize, reposition).
  5. get_canvas_screenshot again — re-verify fix.
  6. Only proceed to next iteration when ALL quality checks pass.

REST API Mode (partial feedback loop)

  1. Add elements via POST /api/elements/batch.
  2. POST /api/viewport with {"scrollToContent": true}.
  3. Take screenshot: POST /api/export/image → save PNG → critically evaluate against Quality Checklist.
  4. If issues found → fix via PUT /api/elements/:id or delete and recreate.
  5. Re-screenshot and re-verify.
  6. Only proceed to next iteration when ALL quality checks pass.

How to critically evaluate a screenshot:

  • Look at EVERY label — is any text cut off or overflowing its container?
  • Look at EVERY arrow — does any arrow pass through an unrelated element?
  • Look at ALL element pairs — do any overlap or touch?
  • Look at spacing — is anything crammed together?
  • Be honest. If you see ANY issue, say "I see [issue], fixing it" — not "looks great".

Example flow (MCP):

batch_create_elements → get_canvas_screenshot → "text truncated on 2 shapes"
→ update_element (increase widths) → get_canvas_screenshot → "overlap between X and Y"
→ update_element (reposition) → get_canvas_screenshot → "all checks pass"
→ proceed to next iteration

Workflow: Refine An Existing Diagram

  1. describe_scene to understand current state.
  2. Identify targets by id, type, or label text (not x/y coordinates).
  3. update_element to move/resize/recolor, delete_element to remove.
  4. get_canvas_screenshot to verify changes visually.
  5. If updates fail: check element id exists (get_element), element isn't locked (unlock_elements).

Workflow: File I/O (Diagrams-as-Code)

  • Export to.excalidraw format: export_scene with optional filePath.
  • Import from.excalidraw: import_scene with mode: "replace" or "merge".
  • Export to image: export_to_image with format: "png" or "svg" (requires browser open).
  • CLI export: node scripts/export-elements.cjs --out diagram.elements.json
  • CLI import: node scripts/import-elements.cjs --in diagram.elements.json --mode batch|sync

Workflow: Snapshots (Save/Restore Canvas State)

  1. snapshot_scene with a name before risky changes.
  2. Make changes, describe_scene / get_canvas_screenshot to evaluate.
  3. restore_snapshot to rollback if needed.

Workflow: Duplication

  • duplicate_elements with elementIds and optional offsetX/offsetY (default 20,20).
  • Useful for creating repeated patterns or copying existing layouts.

Points Format for Arrows/Lines

The points field accepts both formats:

  • Tuple: [[0, 0], [100, 50]]
  • Object: [{"x": 0, "y": 0}, {"x": 100, "y": 50}]

Both are normalized to tuples automatically.

Workflow: Share Diagram (excalidraw.com URL)

  1. Create your diagram using any of the above workflows.
  2. export_to_excalidraw_url — uploads encrypted scene, returns a shareable URL.
  3. Share the URL — anyone can open it in excalidraw.com to view and edit.

Workflow: Viewport Control

  • set_viewport with scrollToContent: true — auto-fit all elements (zoom-to-fit).
  • set_viewport with scrollToElementId: "my-element" — center view on a specific element.
  • set_viewport with zoom: 1.5, offsetX: 100, offsetY: 200 — manual camera control.

References

  • references/cheatsheet.md: Complete MCP tool list (26 tools) + REST API endpoints + payload shapes.

Related Skills

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.87%
按下载量换算31

Claude

28.96%
按下载量换算24

Cursor

19.53%
按下载量换算16

Gemini CLI

9.99%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills