Agent skill

Mermaid Diagrams

by magnus919 in magnus919/agent-skills

Author, render, troubleshoot, and review Mermaid diagrams for documentation, architecture, processes, and technical communication.

MITAuto-check passedDevelopment

Install Mermaid Diagrams

skills CLI
$ npx skills add magnus919/agent-skills --skill mermaid-diagrams -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install magnus919/agent-skills mermaid-diagrams --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/magnus919/agent-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/mermaid-diagrams .claude/skills/mermaid-diagrams && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mermaid-diagrams
GitHub stars
115
Token cost
~2.6k tokens
SKILL.md length
1,049 words
Files
13 (incl. scripts, references)
Skills in repo
131
Repo updated
First seen
Licence
MIT

At a glance

Author, render, troubleshoot, and review Mermaid diagrams for documentation, architecture, processes, and technical communication.

  • Works in 6 steps: Create the diagram as a standalone .mmd… → Pre-render to SVG: npx… → Choose one embedding method: use raw… → …
  • A versionable diagram must communicate a defined audience job across a real renderer
  • SKILL.md covers When to Use, PDF Output — Pre-render Required, Communication Review and Supported Diagram Types, plus 7 more sections
  • Runs Shell scripts from its folder; calls npx and docker; reaches cdn.jsdelivr.net

What it does

Mermaid Diagrams is an agent skill from magnus919/agent-skills. Author, render, troubleshoot, and review Mermaid diagrams for documentation, architecture, processes, and technical communication. Use when a versionable diagram must communicate a defined audience job across a real renderer, including narrative, hierarchy, labels, legends, accessibility fallback, and uncertainty. Do not use for C4 level/model ownership, architecture decisions, or full accessibility conformance.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 15 other files, including scripts and reference files (for example `README.md`, `evals/evals.json` and `references/c4-mermaid.md`). Compatibility notes: Mermaid rendering requires a compatible renderer. The optional CLI examples use Mermaid CLI and its documented Node.js runtime.

It sits in Development, covering Diagrams and Accessibility. It works with Mermaid. The repository describes itself as: Curated collection of AI agent skills for Hermes and other agent frameworks. The licence is MIT.

When your agent uses it

  • A versionable diagram must communicate a defined audience job across a real renderer
  • Including narrative
  • Accessibility fallback
  • C4 level/model ownership

Example prompts

  • “/mermaid-diagrams”

Requirements

  • Python 3
  • Node.js
  • A Bash shell
  • Docker
  • Compatibility (from SKILL.md): Mermaid rendering requires a compatible renderer. The optional CLI examples use Mermaid CLI and its documented Node.js runtime.

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Create the diagram as a standalone .mmd file
  2. Pre-render to SVG: npx @mermaid-js/mermaid-cli@11.16.0 -i diagram.mmd -o diagram.svg --width 800
  3. Choose one embedding method: use raw inline SVG by default, or base64 data URIs when the renderer corrupts raw SVG.
  4. Strip hardcoded max-width pixel values from the SVG tags
  5. Use flowchart TD (portrait) not flowchart LR (landscape) — see references/portrait-layout.md
  6. Add page-break divs before/after each full-page diagram

What it can do on your machine

Read from SKILL.md and the folder at commit 22b4723. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • npx
    • docker

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • cdn.jsdelivr.net

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Mermaid rendering requires a compatible renderer. The optional CLI examples use Mermaid CLI and its documented Node.js runtime.

    From compatibility in the SKILL.md frontmatter.

Context cost

Mermaid Diagrams loads about 2.6k tokens when it runs, and up to ~9k if it reads all its reference files. Until then it costs about 108 tokens; SKILL.md has 1,049 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~108
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from magnus919/agent-skills at commit 22b4723, republished under its MIT licence (© magnus919). 1,049 words, ~2,554 tokens.

Download SKILL.mdSave it as .claude/skills/mermaid-diagrams/SKILL.md (or your agent's skills folder). This skill also uses 12 other files; get the full folder from GitHub.
name
mermaid-diagrams
description
Author, render, troubleshoot, and review Mermaid diagrams for documentation, architecture, processes, and technical communication. Use when a versionable diagram must communicate a defined audience job across a real renderer, including narrative, hierarchy, labels, legends, accessibility fallback, and uncertainty. Do not use for C4 level/model ownership, architecture decisions, or full accessibility conformance.
compatibility
Mermaid rendering requires a compatible renderer. The optional CLI examples use Mermaid CLI and its documented Node.js runtime.
license
MIT
metadata.source_repo
https://github.com/magnus919/hermes-profiles
metadata.source_commit
867a555

Mermaid Diagrams

Portable Mermaid.js diagramming for architectural documentation. Not tied to any blog platform, theme, or rendering engine. Diagrams can be rendered via CLI, embedded in markdown, or served as HTML snippets.

When to Use

Load this skill when:

  • Rendering C4 flowchart approximations after the C4 level and model have been chosen; use c4-diagramming for C4 modeling decisions
  • Producing sequence diagrams for interaction flows
  • Designing flowcharts for process documentation
  • Building state/class/ER diagrams for specification
  • Generating any diagram that needs to render in both agent-facing and human-facing contexts
  • Reviewing whether a structurally valid Mermaid diagram is the right communication artifact for its audience and output surface

Do NOT load when:

  • A plain text outline communicates the relationship more clearly than a diagram.
  • The target renderer cannot execute Mermaid and no pre-rendering path is available.

PDF Output — Pre-render Required

Mermaid code blocks (mermaid) do NOT render in the Pandoc → HTML → Puppeteer PDF pipeline. The pipeline generates static HTML with no JavaScript execution.

For any diagram destined for PDF output:

  1. Create the diagram as a standalone .mmd file
  2. Pre-render to SVG: npx @mermaid-js/mermaid-cli@11.16.0 -i diagram.mmd -o diagram.svg --width 800
  3. Choose one embedding method: use raw inline SVG by default, or base64 data URIs when the renderer corrupts raw SVG.
  4. Strip hardcoded max-width pixel values from the SVG tags
  5. Use flowchart TD (portrait) not flowchart LR (landscape) — see references/portrait-layout.md
  6. Add page-break divs before/after each full-page diagram

Do NOT leave ```mermaid code blocks in markdown that will go through Pandoc. They render as raw monospace text.

See references/pdf-rendering-pipeline.md for the full pipeline with Puppeteer setup, SVG styling fixes, and QA checklist.

Communication Review

Before authoring, state the audience, reader job, target surface, and intended read order. Choose the smallest diagram type and scope that supports that job. Keep abstraction, node shapes, edge semantics, labels, boundary treatment, and visual hierarchy consistent. Syntax validation and a successful render are necessary but not sufficient: a diagram can be valid Mermaid and still be the wrong communication artifact because it is too dense, hides the primary path, mixes representational conventions, or leaves the reader to infer uncertainty.

Load references/diagram-communication.md when creating, revising, or reviewing a diagram for people rather than only testing grammar. Use its review record for narrative, signal-to-noise, labels and legends, color-independent meaning, accessibility fallback, uncertainty, and rendered review evidence. C4 level/model ownership stays with c4-diagramming; architecture decisions stay with software-architecture; full accessibility conformance stays with web-accessibility.

Supported Diagram Types

TypeUse CaseFile
FlowchartProcess flows, C4 workarounds, decision treesreferences/flowchart.md
SequenceInteraction protocols and API callsreferences/sequence.md
C4 renderingFlowchart approximation of a C4 view already chosen with c4-diagrammingreferences/c4-mermaid.md
Portrait LayoutPDF/print-oriented diagramming — TD over LR, page breaks, full-page diagramsreferences/portrait-layout.md
PDF Rendering PipelineFull pipeline from .mmd → SVG → HTML → PDF, with QA checklistreferences/pdf-rendering-pipeline.md
mmdc Spacing ConfigConfig for controlling diagram density and preventing label overlapreferences/mmdc-spacing-config.md

C4 Model Guidance

Mermaid has experimental native C4 syntax (C4Context, C4Container, C4Component) but it is unsupported on GitHub and most markdown renderers. GitHub's built-in mermaid renderer does not bundle the C4 plugin — C4-syntax blocks render as raw code rather than diagrams. Use one of these approaches instead:

  1. Flowchart workarounds (GitHub-compatible) — Convert C4 diagrams to standard flowchart syntax using subgraphs for boundaries, styled node boxes for Person/System/Container/Db, and labelled edges for Rel. See references/c4-to-flowchart.md for the full conversion pattern.
  2. Structurizr DSL — use for real C4 diagrams. Render via Structurizr CLI or export to Mermaid SVG. Best for formal architecture documentation that doesn't live in GitHub markdown.
  3. Hybrid approach — maintain a full C4 model in Structurizr DSL and include a flowchart-based approximation in Markdown for inline readability.
Show full SKILL.md (441 more words)Show less
C4 → Flowchart Conversion Pattern
C4 ElementFlowchart EquivalentExample
Person()[label] (standard rect)U[Human User]
System()[label] with styleGP[GroktoPlan] with style GP fill:#...
System_Ext()[label] outside subgraphGIT[Git Providers]
Container()[label with tech stack]KG[Knowledge Graph<br/>Python + pgvector]
Db()[(label)] (cylinder shape)LS[(Live State DB)]
System_Boundary{}subgraph System["Title"] ... endNested subgraphs
Container_Boundary{}subgraph Service["Title"] ... endSingle subgraph
Rel()-- label --> or -.->AR -- gRPC --> GA
UpdateLayoutConfig()Omit — use flowchart LR or TBDirection set in header

See references/c4-to-flowchart.md for worked examples of all three C4 levels.

GitHub Compatibility Reference
Diagram TypeGitHub Renders?Notes
flowchart (TD/LR/BT/RL)✅Use for all C4 workarounds
sequenceDiagram✅
classDiagram✅
stateDiagram-v2✅
erDiagram✅
gantt✅
pie✅
quadrantChart✅
requirementDiagram✅
gitgraph✅
mindmap✅
timeline✅
zenuml✅
sankey✅
xychart✅
block✅
packet✅
C4Context❌Requires C4 plugin — renders as raw code
C4Container❌Requires C4 plugin — renders as raw code
C4Component❌Requires C4 plugin — renders as raw code
C4Deployment❌Requires C4 plugin — renders as raw code
C4Dynamic❌Requires C4 plugin — renders as raw code

Rendering

CLI (mmdc) — for PDF/SVG/PNG output
bash
npx @mermaid-js/mermaid-cli@11.16.0 -i diagram.mmd -o diagram.svg
npx @mermaid-js/mermaid-cli@11.16.0 -i diagram.mmd -o diagram.png
npx @mermaid-js/mermaid-cli@11.16.0 -i diagram.mmd -o diagram.pdf

Requires Puppeteer + Chromium (~1.7GB). Use the Docker image for isolated rendering:

bash
docker run --rm -v $(pwd):/data ghcr.io/mermaid-js/mermaid-cli mermaid-cli -i /data/diagram.mmd -o /data/diagram.svg
CDN (HTML) — for inline web rendering
html
<script src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
<div class="mermaid">
flowchart LR
  A-->B
</div>
Validation
javascript
// Node.js validation
import { parse } from 'mermaid';
try {
  parse('flowchart LR\n  A-->B');
  console.log('Valid');
} catch (e) {
  console.error('Invalid:', e.message);
}

Scripts

ScriptPurpose
scripts/validate-mermaid.shValidate a .mmd file with Mermaid CLI

Theming

Mermaid uses a base theme with customizable theme variables. Set them with an init directive at the top of the diagram. Consult the Mermaid documentation for the complete version-specific variable set.

Key theme variables:

  • primaryColor, primaryTextColor, primaryBorderColor
  • secondaryColor, tertiaryColor
  • lineColor, fontFamily, fontSize
  • background (outer background), mainBkg (element background)

Anti-Patterns

Anti-patternFix
Lowercase end in flowchartAll Mermaid keywords are case-sensitive. End is not end.
o or x after dashes without space-->o needs space: --o or use explicit node shapes
Quotes inside parentheses("quoted text") not ('quoted text')
Very wide diagrams (>100 nodes)Split into sub-diagrams or use ELK layout
Mixed tabs and spacesUse spaces only. 2-space indent for subgraphs.
Long labels without line breaksUse <br/> or pipe `
Embedding SVGs as data URIsUse raw <svg> tags instead — data URIs can't have their max-width overridden by CSS
Leaving Mermaid code blocks in markdown for PDFPre-render to SVG first. Pandoc renders ```mermaid as raw text.

Portability

This skill is intentionally host-neutral. Use your agent's normal mechanisms to load the references, templates, and scripts listed here. Do not assume a particular profile system, task orchestrator, memory service, or response-handoff format.

When not to use

  • Use c4-diagramming when the task is to choose or maintain C4 system-context, container, component, or code-level models.
  • Use software-architecture for architecture drivers, tradeoffs, decisions, and fitness evidence rather than diagram syntax or rendering.
  • Use web-accessibility for complete WCAG/ARIA conformance and assistive-technology evaluation; this skill supplies diagram-specific checks and fallbacks only.

© magnus919, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 12 other files (scripts, references) in mermaid-diagrams of magnus919/agent-skills.

  • SKILL.md
  • README.md
  • evals/evals.json
  • references/c4-mermaid.md
  • references/c4-to-flowchart.md
  • references/diagram-communication.md
  • references/flowchart.md
  • references/mmdc-spacing-config.md
  • references/pdf-rendering-pipeline.md
  • references/portrait-layout.md
  • references/sequence.md
  • references/source-index.md
  • scripts/validate-mermaid.sh

Open the folder on GitHubat commit 22b4723

Compare with similar skills

Mermaid Diagrams next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mermaid Diagrams compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mermaid Diagrams this skillmagnus919/agent-skills115—~2.6kAutomated safety check: PassMIT
Archify Diagramstt-a1i/archify82k—~2.9kAutomated safety check: PassMIT
Diagram Designcathrynlavery/diagram-design49k1 repos~7.6kAutomated safety check: PassMIT
Draw.io Diagram StudioAgents365-ai/drawio-skill10k—~2.4kAutomated safety check: NotesMIT
Pretty Mermaid Rendererimxv/Pretty-mermaid-skills1.5k—~2kAutomated safety check: PassMIT
Archify Diagram BuilderUnclecheng-li/AI_Animation1.5k2 repos~4.1kAutomated safety check: PassMIT

Similar skills

  • Archify Diagrams

    tt-a1i/archify

    Creates interactive architecture, workflow, sequence, data-flow and lifecycle diagrams as standalone HTML with inline SVG, themes and image or video export.

    82k GitHub stars~2.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Diagram Design

    cathrynlavery/diagram-design

    Creates branded diagrams, from architecture, flowchart and sequence to charts and maps, as self-contained HTML with inline SVG, with import from draw.io, Mermaid and Excalidraw.

    49k GitHub starsUsed in 1 repo~7.6k tokens
    DevelopmentAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check: notes
  • Pretty Mermaid Renderer

    imxv/Pretty-mermaid-skills

    Writes and renders Mermaid diagrams as themed SVG, PNG or terminal ASCII and Unicode art with a bundled Node.js CLI that needs no browser.

    1.5k GitHub stars~2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Archify Diagram Builder

    Unclecheng-li/AI_Animation

    Builds validated architecture, workflow, sequence, data-flow and lifecycle diagrams as standalone interactive HTML from a small JSON spec, with optional motion and image export.

    1.5k GitHub starsUsed in 2 repos~4.1k tokens
    DevelopmentAuto-check passed
  • Mermaid

    WH-2099/mermaid-skill

    Generate Mermaid diagrams from user requirements. An agent skill from WH-2099/mermaid-skill.

    288 GitHub starsUsed in 4 repos~958 tokens
    DevelopmentAuto-check passed

More from magnus919/agent-skills

All 131 skills in this repo
  • Artifact Pyramids

    magnus919/agent-skills

    Organize durable agent research outputs as summaries, analysis, and evidence dossiers.

    119 GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Ascii City Engine

    magnus919/agent-skills

    Build portable, first-person colored ASCII city engines and small GIS-derived city packs.

    119 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Color Management

    magnus919/agent-skills

    Manage color workflows with ICC profiles, working spaces, gamut mapping, and color science.

    119 GitHub stars~2.6k tokensUpdated today
    Auto-check: notes
  • Data Scientist

    magnus919/agent-skills

    A skill your agent uses for PhD-level expertise in data science, statistics, and machine learning: rigorous statistical analysis, experimental design, causal inference, advanced modeling, research…

    119 GitHub stars~4.1k tokensUpdated today
    Auto-check passed
  • Docker Compose

    magnus919/agent-skills

    Use Docker Compose to define, run, debug, and harden multi-container applications.

    119 GitHub stars~2k tokensUpdated today
    Auto-check: notes
  • Fpga Development

    magnus919/agent-skills

    Design, review, simulate, and verify FPGA logic using explicit RTL contracts, clock and reset models, CDC analysis, timing constraints, and reproducible implementation evidence.

    119 GitHub stars~2.7k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Mermaid Diagrams

What does Mermaid Diagrams do?

Author, render, troubleshoot, and review Mermaid diagrams for documentation, architecture, processes, and technical communication. Mermaid Diagrams is an agent skill from magnus919/agent-skills. Author, render, troubleshoot, and review Mermaid diagrams for documentation, architecture, processes, and technical communication.

When should I use Mermaid Diagrams?

Mermaid Diagrams fits situations like: A versionable diagram must communicate a defined audience job across a real renderer; including narrative; accessibility fallback; C4 level/model ownership.

How do I install Mermaid Diagrams in Claude Code?

Run `npx skills add magnus919/agent-skills --skill mermaid-diagrams -a claude-code`. Or copy the skill folder (mermaid-diagrams in magnus919/agent-skills) into .claude/skills/mermaid-diagrams in your project. Claude Code loads it when a task matches its description.

How do I install Mermaid Diagrams in Codex?

Run `npx skills add magnus919/agent-skills --skill mermaid-diagrams -a codex`. Or copy the skill folder (mermaid-diagrams in magnus919/agent-skills) into .agents/skills/mermaid-diagrams in your project. Codex loads it when a task matches its description.

Can I use Mermaid Diagrams in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add magnus919/agent-skills --skill mermaid-diagrams -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mermaid-diagrams, .gemini/skills/mermaid-diagrams, .github/skills/mermaid-diagrams and .opencode/skills/mermaid-diagrams in your project.

What does Mermaid Diagrams need to run?

Going by SKILL.md and its folder, Mermaid Diagrams needs a shell for the scripts in its folder and the command-line tools its instructions call (npx and docker). Our summary lists: Python 3; Node.js; A Bash shell; Docker. Compatibility (from SKILL.md): Mermaid rendering requires a compatible renderer. The optional CLI examples use Mermaid CLI and its documented Node.js runtime..

Does Mermaid Diagrams access the network?

SKILL.md names 1 domain. In commands or code: cdn.jsdelivr.net; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Mermaid Diagrams safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Mermaid Diagrams use?

Mermaid Diagrams is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mermaid Diagrams use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 6.4k tokens, read only when the agent opens those files.

What are the alternatives to Mermaid Diagrams?

Skills that share tags, products or a category with Mermaid Diagrams: Archify Diagrams (tt-a1i/archify, 82k stars), Diagram Design (cathrynlavery/diagram-design, 49k stars), Draw.io Diagram Studio (Agents365-ai/drawio-skill, 10k stars) and Pretty Mermaid Renderer (imxv/Pretty-mermaid-skills, 1.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mermaid Diagrams?

magnus919 (a GitHub user) maintains it in magnus919/agent-skills, which has 115 GitHub stars. The repository holds 131 skills in this directory. The repository was last updated on October 10, 2026.

Source: magnus919/agent-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.