my-mermaid
Diagram work is image-heavy — rendering and reading PNGs back — which would flood this
conversation's context. So the render-and-verify loop runs in my-mermaid-agent, in its own
context. You stay here for one upstream job the agent can't do: choose the diagram type that
fits the source. Do that, then spawn the agent.
Pick the diagram type
Skip this only when the caller already named the type.
Reason from the source first, not from a list — that is what keeps the choice objective:
Name the shape of the information. What is the source actually — a sequence of
interactions, a hierarchy, magnitudes flowing between nodes, items placed on two axes, a state
machine, entities and their keys, events over time? Decide the shape before you look at any
menu, so the data drives the type, not the menu.
Map the shape to a type. These common shapes have an obvious type — use it directly when
the source plainly is one of them:
flowchart — steps, branches, decisions
sequenceDiagram — interactions/messages over time
stateDiagram-v2 — modes and transitions
classDiagram — types and their relationships
erDiagram — data model: entities and keys
gantt / timeline — schedule over dates / events in order
journey — a user's steps and how each feels
quadrantChart — items placed on two axes
pie — parts of a whole
mindmap — a branching hierarchy from one root
This list is the common shorthand, not the catalog. The catalog is every type Mermaid
registers today — many specialized ones (Sankey for flow magnitudes, a Wardley map, Cynefin,
radar, treemap, packet, …) are not above.
Before committing, ask: is there a more specialized type than the obvious one? Whenever the
shape is anything past a plain flowchart/sequence — or you are unsure a fitting type exists —
read the live catalog and scan all of it for a better fit instead of settling for the nearest
shorthand item:
https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/diagram-api/diagram-orchestration.ts
lists the registered type ids; for what a less-familiar one is for, read its page at
https://mermaid.js.org/syntax/<id>.html. If a fetch fails, fall back to the shorthand plus
your own knowledge — don't stall.
Commit. One clearly-best fit → use it. Two or more that genuinely fit and would change the
message → present them, one-line why each, and let the user pick; if no one is there to answer
(an unattended run), choose the best fit and note the alternatives in your handoff.
Fixing an existing block? Read its current type first and keep it unless the source clearly
calls for a different one — if you do change it, say so and why before spawning.
Spawn the agent
my-mermaid-agent owns the render mechanics, authoring rules, and the truncation detect-and-fix
ladder — don't re-derive them. Resolve its inputs (ask only for what's genuinely missing; never
spawn without a DELIVERABLE path — it has nowhere to write otherwise), then spawn foreground:
Agent({
subagent_type: "my-mermaid-agent",
description: "diagram <subject>",
prompt: `
TYPE: <the type you picked, e.g. sequenceDiagram>
TARGET: <new | fix block N in path/to/file.md>
GROUND TRUTH: <repo code at paths, or the prose spec>
DELIVERABLE: <path/to/file.md>
`
})
Then relay its result — the final diagram, the truth mapping, the fixes it applied, and any
open questions. If it returns an open truth gap, get the user's answer and re-spawn with it.
If my-mermaid-agent isn't installed, say so — don't run the loop inline (its render images are
exactly what this skill exists to keep out of the caller's context).
1---2name: my-mermaid3description: Author or fix a Mermaid diagram with an autonomous render-and-verify loop. First it picks the diagram type that fits the source — it names the shape of the information and chooses from the live Mermaid catalog instead of defaulting to a flowchart — then delegates the drawing to my-mermaid-agent, which drafts render-safe Mermaid, renders headlessly to a PNG (the engine native VSCode uses), reads the image back to fix clipped or overlapping labels, and gates on a two-axis acceptance (truth vs the source, human readability) before returning. Use when creating or improving a Mermaid diagram, deciding which diagram type best fits, or when a diagram has cut-off text or is hard to read.4allowed-tools: Agent, WebFetch5added_in: 0.32.06metadata:7 source: https://skillmd.com/skills/superliaye/my-mermaid8---910# my-mermaid1112Diagram work is image-heavy — rendering and *reading PNGs back* — which would flood this13conversation's context. So the render-and-verify loop runs in `my-mermaid-agent`, in its own14context. You stay here for one upstream job the agent can't do: **choose the diagram type that15fits the source.** Do that, then spawn the agent.1617## Pick the diagram type1819Skip this only when the caller already named the type.2021Reason from the **source first, not from a list** — that is what keeps the choice objective:22231. **Name the shape of the information.** What is the source actually — a sequence of24 interactions, a hierarchy, magnitudes flowing between nodes, items placed on two axes, a state25 machine, entities and their keys, events over time? Decide the shape before you look at any26 menu, so the data drives the type, not the menu.272. **Map the shape to a type.** These common shapes have an obvious type — use it directly when28 the source plainly is one of them:29 - `flowchart` — steps, branches, decisions30 - `sequenceDiagram` — interactions/messages over time31 - `stateDiagram-v2` — modes and transitions32 - `classDiagram` — types and their relationships33 - `erDiagram` — data model: entities and keys34 - `gantt` / `timeline` — schedule over dates / events in order35 - `journey` — a user's steps and how each feels36 - `quadrantChart` — items placed on two axes37 - `pie` — parts of a whole38 - `mindmap` — a branching hierarchy from one root3940 This list is the **common shorthand, not the catalog.** The catalog is every type Mermaid41 registers today — many specialized ones (Sankey for flow magnitudes, a Wardley map, Cynefin,42 radar, treemap, packet, …) are not above.433. **Before committing, ask: is there a more specialized type than the obvious one?** Whenever the44 shape is anything past a plain flowchart/sequence — or you are unsure a fitting type exists —45 read the live catalog and scan all of it for a better fit instead of settling for the nearest46 shorthand item:47 `https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/diagram-api/diagram-orchestration.ts`48 lists the registered type ids; for what a less-familiar one is for, read its page at49 `https://mermaid.js.org/syntax/<id>.html`. If a fetch fails, fall back to the shorthand plus50 your own knowledge — don't stall.514. **Commit.** One clearly-best fit → use it. Two or more that genuinely fit and would change the52 message → present them, one-line why each, and let the user pick; if no one is there to answer53 (an unattended run), choose the best fit and note the alternatives in your handoff.5455**Fixing an existing block?** Read its current type first and keep it unless the source clearly56calls for a different one — if you do change it, say so and why before spawning.5758## Spawn the agent5960`my-mermaid-agent` owns the render mechanics, authoring rules, and the truncation detect-and-fix61ladder — don't re-derive them. Resolve its inputs (ask only for what's genuinely missing; **never62spawn without a DELIVERABLE path** — it has nowhere to write otherwise), then spawn foreground:6364```65Agent({66 subagent_type: "my-mermaid-agent",67 description: "diagram <subject>",68 prompt: `69 TYPE: <the type you picked, e.g. sequenceDiagram>70 TARGET: <new | fix block N in path/to/file.md>71 GROUND TRUTH: <repo code at paths, or the prose spec>72 DELIVERABLE: <path/to/file.md>73 `74})75```7677Then **relay its result** — the final diagram, the truth mapping, the fixes it applied, and any78open questions. If it returns an open truth gap, get the user's answer and re-spawn with it.7980If `my-mermaid-agent` isn't installed, say so — don't run the loop inline (its render images are81exactly what this skill exists to keep out of the caller's context).