Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
bfdcampos avatar

Mermaid

  • 176 installs
  • Updated June 1, 2026
  • bfdcampos/dotfiles

Mermaid is a skill for creating GitHub-compatible Mermaid diagrams that render readably in both dark and light mode.

About

Mermaid is a skill for creating readable Mermaid diagrams that render correctly on GitHub in both dark and light mode. It gives core styling rules (dark fills with light strokes, transparent subgraph fills, rounded shapes, no Font Awesome icons), a render-check-iterate workflow using mermaid-cli, and a canonical GitHub-compatible template. A developer uses it when documenting a system with diagrams in Markdown.

  • Creates GitHub-ready Mermaid diagrams that work in dark and light mode
  • Dark-fill + light-stroke rule plus a render-check-iterate loop
  • Includes a canonical GitHub-compatible flowchart template

Mermaid by the numbers

  • 176 all-time installs (skills.sh)
  • Ranked #536 of 1,879 Documentation skills by installs in the Skillselion catalog
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

mermaid capabilities & compatibility

Capabilities
diagram authoring · documentation · mermaid
Works with
github
Use cases
documentation
Pricing
Free
From the docs

What mermaid says it does

Guide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
SKILL.md
Writing valid Mermaid is not the goal; producing a diagram a person can actually follow is.
SKILL.md
npx skills add https://github.com/bfdcampos/dotfiles --skill mermaid

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs176
Last updatedJune 1, 2026
Repositorybfdcampos/dotfiles

What it does

Author readable, GitHub-compatible Mermaid diagrams that render correctly in both dark and light mode.

Who is it for?

Producing clean Mermaid diagrams for GitHub Markdown that read well in any color mode.

Skip if: Non-Mermaid diagramming tools or design mockups.

When should I use this skill?

You need to author or fix a Mermaid diagram for GitHub documentation.

By the numbers

  • 7-point core principles list
  • 4-step render-check-iterate loop

Files

SKILL.mdMarkdownGitHub ↗

Mermaid Diagram Skill

This skill provides guidance on creating beautiful, professional Mermaid diagrams that render correctly on GitHub and work well in both light and dark mode.

Core Principles

1. Use dark fills with light strokes — Ensures readability in both light and dark mode 2. Set subgraph fills to `none` — Allows subgraphs to adapt to any background 3. Use rounded shapes([text]) for stadium shapes, ((text)) for circles 4. No Font Awesome icons — GitHub doesn't support fa:fa-* icons, they render as text 5. Quote subgraph labels — Use subgraph Name["Label Text"] syntax 6. Define classDef styles at the top — Keep all styling together for maintainability 7. Render and self-check: auto-layout makes its own routing choices, so always preview the rendered image and iterate until the lines are easy to follow

Render, check, and iterate (do this every time)

Writing valid Mermaid is not the goal; producing a diagram a person can actually follow is. Mermaid's auto-layout (dagre) decides where nodes sit and how edges route, so a diagram that looks fine in source often renders as spaghetti. Always render it, look at it as a reader, and iterate before you ship.

1. Render to an image and open it. Mermaid-cli with a dark background mimics GitHub:

   npx -y @mermaid-js/mermaid-cli -i diagram.mmd -o diagram.png -b "#0d1117"

Put just the Mermaid code in diagram.mmd (the diagram only, no surrounding fence markers). mermaid.live works for a quick paste-and-preview too.

2. Judge it as a reader, not the author:

  • Is the start obvious, and the end?
  • Can you trace every arrow from tail to head without losing it in a crossing?
  • Are related nodes near each other, and does nothing float unconnected?

3. If the lines tangle, fix the layout, not just the colours. Techniques that work:

  • Lay the main flow out as lanes (flowchart LR with direction TB inside each subgraph) so it reads start-to-end in one direction.
  • Cut secondary edges that create a web (test-coverage arrows, every cross-reference). Show the primary flow and put the rest in prose.
  • Keep nodes beside what uses them (data models right after the code that builds them) so the arrows stay short.
  • Anchor a disconnected group with a single link rather than letting it drift to a corner (one "consumed later" edge beats a floating node).
  • Route cross-cutting concerns (errors, logging) to one node with as few edges as possible.

4. Re-render and repeat until it is easy to follow. A diagram you need the legend to trace is not done.

The Golden Rule: Dark Fills + Light Strokes

The key insight for dark/light mode compatibility:

classDef myStyle fill:#DARK_COLOUR,stroke:#LIGHT_COLOUR,stroke-width:2px,color:#fff
  • Fill: Use a darker shade (the node background)
  • Stroke: Use a lighter shade of the same colour family (the border)
  • Color: Always #fff (white text on dark background)

This approach ensures nodes are readable regardless of the page background.

GitHub-Compatible Template

This is the canonical template for GitHub-rendered Mermaid diagrams:

flowchart TD
    %% --- COLOUR PALETTE & STYLING ---
    %% Dark fills + light strokes = readable in both light and dark mode
    classDef user fill:#374151,stroke:#d1d5db,stroke-width:2px,color:#fff
    classDef primary fill:#5b21b6,stroke:#ddd6fe,stroke-width:2px,color:#fff
    classDef secondary fill:#1e40af,stroke:#bfdbfe,stroke-width:2px,color:#fff
    classDef accent fill:#c2410c,stroke:#fed7aa,stroke-width:2px,color:#fff
    classDef success fill:#047857,stroke:#a7f3d0,stroke-width:2px,color:#fff

    %% --- NODES ---
    User((User)):::user
    User --> Action(["Performs action"]):::user

    Action --> Primary

    subgraph Primary["Primary Component"]
        direction TB
        Step1(["Step 1"]):::primary
        Step2(["Step 2"]):::primary
        Step1 --> Step2
    end

    subgraph Secondary["Secondary Component"]
        direction TB
        Process(["Process"]):::secondary
    end

    Primary --> Secondary
    Secondary --> Output(["Output"]):::success

    %% --- SUBGRAPH STYLES ---
    %% fill:none allows subgraphs to adapt to any background
    style Primary fill:none,stroke:#8b5cf6,stroke-width:2px,stroke-dasharray:5 5,color:#8b5cf6
    style Secondary fill:none,stroke:#3b82f6,stroke-width:2px,color:#3b82f6

Colour Pairing Examples

Choose any colours you like — just follow the dark fill + light stroke pattern:

Fill (Dark)Stroke (Light)Result
#374151#d1d5dbGrey
#5b21b6#ddd6fePurple
#1e40af#bfdbfeBlue
#c2410c#fed7aaOrange
#047857#a7f3d0Green
#b91c1c#fecacaRed
#0f766e#99f6e4Teal

These are just examples. Use whatever colours suit your diagram — the principle is what matters.

Subgraph Syntax

❌ WRONG — Causes parse error

subgraph MyGroup [Label With Spaces]

✅ CORRECT — Quote the label

subgraph MyGroup["Label With Spaces"]

Node Shapes

❌ WRONG — Square brackets are harsh

A[Square Node]

✅ CORRECT — Use rounded shapes

A(["Stadium shape"])     %% Rounded ends - use for most nodes
B((Circle))              %% Circle - use for users/actors
C{{"Decision"}}          %% Hexagon for decisions
D[(Database)]            %% Cylinder for databases/storage

Subgraph Styling

❌ WRONG — Coloured fills break in dark mode

style MySubgraph fill:#f0f9ff,stroke:#3182ce

✅ CORRECT — Transparent fills adapt to any background

style MySubgraph fill:none,stroke:#8b5cf6,stroke-width:2px,stroke-dasharray:5 5,color:#8b5cf6

Key points:

  • fill:none makes the background transparent
  • stroke-dasharray:5 5 creates a dashed border (optional, looks clean)
  • color:#... sets the subgraph label colour to match the border

Line Breaks in Node Labels

❌ WRONG — \n renders as literal text

A(["First line\nSecond line"])

✅ CORRECT — Use <br/> for multi-line labels

A(["First line<br/>Second line"])
B[("Tips File<br/>(YAML/JSON)")]
C(["Tips Engine<br/>pick + cycle"])

Link Styling

A --> B              %% Solid arrow
A -.-> B             %% Dashed arrow
A -.->|Label| B      %% Dashed arrow with label
A ==> B              %% Thick arrow

Complete Example

flowchart TD
    classDef user fill:#374151,stroke:#d1d5db,stroke-width:2px,color:#fff
    classDef process fill:#5b21b6,stroke:#ddd6fe,stroke-width:2px,color:#fff
    classDef decision fill:#c2410c,stroke:#fed7aa,stroke-width:2px,color:#fff
    classDef success fill:#047857,stroke:#a7f3d0,stroke-width:2px,color:#fff

    User((User)):::user
    User --> Request(["Makes request"]):::user

    Request --> Process

    subgraph Process["Processing"]
        direction TB
        Validate(["Validate input"]):::process
        Execute(["Execute logic"]):::process
        Validate --> Execute
    end

    Execute --> Check{{"Success?"}}:::decision
    Check -->|Yes| Done(["Complete"]):::success
    Check -->|No| Request

    style Process fill:none,stroke:#8b5cf6,stroke-width:2px,stroke-dasharray:5 5,color:#8b5cf6

Common Mistakes

❌ Font Awesome icons (GitHub doesn't support them)

A[fa:fa-user User]  %% Renders as literal text

❌ Light fills with dark text

classDef bad fill:#ffffff,stroke:#000000,color:#000000  %% Invisible in dark mode

❌ Coloured subgraph fills

style Sub fill:#e0f2fe  %% Looks different in light vs dark mode

❌ Unquoted subgraph labels with spaces

subgraph Sub [My Label]  %% Parse error!

Quick Reference

flowchart TD
    %% 1. Define styles: dark fill + light stroke + white text
    classDef myStyle fill:#DARK,stroke:#LIGHT,stroke-width:2px,color:#fff

    %% 2. Use rounded shapes
    Node(["Text"]):::myStyle

    %% 3. Quote subgraph labels
    subgraph Sub["My Label"]
        Inner(["Inner"])
    end

    %% 4. Style subgraphs with fill:none
    style Sub fill:none,stroke:#COLOR,stroke-width:2px,color:#COLOR

When to Use This Skill

Invoke this skill when creating:

  • Architecture diagrams for PRs
  • System flow documentation
  • Data pipeline visualisations
  • Process flowcharts
  • Any diagram in GitHub markdown

GitHub-Specific Notes

1. No Font Awesome — GitHub's Mermaid renderer doesn't support fa:fa-* icons, they render as text 2. Line breaks use `<br/>` — Use <br/> for multi-line node labels, not \n (which renders literally) 3. Quote labels with spacessubgraph X["Label"] not subgraph X [Label] 4. Test locally — Use mermaid.live to preview before committing

Related skills

FAQ

How do I make Mermaid diagrams readable in dark and light mode?

Use dark fills with light strokes and white text, and set subgraph fills to none so they adapt to any background.

Why do my Font Awesome icons show as text?

GitHub does not support fa:fa-* icons, so avoid them; they render as plain text.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.