create-diagram
Create or edit a standalone Mermaid diagram (a .mermaid or .mmd file) inside a prototype. Only while the Diagrams module is on; a diagram that belongs with an explanation is a mermaid fence in a docum
SKILL.mdsrc/modules/diagrams/skills/create-diagram/SKILL.md
GitHubCreate a diagram
The Diagrams README is the contract; read it for how diagrams render, update and embed.
Before you start
- Find the prototype's folder,
src/prototypes/<contributor>/<folder>/. Work only in your own prototypes unless you are an Admin:yarn studio context src/prototypes/<contributor>/<folder> --jsonsays whether you may (canEdit). - Choose the form. A diagram that belongs with an explanation is a
mermaidfence inside a document (see the write-document skill). A diagram that needs its own page in the prototype's navigation, or a preview in documents and canvases, is a standalone file.
Write
A standalone diagram is a
.mermaidfile (.mmdworks too) anywhere in the prototype outside helper folders (names starting with_). Nothing registers it; its file name is its title ("sign-in-flow.mermaid" → "Sign In Flow").Write plain Mermaid: no Markdown fences, one diagram per file. Choose the diagram type that fits the relationship and the audience; any standard Mermaid type works.
Give it an
accTitleand anaccDescr(where the diagram type has them), so screen readers can describe it:flowchart LR accTitle: Sign-in flow accDescr: A returning member signs in, then lands on Home. start[Sign in] --> home[Home]Leave colours and fonts to the studio: diagrams follow its light theme. Set a colour only when it carries meaning, and check its contrast.
To show the diagram in a document, link it with image syntax on its own line:
. Keep the path relative, with its extension, and the file in the same prototype. The preview's header opens the diagram.Excalidraw can import Mermaid into a canvas. That copy is a separate drawing: later edits to the
.mermaidfile don't reach it.
Identity
- Leave the leading
%% @studio-idcomment to the studio. While the dev server runs, a new diagram in your own prototype gets one within a second. Otherwise runyarn studio identify src/prototypes/<contributor>/<folder> --json, then--yes. Never change or copy an existing ID, and keep it the first line when you edit.
Check
- Open the diagram in the studio (
/prototypes/<prototype-id>/artifacts/<diagram-id>). Invalid Mermaid shows "Unable to render Mermaid diagram." with Mermaid's message: fix the source (the file's actions, Edit source, locally) and it draws again by itself. - Look at every document that embeds it, then report the diagram's address and anything you couldn't resolve.