agentleFS
fabioc-alohafabioc-aloha/Alex_ACT_Edition/.github/skills/markdown-mermaid/SKILL.md

markdown-mermaid

Skill0 starsChanged 4 months agoMITView on GitHub

Author markdown and Mermaid diagrams that render correctly in VS Code, GitHub, and other Mermaid 10+ consumers — covers diagram-tool selection, mandatory init template, parser pitfalls, and visual design rules. Use when writing technical docs with embedded diagrams, debugging Mermaid render failures, or choosing between Mermaid, Excalidraw, and other diagramming tools.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every Mermaid diagram MUST follow this 6-step protocol: No exceptions — this prevents forgotten palettes, broken layouts, and inconsistent …

    line 61
  2. Distinctive:

    Before writing any Mermaid code, answer these:

    line 74
  3. Distinctive:

    After creating the diagram, verify ALL of these:

    line 86
  4. Distinctive:

    When creating diagrams in Copilot Chat (not markdown files), use the native tool for:

    line 122
  5. Very specific:

    Documentation authoring: Use markdown code blocks for .md files

    line 142
  6. Very specific:

    Design in chat: Use renderMermaidDiagram for rapid iteration

    line 148
  7. Distinctive:

    Mermaid Config: Run the "Polish Mermaid Setup" prompt to configure Mermaid rendering for your VS Code environment.

    line 163
  8. Distinctive:

    When performing comprehensive diagram audits across a project or documentation set, follow this 4-step process:

    line 222
  9. Distinctive:

    Create an inventory table to track diagram state:

    line 243
  10. Very specific:

    Rule: If your labels contain colons, times (HH:MM), or complex text, use flowchart and structure with subgraphs instead.

    line 338
  11. Distinctive:

    Debug silent failures: Check browser console, simplify content, test incrementally, try flowchart — if it works in flowchart, the mode is …

    line 340

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Markdown & Mermaid

A skill for markdown authoring, Mermaid diagramming, multi-tool visualization, VS Code integration, and cross-platform rendering consistency.

When to Use

  • Creating technical documentation with diagrams
  • Choosing the right diagramming tool for your audience
  • Troubleshooting Mermaid rendering issues
  • Styling markdown previews in VS Code
  • Converting unicode escapes to proper emojis
  • Enterprise documentation with visual standards
  • Interactive diagrams in VS Code chat (1.109+)

⚠️ MANDATORY: Start Every Diagram With This Template

Do NOT write Mermaid code without this template. Copy-paste first, then customize:

%%{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 required components:

  1. Init directive (line 1) — Sets theme, colors, white edge label background
  2. classDef — Semantic colors for all node types
  3. linkStyle default — Gray arrows at 1.5px width
Color ClassUse ForExample
:::blueInput, source, startA[Audio]:::blue
:::greenOutput, result, dataC[Transcript]:::green
:::purpleProcessing, modelB[WhisperX]:::purple
:::goldDecision, conditionD{Valid?}:::gold
:::redError, warningE[Failed]:::red
:::neutralContext, optionalF[Cache]:::neutral

Mandatory Workflow: ATACCU

Every Mermaid diagram MUST follow this 6-step protocol. No exceptions — this prevents forgotten palettes, broken layouts, and inconsistent styling.

StepActionWhat to Do
AAnalyzeWhat data/process am I visualizing? Who is the audience? What diagram type fits?
TThinkWhich layout pattern? (Medallion/Lineage/Pipeline) How many nodes? Will it be too wide/tall?
AApplyCOPY THE TEMPLATE ABOVE — init directive + classDef + linkStyle. No exceptions.
CCreateWrite the Mermaid code. Every node gets :::className. Every flowchart gets linkStyle default.
CCheckRender the diagram. Verify: pastels (not saturated), layout (not lopsided), labels (readable), arrows (gray #57606a).
UUpdateWrite the final diagram into the target .md file. Add **Figure N:** *description* label.

Pre-Flight Checklist (Steps A-T-A)

Before writing any Mermaid code, answer these:

□ Diagram type selected (flowchart/sequence/gantt/quadrant/etc.)
□ Layout direction chosen (LR preferred for flow, TD for hierarchy)
□ Subgraph strategy decided (Medallion vs Lineage vs Pipeline)
□ Color assignments mapped (what color = what meaning)
□ Multi-line node labels use <br/> NOT \n

Quality Gate (Steps C-C-U)

After creating the diagram, verify ALL of these:

□ Init directive is FIRST line inside mermaid block
□ edgeLabelBackground is '#ffffff' (white background for edge labels)
□ ALL nodes have style/classDef (no unstyled nodes)
□ Colors are GitHub Pastel v2 (NOT saturated: no #51cf66, #339af0, #fab005)
□ linkStyle default stroke:#57606a,stroke-width:1.5px (flowcharts)
□ Node labels use <br/> for line breaks, NOT \n
□ Diagram rendered and visually inspected
□ No dimension > 3x the other (use subgroups to balance)
□ Figure label added below diagram block
□ Written to target file (not just shown in chat)

Common Violations This Prevents

ViolationATACCU Step That Catches It
Saturated colors instead of pastelsApply Skills — load palette first
Missing init directiveApply Skills — it's step 3
edgeLabelBackground: 'transparent' usedApply Skills — use '#ffffff' (white background)
\n in node labels (renders as literal text)Create — use <br/> for line breaks
Missing linkStyleCreate — every flowchart needs it
Lopsided layout (7-way fan-out)Think — choose layout pattern
Diagram only in chat, not in fileUpdate — write to .md file
No figure labelUpdate — add label

VS Code 1.109+ Native Chat Rendering

VS Code 1.109 introduces native Mermaid rendering in chat via the renderMermaidDiagram tool. This is a deferred tool: call tool_search for "mermaid" to load it before invocation.

When to Use Native Rendering

When creating diagrams in Copilot Chat (not markdown files), use the native tool for:

  • Interactive exploration: Pan, zoom, and full-screen viewing
  • Immediate feedback: See diagrams without switching to markdown preview
  • Iterative refinement: Quick edits with instant re-render
  • Copy source: Extract the Mermaid code for documentation

Usage Pattern

User: Create a sequence diagram showing OAuth flow

Alex: [uses renderMermaidDiagram tool]
       → Interactive diagram appears in chat
       → User can pan/zoom/fullscreen
       → "Copy source" extracts code for docs

When NOT to Use

  • Documentation authoring: Use markdown code blocks for .md files
  • GitHub rendering: Embed Mermaid in markdown for native GitHub support
  • Presentations: Export to image formats or use D2

Combined Workflow

  1. Design in chat: Use renderMermaidDiagram for rapid iteration
  2. Finalize: Copy the Mermaid source code
  3. Document: Paste into markdown file with ```mermaid code fence

Assets

FilePurpose
markdown-light.cssVS Code preview styling
polish-mermaid-setup.prompt.mdInteractive Mermaid configuration helper

Setup: Copy CSS to .vscode/, add "markdown.styles": [".vscode/markdown-light.css"] to settings.

Mermaid Config: Run the "Polish Mermaid Setup" prompt to configure Mermaid rendering for your VS Code environment.


🎯 Diagram Tool Selection Framework

Step 1: Identify Your Communication Goal

What You're ShowingBest ToolsExample Use Cases
Process/WorkflowMermaid Flowcharts, User JourneyOnboarding, approvals, troubleshooting
System ArchitectureMermaid Flowcharts with subgraphs, D2Microservices, API design
RelationshipsMermaid ER, Mindmaps, GraphvizDatabase schemas, org charts
Time/SequenceMermaid Sequence, GanttAPI interactions, timelines
Data/MetricsMermaid XY Charts, Sankey, QuadrantPerformance, resource allocation

Step 2: Consider Your Audience

AudiencePrimary GoalRecommended ToolsStyle
ExecutivesStrategic overviewD2, simple flowchartsClean, minimal
ArchitectsTechnical accuracyPlantUML, Mermaid C4Detailed, precise
DevelopersImplementationMermaid Sequence, ClassCode-focused
Product ManagersUser flowsUser Journey, FlowchartsBusiness-outcome
DocumentationLearningAll Mermaid typesProgressive disclosure

Step 3: Consider Platform

PlatformBest ToolsWhy
GitHub/GitLabMermaidNative rendering, no setup
Confluence/WikiMermaid, PlantUMLPlugin support
VS CodeAll tools (extensions)Live preview
PresentationsD2, simple MermaidExecutive-friendly

Quick Decision Tree

Need diagram? → What are you showing?
├── Process/Workflow → Mermaid Flowchart
├── System Architecture → Mermaid with subgraphs (or D2 for exec)
├── Relationships → Mermaid ER/Mindmap (or Graphviz for complex)
├── Time/Sequence → Mermaid Sequence/Gantt
└── Data/Metrics → Mermaid XY/Sankey/Quadrant

Companion References

Bulk content moved out of SKILL.md to stay under the 500-line skill-spec ceiling. Load these on demand when the section header below indicates relevance:

  • markdown-best-practices.md — document structure template, figure/table conventions, Shields.io badges, emoji usage
  • tool-ecosystem.md — Mermaid / D2 / PlantUML / Excalidraw comparison, VS Code extension setup, syntax examples
  • diagram-reference.md — diagram types, node shapes, edge styles, color palettes (legacy + GitHub Pastel v2 + Fishbowl), per-diagram theming, classDef, subgraph styling, Gantt + sequence theming, visual design principles
  • pitfalls.md — parser pitfalls P1–P9, unicode/emoji failures, layout patterns, classDiagram + architecture-beta gotchas, reserved-word handling, cross-diagram compatibility matrix

🔍 Diagram Audit Methodology

When performing comprehensive diagram audits across a project or documentation set, follow this 4-step process:

Step 1: Enumerate

Identify all Mermaid diagrams in the target scope:

# bash/zsh
grep -rl '```mermaid' --include='*.md' | while read f; do echo "$f: $(grep -c '```mermaid' "$f")"; done
# PowerShell
Get-ChildItem -Recurse -Filter "*.md" |
  Select-String -Pattern '```mermaid' |
  Group-Object Path |
  Select-Object Name, Count

Step 2: Categorize

Create an inventory table to track diagram state:

#FileDiagram TypeStatusIssues
1README.mdflowchart⚠️Missing init
2arch.mdsequence✅None
3flow.mdflowchart❌Parse error

Status codes: ✅ OK, ⚠️ Needs fix, ❌ Broken

Step 3: Batch Fix

Apply fixes in batches by issue type:

  1. Reserved word errors — Rephrase or quote labels
  2. Parse errors — Apply 4 safety rules
  3. Style inconsistencies — Apply GitHub Pastel v2 palette

Step 4: Validate

Re-render all diagrams and confirm fixes:

  • All diagrams render in VS Code preview
  • All diagrams render on GitHub
  • Color palette is consistent
  • No parse errors in console

Typical results: A 30-40 diagram audit catches 10-15 issues in the first pass.


✅ Quality Checklist

Before Committing

  • All diagrams have figure labels
  • All tables have table labels
  • No unicode escape sequences
  • Diagrams render correctly in preview AND GitHub
  • Consistent heading hierarchy
  • Links are valid

Diagram Review

  • Node labels are clear and concise (but not over-simplified)
  • Colors follow consistent palette
  • Subgraphs logically group related items
  • Subgraph content is wide enough for title (VS Code)

Don't Over-Simplify

KISS ≠ Remove all detail

KISS means removing unnecessary complexity while preserving meaningful information. If removing detail reduces understanding, keep it.


📚 External References

Official Documentation

VS Code Resources

Visual Design Theory

  • Tufte, E.R. - The Visual Display of Quantitative Information
  • Cairo, A. - The Functional Art
  • Knaflic, C.N. - Storytelling with Data

Mode Fragility Reference

Several Mermaid modes fail silently on colons and special characters. Default to flowchart for arbitrary text content.

ModeStatusConstraint
flowchartSafeNone — handles any content
sequenceDiagramSafeStandard message format
classDiagramSafeStandard notation
erDiagramSafeStandard notation
stateDiagramCautionColons in state names
journeyCautionScore format sensitive
timelineFragileNo colons in events; : is separator
gitGraphFragileLong chains with quoted colon-tags break
ganttFragiledateFormat HH:mm mis-parses task lines

Rule: If your labels contain colons, times (HH:MM), or complex text, use flowchart and structure with subgraphs instead.

Debug silent failures: Check browser console, simplify content, test incrementally, try flowchart — if it works in flowchart, the mode is the problem.

Falsifiability

  • This skill is wrong if diagrams authored per these patterns fail to render in GitHub or VS Code preview
  • The syntax guidance is stale if it conflicts with the current Mermaid.js spec (check mermaid.js.org/changelog)
  • The mode-fragility warnings are not earning tokens if Mermaid resolves the documented rendering bugs in a future release

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.