Skip to content
creating-mermaid-flowcharts logo

Creating Mermaid Flowcharts

creating-mermaid-flowcharts

Use when creating or editing Mermaid flowchart diagrams, encountering parse errors, or unsure about node shapes, connection syntax, or styling - provides syntax guardrails using modern shape syntax for Obsidian-compatible diagrams

SKILL.md

Full skill instructions

Creating Mermaid Flowcharts

Overview

Mermaid has strict syntax rules: node identifiers must be simple alphanumeric (a, b, node1), while labels can contain any text. Modern @{ shape: ..., label: "..." } syntax is preferred over legacy shorthand for clarity and reliability.

When to Use

Use this skill when:

  • Creating new Mermaid flowchart diagrams
  • Encountering parse errors ("Expecting 'SEMI'", syntax errors)
  • Converting diagrams from other formats (dot, graphviz)
  • Unsure about shape syntax, connection types, or styling
  • Need to add colors or classes to nodes

Don't use for:

  • Other Mermaid diagram types (sequence, gantt, class diagrams)
  • Complex state machines (use stateDiagram instead)

Quick Reference

Common Shapes

ShapeModern SyntaxUse Case
Diamonda@{ shape: diam, label: "Decision?" }Decisions, questions
Rectanglea@{ shape: rect, label: "Action" }Process steps, actions
Stadiuma@{ shape: stadium, label: "Start/​End" }Start/​end points (preferred)
Circlea@{ shape: circle, label: "Start" }Alternative for start/​end
Roundeda@{ shape: rounded, label: "Event" }Events, states

Note: Use stadium for start/​end nodes (more readable). Use circle for compact diagrams.

See mermaid-flowchart-reference.md for complete shape list.

Connections

TypeSyntaxExample
Solid arrow-->a --> b
Labeled arrow-->|label|a -->|yes| b
Dotted-.->a -.-> b
Thick==>a ==> b

Styling

PatternSyntaxPurpose
Define classclassDef name fill:#colorCreate reusable style
Apply classnode:::classNameStyle specific node

Core Pattern

❌ WRONG - Spaces in identifiers:

graph LR
    "New constraint revealed?" --> "Return to Phase 1"

Error: Identifiers can't have spaces. Parse will fail.

✅ CORRECT - Simple IDs + Labels:

graph LR
    a@{ shape: diam, label: "New constraint revealed?" }
    b@{ shape: rect, label: "Return to Phase 1" }
    a -->\|yes\| b

Implementation

Step 1: Choose Graph Direction

graph TD    ← Top-down (vertical flow)
graph LR    ← Left-right (horizontal flow)

Choose based on flow:

  • TD (or TB) = Top-down for sequential processes, workflows
  • LR = Left-right for timelines, state transitions
  • BT = Bottom-up (rare)
  • RL = Right-left (rare)

Step 2: Define Nodes with Modern Syntax

graph TD
    a@{ shape: diam, label: "Your question here?" }
    b@{ shape: rect, label: "Your action here" }

Rules:

  • Identifier = simple alphanumeric only (a, b, node1, step2)
  • Label = any text in quotes after label:
  • Shape = from reference list (diam, rect, circle, stadium, etc.)

Step 3: Connect Nodes

    a -->\|yes\| b
    a -->\|no\| c

Always label decision branches (yes/​no, true/​false, etc.)

Step 4: Apply Styling (Optional)

    classDef highlight fill:#ffcccc
    classDef success fill:#ccffcc

    b:::highlight
    c:::success

Define classes before applying them. Each node can only have one class applied.

Styling patterns:

  • Multiple end nodes: Use separate end nodes when paths have different outcomes; use single end node when all paths converge naturally
  • Decision nodes: Keep neutral (no styling) or style based on their context (error flow vs success flow)
  • Need composite styles? Create a new class combining properties rather than applying multiple classes

Common Mistakes

Mistake 1: Spaces in Identifiers

Problem:

"My Node" --> "Other Node"

Fix: Use simple IDs with labels:

a@{ shape: rect, label: "My Node" } --> b@{ shape: rect, label: "Other Node" }

Mistake 2: Missing Edge Labels on Decisions

Problem:

decision --> optionA
decision --> optionB

Fix: Label your decision branches:

decision -->\|yes\| optionA
decision -->\|no\| optionB

Mistake 3: Applying Undefined Classes

Problem:

a:::highlight  ← Class never defined

Fix: Define before applying:

classDef highlight fill:#ffcccc
a:::highlight

Mistake 4: Mixing Legacy and Modern Syntax

Problem:

a@{ shape: diam, label: "Modern" }
b{"Legacy"}  ← Inconsistent

Fix: Use modern syntax consistently throughout diagram.

Debugging Checklist

When you get parse errors:

  • All identifiers are simple alphanumeric (no spaces, no special chars)
  • Modern @{ shape: ..., label: "..." } syntax used consistently
  • Decision nodes have labeled edges
  • Classes defined before applied
  • No trailing semicolons or extra whitespace
  • Graph direction specified (LR, TD, etc.)

Real-World Impact

Using modern syntax eliminates 90% of parse errors. Proper identifier naming allows diagrams to render on first attempt in Obsidian without web lookups or trial-and-error debugging.

More Productivity & Planning skills

brainstorming logo
Productivity & Planning

brainstorming

Structured design dialogue that validates ideas before implementation begins.

295.4K 385.7K
View
ui-ux-pro-max logo
Productivity & Planning

ui-ux-pro-max

Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.

133.1K 383.9K
View
writing-plans logo
Productivity & Planning

writing-plans

Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.

295.4K 268K
View
using-superpowers logo
Productivity & Planning

using-superpowers

Introduction to the obra skills system with mandatory skill invocation rules and best practices.

295.4K 259.8K
View
executing-plans logo
Productivity & Planning

executing-plans

Execute a written implementation plan with critical review and task checkpoints.

295.4K 229.1K
View
dispatching-parallel-agents logo
Productivity & Planning

dispatching-parallel-agents

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View
using-git-worktrees logo
Productivity & Planning

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View
webapp-testing logo
Productivity & Planning

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View
content-strategy logo
Productivity & Planning

content-strategy

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View
repo-intake-and-plan logo
Productivity & Planning

repo-intake-and-plan

README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.

497 139.6K
View
marketing-ideas logo
Productivity & Planning

marketing-ideas

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
site-architecture logo
Productivity & Planning

site-architecture

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View

Productivity AI tools

Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View
SaveDay logo
Productivity

SaveDay

Capture, organize, and utilize your knowledge effortlessly.

Free
View
Any Summary logo
Productivity

Any Summary

Instant Summaries of Audio & Video Interviews with AnySummary

Freemium
View
M
Productivity

Map This

Transform PDFs into engaging mind maps.

Freemium
View
ChatPDF logo
Productivity

ChatPDF

Chat with any PDF instantly

Free
View
I
Productivity

intellisay

Create an optimal daily plan using your voice

Paid
View
A
Productivity

Aurora AI

A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.

Paid
View
AskYourPDF logo
Productivity

AskYourPDF

AskYourPDF Pricing Plans: Tailored to Your Needs

Free
View