markdown-mermaid
Skill0 starsChanged 9 days agoMITView on GitHub
Author Mermaid diagrams that render correctly in GitHub, VS Code, and Mermaid 10+ consumers. Applies a config-driven init directive + linkStyle + semantic classDef vocabulary from `.github/config/brand-palette.json` (default: 6-role semantic palette + typography). Covers renderer pitfalls, mode fragility, and diagram-tool selection. Use when embedding Mermaid in markdown, debugging silent render failures, or choosing between Mermaid / Excalidraw / D2 / PlantUML.
2 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- fabioc-aloha/Alex_ACT_Editionedited, first seen Oct 13, 2026
- fabioc-aloha/alex-cognitive-architecturetheir own version, first seen Apr 26, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- fabioc-aloha/Alex_ACT_Edition★ 013% same
Wrote their own version · 1
- fabioc-aloha/alex-cognitive-architecture★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/bootstrap-project/resources/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- skills/bootstrap-project/resources/CLAUDE.mdCLAUDE.md
- act-tenetsSkill
- adversarial-reviewSkill
- annotate-screenshotSkill
- anti-hallucinationSkill
- ascii-chartSkill
- assess-brainSkill
- big-ideaSkill
- bootstrap-coreSkill
- bootstrap-projectSkill
- browser-toolsSkill
- chart-big-ideaSkill
- chart-interpretationSkill
- chart-vocabularySkill
- code-reviewSkill
- communication-craftSkill
- compile-brainSkill
- convertSkill
- corpus-qa-sweepSkill
- critical-thinkingSkill
- deep-reviewSkill
- doc-hygieneSkill
- docs-shellSkill
- docx-to-mdSkill
- ethical-reasoningSkill
- evaluate-before-adoptingSkill
- figure-generatorSkill
- flint-chartSkill
- flint-interactionsSkill
- flint-themeSkill
- git-workflowSkill
- html-to-mdSkill
- humanizerSkill
- install-visual-companionsSkill
- lint-clean-markdownSkill
- markdown-sanitization-chainSkill
- md-to-emlSkill
- md-to-htmlSkill
- md-to-txtSkill
- md-to-wordSkill
- meditationSkill
- mutation-testingSkill
- planSkill
- platform-awarenessSkill
- print-svg-style-guideSkill
- proactive-awarenessSkill
- problem-framing-auditSkill
- project-capability-authoringSkill
- project-statusSkill
- render-chartSkill
- render-verifySkill
- rich-emailSkill
- risk-analysisSkill
- security-and-hardeningSkill
- setup-dependenciesSkill
- setup-enterprise-stackSkill
- spikeSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Every diagram starts with an init directive derived from .github/config/brand-palette.json.
- Very specific: line 76
Rule: If your labels contain colons, times (HH:MM), or complex text — use flowchart with subgraphs.
- Very specific: line 78
Debug silent failure: check browser console; simplify content.
- Very specific: line 84
Use <br/> for line breaks, NOT \n.
- Very specific: line 98
Prefer TD for sequential flows with several steps or multi-line labels.
- Distinctive: line 100
Keep labels short enough that a node communicates one idea.
- Very specific: line 101
Do not combine width: 100% with a fixed or capped SVG height.
- Distinctive: line 108
Use contained horizontal scrolling only when the graph cannot preserve a 13px desktop or 11px mobile label floor inside the available width.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Markdown & Mermaid
Author Mermaid that renders cleanly on first attempt and doesn't drift from the project's visual identity. LLMs generate correct Mermaid syntax natively; this skill adds the two things they don't have:
- The project's palette + linkStyle + classDef vocabulary (from
.github/config/brand-palette.json, shared with the illustrator plugin's svg-banner + illustrator agent + flint-chart) - Renderer-specific pitfalls (colons breaking timeline/gitGraph/gantt parsers, unicode escapes, reserved-word handling; the footguns native gen trips on)
Unified 2026-07-30: palette values moved from the retired mermaid-init.json into the shared brand-palette.json. One file, all visual layers.
Init directive (always required)
Every diagram starts with an init directive derived from .github/config/brand-palette.json. Values come from the semantic section (classDef fills/strokes/text), the brand.muted value (edge / link color), and the typography.linkStroke / linkStrokeWidth values. Default (Alex ACT 6-role semantic palette):
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#57606a', 'primaryColor': '#ddf4ff', 'primaryBorderColor': '#0969da', 'primaryTextColor': '#1f2328', 'edgeLabelBackground': '#ffffff'}}}%%
flowchart LR
A[Input]:::blue --> B[Process]:::purple --> C[Output]:::green
classDef blue fill:#ddf4ff,color:#0550ae,stroke:#80ccff
classDef green fill:#d3f5db,color:#1a7f37,stroke:#6fdd8b
classDef purple fill:#d8b9ff,color:#6639ba,stroke:#bf8aff
classDef gold fill:#fff8c5,color:#9a6700,stroke:#d4a72c
classDef red fill:#ffebe9,color:#cf222e,stroke:#f5a3a3
classDef neutral fill:#eaeef2,color:#24292f,stroke:#d0d7de
linkStyle default stroke:#57606a,stroke-width:1.5px
```Three components, one source:
%%{init: ...}%%themeVariables derived frombrand-palette.json(edgeLabelBackground = white constant; other theme colors track the palette)classDef <name> fill:... color:... stroke:...for each entry insemantic(blue / green / purple / gold / red / neutral)linkStyle default <spec>fromtypography.linkStroke+linkStrokeWidth
To override the palette for a project, edit .github/config/brand-palette.json (rebrands mermaid + the illustrator plugin's svg-banner + illustrator + flint at once). To use a different palette for one diagram, override the init directive inline (rare; usually you want fleet-wide consistency).
Semantic classDef vocabulary
Apply a semantic class to every node, using :::<class> or a class A,B <class> statement. node scripts/check-mermaid-classes.mjs <file.md> checks conventional flowchart node definitions and edge endpoints; it is a source heuristic, not a Mermaid parser. Review skipped diagram types and unfamiliar syntax separately, and render the result. Semantic roles ship with the default config:
| Class | Role | Example |
:::blue | Input, source, start | A[Audio file]:::blue |
:::green | Output, result, success | C[Transcript]:::green |
:::purple | Processing, model, transformation | B[WhisperX]:::purple |
:::gold | Decision, condition, gate | D{Valid?}:::gold |
:::red | Error, warning, failure | E[Retry]:::red |
:::neutral | Context, optional, out-of-scope | F[Cache]:::neutral |
Consistency across the fleet matters more than clever per-diagram creativity — a reader who has seen one Alex-brand diagram should recognize the second immediately.
Mode fragility (renderer footguns)
Several Mermaid modes fail silently on colons and special characters. Default to flowchart for arbitrary text.
| Mode | Status | Constraint |
flowchart | Safe | None — handles any content |
sequenceDiagram | Safe | Standard message format |
classDiagram | Safe | Standard notation |
erDiagram | Safe | Standard notation |
stateDiagram | Caution | Colons in state names break parsing |
journey | Caution | Score format is sensitive |
timeline | Fragile | Colons in events (: is separator) |
gitGraph | Fragile | Long chains with quoted colon-tags break |
gantt | Fragile | dateFormat HH:mm mis-parses task lines |
Rule: If your labels contain colons, times (HH:MM), or complex text — use flowchart with subgraphs.
Debug silent failure: check browser console; simplify content; test incrementally; try flowchart — if it works there, the mode was the problem.
Full pitfall catalog (P1–P9, unicode/emoji failures, layout patterns, classDiagram + architecture-beta gotchas, reserved-word handling, cross-diagram compatibility matrix) in references/pitfalls.md — 844 lines of renderer-specific gotchas that LLM native generation reliably trips on.
Multi-line labels
Use <br/> for line breaks, NOT \n. \n renders as literal text. This is the single most common defect in LLM-generated Mermaid.
%% Correct
A[Line one<br/>Line two]:::blue
%% Wrong — renders "Line one\nLine two" as one string
A[Line one\nLine two]:::blueSize the graph and its frame together
Author the source so the diagram has a readable natural shape before relying on a renderer:
- Prefer
TDfor sequential flows with several steps or multi-line labels. - Split diagrams whose rendered aspect ratio exceeds 4:1 unless horizontal comparison is the point. Measure the ratio from the rendered SVG's
viewBox(width ÷ height, after the docs-shell crop below), never by eye:node scripts/check-mermaid-classes.mjs --svg <rendered.svg>prints the ratio and fails above 4:1. - Keep labels short enough that a node communicates one idea.
- Do not combine
width: 100%with a fixed or capped SVG height. That creates a page-wide viewport with a small graph centered inside it.
The Alex docs-shell applies one deterministic fit after Mermaid renders:
- Crop once to the root graph bounds plus 16–32px of padding.
- Derive the ideal SVG width from the cropped viewBox and source font size, targeting 16px labels.
- Shrink-wrap compact diagrams instead of stretching every SVG to page width.
- Use contained horizontal scrolling only when the graph cannot preserve a 13px desktop or 11px mobile label floor inside the available width.
Runtime fitting removes wasted viewport space; it does not repair an over-dense source diagram. Refactor the Mermaid source first when the graph still needs scrolling or extreme height after fitting.
Diagram-tool selection
| Showing | Best tool | Why |
| Process, workflow, decision tree | Mermaid flowchart | Native GitHub, wide renderer support |
| System architecture (technical) | Mermaid flowchart + subgraphs | Same |
| System architecture (executive) | D2 (external) | Cleaner, less busy |
| Sequence / API interactions | Mermaid sequenceDiagram | Native |
| Class relationships | Mermaid classDiagram | Native |
| Timeline / roadmap | Mermaid gantt (but see fragility above) | Native but fragile |
| Free-form / whiteboard | Excalidraw (external) | LLM cannot generate; user draws |
| Data / metrics | flint-chart plugin | Real chart rendering, not diagram |
| Brand / hero banner | svg-banner | Not a diagram; different domain |
For Mermaid alternatives (D2, PlantUML, Graphviz, WaveDrom) with syntax examples and VS Code extension setup, see references/tool-ecosystem.md.
VS Code 1.109+ native chat rendering
The renderMermaidDiagram chat tool (deferred; tool_search for "mermaid" to load) renders diagrams interactively in Copilot Chat — pan, zoom, fullscreen, copy source. Use it for iterative design in chat; use fenced code blocks for docs that live in .md files.
References
Bulk content lives in references/ — loaded on demand:
references/pitfalls.md— parser pitfalls P1–P9, unicode/emoji, reserved words, cross-diagram compatibilityreferences/tool-ecosystem.md— Mermaid / D2 / PlantUML / Excalidraw comparison + VS Code setupreferences/diagram-reference.md— diagram types, node shapes, edge styles, per-diagram themingreferences/markdown-best-practices.md— document structure, figure/table conventions, Shields.io
Related
lint-clean-markdown— writing markdown that passesmarkdownlinton the first attempt. Reach for it when the concern is lint compliance rather than diagram rendering.
Falsifiability
Revise if any of the following fires:
- The mode-fragility warnings stop applying because Mermaid.js fixed the underlying parser bugs (check mermaid.js changelog)
- The default palette + built-in fallback (if we add one to a future renderer helper) drift out of sync
- The trim itself was wrong: diagrams start rendering without the palette because the skill body was doing more work than it looked (the always-loaded palette section carried the discipline; the config-pointer doesn't)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

