/tools:diagramfrom tools
Draw, edit, and review diagrams using Mermaid for version-controlled flowcharts, sequences, and architecture, and Excalidraw for mind maps, concept maps, and sketches. Covers layout routing, rendering, and visual QA.
Ships in tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Mermaid and Excalidraw diagramming standards, layout routing, and visual invariants.
Identify the chart's core objective (the action or decision it enables) and reader context before drawing.
| Reader question | Layout family | Guidance |
|---|---|---|
| "What do I do next?" | Containment + state | Group by navigation paths; emphasize active items. |
| "How does this work?" | Flow / sequence | Directional arrows; default to Mermaid. |
| "Where does this fit?" | Containment / nesting | Boundary nesting up to ~3 levels deep. |
| "How do these compare?" | Matrix / grid | Uniform grid with comparable cells. |
| "What changed / is off?" | Anomaly / comparison | Highlight outliers without data smoothing. |
| "When does this happen?" | Timeline | Position strictly encodes chronological time. |
| "What is central here?" | Radial / hub | Focal node centered with balanced spokes. |
LR. Use TD only for wide fan-outs. In subgraphs, use direction TB.layout: elk, mergeEdges: true, nodePlacementStrategy: SIMPLE).| Property | Value | Rationale |
|---|---|---|
roughness | 2 | Sketch aesthetic |
fontFamily | 1 (Virgil) | Hand-drawn typeface |
fillStyle | "hachure" | Sketch hatching |
strokeStyle | "solid" | Consistent hand-drawn stroke |
| Background | White (#ffffff) | High contrast and printability |
--preset zone).--preset hero).--preset sticky).--curved, --stroke-style dashed).A tree (outline, taxonomy, claim structure, org chart) reads best when containment carries the hierarchy and arrows are rare. Rings, radii, sunbursts and evenly spaced fans read as spiderweb and hide the levels they were meant to show.
(width - 28) / (font * 0.62) characters for Virgil and set widths to the longest line. The CLI render draws bound text unwrapped, so text fit is checked from the stored lines, not from the picture.pkb-excalidraw check plus an own segment-versus-box check: the CLI arrows-check tests chords and reports false positives on routed or curved arrows.pkb-excalidraw is the preferred way to read and edit .excalidraw files; use it before reading or writing the JSON directly, because its mutations refuse to save a file that fails validation. Run pkb-excalidraw --help for the full command set. When creating a PKB note derived from an Excalidraw canvas (via pkb.create), pass the canvas's PKB-relative path as source (e.g. <subproject>/<canvas>.excalidraw), or set parent to a node whose file lives in that directory, so the home-directory placement rule files the note in that sub-project directory.
pkb-excalidraw FILE [summary | map | nodes | edges | style | check | overlap | arrows-check]
pkb-excalidraw FILE add-node --type <type> --text "<text>" [--preset hero|sticky|zone] [--role <role>] [--at X,Y]
pkb-excalidraw FILE connect --from <id1> --to <id2> [--label "<label>"] [--curved] [--stroke-style dashed] [--color <hex>]
pkb-excalidraw FILE [set-text <id> "<text>" | fit <id> "<text>" | move-elem <id> --by DX,DY | delete-elem <id>]
pkb-excalidraw FILE update <id> --set '{"strokeStyle": "dashed"}'
pkb-excalidraw FILE screenshot [--out <path>] [--format svg|png] [--no-background]
containerId/boundElements); arrows bind both ends (startBinding/endBinding).set-text or fit, which update text and originalText together. Change any other property with update <id> --set '<json>'.pkb-excalidraw FILE check and pkb-excalidraw FILE overlap. check does not flag line-wrap-only differences between text and originalText.pkb-excalidraw from mem >= v0.3.101 (carrying mem#691) or newer, which natively trims connect arrow endpoints to shape outlines and mints valid fractional index keys.startBinding and endBinding must be valid objects with elementId matching existing elements, numeric focus (between -1.0 and 1.0), numeric gap, and optional fixedPoint ([x_ratio, y_ratio] normalized between 0.0 and 1.0).boundElements: The source and target elements must each list { "id": arrow_id, "type": "arrow" } in boundElements.points array must start at [0, 0], with width and height matching the points' bounding box envelope.boundElements backreferences that Excalidraw's interactive editor engine rejects.add-node and connect invalid index key defect: pkb-excalidraw add-node and connect mint fractional index keys by appending digit pairs (00, 01) to the previous key (a000, a001, a00100, a00101, a0010100 ...), leaving trailing zeros in the fractional part. While pkb-excalidraw check passes these files (verifying only monotonic ordering), fractional-indexing (validateOrderKey/midpoint) strictly rejects keys with trailing zeros in their fractional part (invalid order key). Excalidraw 0.18.1 validates keys whenever minting a key next to an existing element (e.g. on arrow labelling, duplicate, or z-order adjustments), throwing invalid order key and causing operations to silently fail, leaving edges uneditable.index key against Excalidraw's fractional-indexing schema:
0-9, A-Z, a-z).a-z, integer part length is head.charCodeAt(0) - 97 + 2 (e.g. 'a' is 2 characters: a0--az; 'b' is 3 characters: b00--bzz). For uppercase A-Z, integer part length is 90 - head.charCodeAt(0) + 2 ('Z' is 2 characters, 'A' is 27 characters).index.slice(integerLength)). If the fractional part is non-empty, its final character must NOT be '0'. Reject any key where fractionalPart.endsWith('0') (e.g. a000, a00100, a0010100).Every finished canvas must be rendered to vector SVG or PNG using pkb-excalidraw and pass visual inspection against the rendered image before presentation, handback, or release.
pkb-excalidraw FILE screenshot --out <path>.svg --format svg
# Or if a PNG deliverable is required:
pkb-excalidraw FILE screenshot --out <path>.png --format png
screenshot draws the canvas's stored geometry: shape outlines, arrow points, and bound text as its stored lines. It names Virgil without embedding it and draws fills flat, so text in the image uses Virgil only where Virgil is installed. Judge arrow placement, overlaps, and crossings from the image directly; treat a label that sits close to its container edge as a possible overflow in Excalidraw.pkb-excalidraw check, overlap, and arrows-check cannot catch arrows ending inside boxes. check tests structural references and half-bound arrows, overlap tests only shape AABBs, and arrows-check only checks whether arrow polylines intersect unrelated intermediate boxes (ignoring endpoints at connected shapes). All three checks will pass a canvas whose every arrow ends inside its box. Rendering via pkb-excalidraw FILE screenshot and visually inspecting the resulting image is mandatory to verify that arrowheads terminate outside shapes.pkb-excalidraw is missing or fails to render, halt immediately and report the failure verbatim. Never substitute an ad-hoc or homemade renderer (such as manual SVG construction or custom canvas scripts); alternative renderers produce incorrect typography, drop bindings, and conceal layout defects.--format png is requested without a system rasterizer (resvg, rsvg-convert, magick) on PATH, the tool outputs a notice and saves an SVG fallback to <path>.svg. Use this SVG render for visual QA. If a PNG image is explicitly required by acceptance criteria and no rasterizer exists, halt and surface the missing dependency.When the diagram already exists and the ask changes the plan or state it shows, edit the existing elements in place so the delta is visible on the canvas:
move-elem the existing element.set-text or fit the existing element.strokeColor/backgroundColor on the existing element to the palette role for its new state.delete-elem it, and its bound text and arrows.add-node only for this.Keep the id of every surviving element. pkb excalidraw diff and sync match canvas elements to PKB nodes by id; a replaced element reads as a deletion plus an unrelated addition.
Anti-pattern -- the parallel system. Do not draw a fresh set of elements beside the old ones to depict the new state. It leaves two contradictory versions on one canvas, hides what changed, and severs every id binding. Before adding any element, check whether an existing element already represents that thing; if one does, edit it.
pkb excalidraw export <output_path> [--focus <node_id>] [--hops <H>]
pkb excalidraw diff <canvas_path> [--base <snapshot>] [--json]
pkb excalidraw sync <canvas_path> [--base <snapshot>] [--dry-run]
Reconcile user canvas edits with diff and sync back to markdown frontmatter rather than clobbering.
| Role | Hex | Role | Hex |
|---|---|---|---|
| Emphasis / headers | #c9b458 (gold) | Error / blocked | #ff6666 (soft red) |
| Success / active | #8fbc8f (soft green) | Text / labels | #1a1a1a (primary dark) |
| Active accent | #76c893 (bright green) | De-emphasized text | #888888 (muted) |
| Info / links | #7a9fbf (soft blue) | Borders / arrows | #404040 (charcoal) |
| Warning / queued | #ffa500 (orange) | Completed fills | #252525 (surface) |
#1a1a1a text; 4.5:1 minimum contrast.libraries/banners.excalidrawlib (opens in a new tab)libraries/calendar.excalidrawlib (opens in a new tab)libraries/clouds.excalidrawlib (opens in a new tab)libraries/data-processing.excalidrawlib (opens in a new tab)libraries/flow-chart-symbols.excalidrawlib (opens in a new tab)libraries/mathematical-symbols.excalidrawlib (opens in a new tab)libraries/organization-chart.excalidrawlib (opens in a new tab)libraries/simple-sticky-notes.excalidrawlib (opens in a new tab)libraries/stick-figures-collaboration.excalidrawlib (opens in a new tab)libraries/stick-figures.excalidrawlib (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
10 skills in this plugin
/analystRun academic research data analysis reproducibly -- research data immutability, canonical absolute path resolution, source-derived parity checks, transformation vs presentation layer separation, and defensible statistical methodology. Use for empirical research pipelines, modifying models/marts, data-quality testing, or result documentation. Engine details in dbt, streamlit, and python-viz skills./dbtdbt transformation layer for version-controlled, tested SQL models in staging, intermediate, and mart layers. Use when projects contain a dbt/ directory or require auditable metric and schema transformations./deep-researchAuthor deep-research prompts (Gemini, ChatGPT Pro, Perplexity) and capture outputs into the PKB with figure extraction, local vision transcription, frontmatter, and task wikilinks./new-projectScaffold a research project repository end to end -- repo creation, directory structure, git hygiene, CI/CD, documentation stubs, issue templates, and PKB registration in one pass, with defaults proposed for approval before writing. Use for "new project", "set up a project", "create a repo", "scaffold", "initialize project". Not for existing repos, provisioning credentials, or planning project work (use strategize)./pdfRender markdown files as typeset PDFs via pandoc and weasyprint using academic (A4, justified, headings, callouts, footnotes) or letter stylesheets. Use for reports, grant reviews, or formal letters./peer-reviewPeer review of research funding applications and academic submissions. Scheme-agnostic; fetches round criteria dynamically. Covers Detailed Assessor, General Assessor / College of Experts, and collegial draft review.npx claudepluginhub nicsuzor/aops --plugin tools