mgifford/accessibility-skills/mermaid
Claude Code and agent skill by mgifford/accessibility-skills
- community
Checking that the SKILL.md file is still in the repository.
Load this skill whenever the project uses Mermaid diagrams — flowcharts, sequence diagrams, class diagrams, Gantt charts, or any Mermaid-rendered visualization. Under no circumstances render a Mermaid diagram without an accessible title, description, and text-based alternative. Absolutely always add accTitle: and accDescr: (no %% prefix — that is the comment syntax and will be silently ignored) to every diagram.
Install
npx vskill@latest install mgifford/accessibility-skills/mermaidSKILL.md
Mermaid Diagrams Accessibility Skill
Canonical source:examples/MERMAID_ACCESSIBILITY_BEST_PRACTICES.mdinmgifford/ACCESSIBILITY.mdThis skill is derived from that file. When in doubt, the example is authoritative.
Apply these rules when authoring, generating, or reviewing Mermaid diagrams. Only load this skill if the project uses Mermaid diagrams.
Core Mandate
Accessible Mermaid content depends on four layers: (1) the diagram source and its accessibility metadata, (2) the exact Mermaid renderer and configuration, (3) the generated SVG/raster output, and (4) how the publishing platform embeds and exposes that output. A generated Mermaid diagram is non-text content unless the rendered nodes/relationships are proven to have useful semantics — test the final published output, not just the source or an editor preview.
Before authoring, decide whether a diagram is even needed — a heading, short list, table, or few sentences may communicate the information more clearly. Mermaid is useful when relationships, sequence, branching, hierarchy, timing, or spatial grouping materially improve understanding.
Severity Scale (this skill)
| Level | Meaning | |
|---|---|---|
| Critical | Diagram conveys essential information with no accessible title or alternative; metadata written with the wrong syntax so it's silently ignored | |
| Serious | Title present but no description on a complex diagram; contrast fails | |
| Moderate | No visible structured alternative for a complex diagram type; named edges lack context | |
| Minor | Duplicate IDs; missing renderer-version verification |
Critical: Use the Correct accTitle/accDescr Syntax — No %% Prefix
`%%` is the Mermaid comment prefix. Lines written as %%accTitle … or %%accDescr … are comments and are silently ignored — this produces no accessibility metadata at all while looking like it works.
Correct syntax uses accTitle: and accDescr: directly, with no comment prefix:
Single-line description uses a colon:
For a multi-line description, omit the colon after accDescr and use braces:
Mermaid does not define a universal 100-character title limit or 500- character description limit — write the shortest title that distinguishes the diagram on the page, and keep the description concise enough to be useful as an image description (move detailed steps into visible structured HTML instead of stuffing them into accDescr).
Do not invent directives like %%a11y-node or %%a11y-edge — these are not standard Mermaid syntax; they're comments unless a project-specific preprocessor implements them, and should never be documented as Mermaid features.
Parse and render the source with the project's exact Mermaid version to catch syntax-support and diagram-type differences — accTitle/accDescr support varies by version and diagram type.
Writing Useful Titles and Descriptions
Title: identifies the subject, distinguishes it from others on the page, includes the diagram type only when it helps, avoids filenames/internal IDs/ generic labels ("Diagram"). Examples: "Account recovery decision flow", "Payment service request sequence", "Order states and permitted transitions".
Description: states the purpose, starting context, main elements/ participants, essential sequence/hierarchy/relationships, important decisions/exceptions/outcomes, and where a complete alternative is available. Do not merely list colors and shapes ("A blue rectangle points to a green diamond" describes appearance, not meaning) and do not flatten every node label into one long sentence — that's hard to navigate and loses structure.
Also provide a visible title/description — a page heading or figure caption helps everyone, not just AT users:
(The > escaping is only needed when Mermaid source is embedded directly in HTML — Markdown Mermaid fences don't need it.)
Serious: Provide a Visible Structured Alternative for Complex Diagrams
accDescr creates an SVG description, not a navigable document structure. Complex diagrams need visible HTML with headings, lists, tables, and links.
| Mermaid diagram type | Useful structured alternative | |
|---|---|---|
| Flowchart / decision tree | Ordered steps + nested lists or a decision table (conditions → outcomes) | |
| Sequence diagram | Participant list + chronological message table | |
| State diagram | State definitions + transition table (trigger, source, destination, outcome) | |
| Class diagram | Class definitions, properties, methods, inheritance, relationship table | |
| Entity relationship | Entity definitions, keys, attributes, cardinality, relationship table | |
| Gantt / timeline | Task/event table with dates, duration, owner, status, dependencies | |
| Pie/XY/quadrant/radar/Sankey | Summary of findings + underlying data table with units | |
| Mind map / tree | Properly nested heading or list hierarchy | |
| Architecture/C4/block | Component inventory, responsibilities, boundaries, relationship table | |
| Git graph | Chronological branch/merge/release history | |
| User journey | Ordered stages, goals, actions, emotions, barriers, opportunities |
Keep alternatives synchronized — generate the diagram and its alternative from the same reviewed data model when possible; if maintained separately, require both in the same change, compare nodes/values/edges, and assign an owner for content review. Do not expose raw Mermaid source as the only alternative — it may help developers but is not an equivalent explanation for all users.
Serious: Understand Mermaid's Generated SVG (Do Not Hand-Author a Different Pattern)
Current Mermaid documentation states the renderer automatically adds aria-roledescription based on diagram type, and when accTitle/accDescr are provided, generates <title>/<desc> elements with aria-labelledby referencing the title and `aria-describedby` referencing the description — separately, not both combined into one aria-labelledby:
Do not rewrite both as one `aria-labelledby` value without a tested reason — a label identifies the image; a description provides additional information; they're distinct relationships. Exact IDs/classes/attributes can change by Mermaid version — don't copy generated IDs into source or depend on undocumented internal class names.
Node-by-node semantics are not automatic. accTitle/accDescr describe the diagram as a whole — they do not make every node/edge/arrow a useful accessible object. Do not automatically add `role="list"`/`role="listitem"` to generated SVG groups — a visual layout is not necessarily a list, DOM order may not match reading order, and list semantics can't express branching, cardinality, or graph relationships. If users need to inspect individual items, build and test a purpose-specific interactive component — generated SVG internals are a fragile foundation for a complex widget.
IDs need to be unique in the final HTML document (not across unrelated pages). Let Mermaid manage its generated IDs; check for duplicates when several inline diagrams share a page; use deterministicIds config for stable snapshot testing; preserve every referenced ID through sanitization/export.
Serious: Embedding and Export Modes Change the Rules
| Mode | Responsibility | |
|---|---|---|
| Inline SVG generated in the page | Preserve generated title/description/ARIA references, language, styles, unique IDs | |
External SVG via <img> | Give the HTML alt — do not assume the SVG's internal title/desc are exposed | |
| Raster PNG/JPEG | HTML alt + long structured alternative in HTML | |
<object>/iframe | Useful accessible name on the embedding element; test entry/exit; external HTML alternative | |
| CSS background image | Decoration only, or provide the info in ordinary HTML | |
| PDF/office-document export | Document tags, alt text, reading order — SVG metadata is not a substitute | |
| Markdown platform renderer | Test the platform's exact Mermaid version, sanitizer, theme, and output |
Do not leave HTML alt empty just because the source SVG contains <title>/<desc>.
Choosing Clear Diagram Content
Nodes/participants: human-readable labels, not internal IDs; expand uncommon abbreviations; keep labels concise but meaningful; give visually similar nodes distinct textual labels; don't use shape alone to distinguish a decision/process/database/external system.
Edges/relationships: label branches when the outcome isn't otherwise clear — "Approved"/"Needs revision" over generic "Yes"/"No"; preserve direction and source→destination meaning in the alternative; explain unlabeled relationships depending on line style or position; don't use connector color alone to encode status or relationship type.
Reading order/layout: choose a direction matching content and document language; reduce line crossings; avoid layouts implying relationships through proximity alone. Visual placement is not a programmatic reading order — state the intended sequence/hierarchy in the description and structured alternative.
Moderate: Color and Contrast
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/mermaid/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mgifford/accessibility-skills/mermaid)