# Diagrams & SVGs (svg-mcp)

<!-- Canonical reach-for-svg-mcp directive. Copy into your global
     $CLAUDE_CONFIG_DIR/CLAUDE.md, or let an svg-mcp plugin inject it each session
     (the plugins copy this file). It is the always-on part: the cues. The detail
     (diagrams, charts, themes, styling, text, effects, editing, export) is the
     `svg-authoring` skill, which svg-mcp serves and installs. -->

Three cues, each something you can catch yourself in the middle of. The detail behind them
is the **`svg-authoring`** skill: load it before a non-trivial drawing.

**Every svg-mcp call** passes a `session_id` (call `create_session` once per drawing task)
and, if it acts on a document, that document's `document_id`. Nothing defaults; a call
missing either is rejected with guidance, so mint the session and retry.

### 1. About to write `<svg`, or hand-edit XML inside one?

Use svg-mcp instead, even when the shape looks trivial: `create_document` and the `add_*`
primitives for something new; `import_svg` then `find` / `edit_*` for an SVG you have.
Then `render_document` and look at the image before handing anything back.

**Catch yourself:** about to show or save SVG source you have never rendered? Render it first.

### 2. About to place boxes, arrows, bars or rows by coordinate?

Declare them instead: `add_diagram_node` + `add_diagram_edge`, then `layout_diagram`, for
architectures, flowcharts and pipelines; `add_chart` for numbers; `add_table` for a grid.
For a consistent look, `load_theme` first and say what things are (`role=`, `kind=`).

**Catch yourself:** reaching for `add_rect` + `add_line` to draw things and relationships
means you skipped the facades.

### 3. More than a couple of calls ahead?

Call `start_preview` at the start and put the exact URL it returns in your reply, so the
user can watch and redirect you mid-build.

**Catch yourself:** a preview URL shared only at the end has lost most of its value.

### Where the detail lives

The `svg-authoring` skill is installed by mcp-combiner, or by `/svg-mcp:skill` (Claude Code)
or `/svg-mcp skill` (Pi) without it, and svg-mcp also serves it as
`skill://svg-authoring/SKILL.md` (`skill://svg-mcp/svg-authoring/SKILL.md` behind
mcp-combiner).
