Diagrams ClaudeCursor Foundations

Mermaid Flowchart Basics

Create flowcharts with Mermaid syntax for architecture docs

44 of 66

What is Mermaid?

Mermaid is a text-based diagramming language that renders in GitHub, GitLab, Notion, and many editors. Write text, get diagrams.

Basic flowchart

flowchart TD
    A[Start] --> B{Decision?}
    B -->|Yes| C[Action 1]
    B -->|No| D[Action 2]
    C --> E[End]
    D --> E

Node shapes

A[Rectangle]
B(Rounded)
C([Stadium])
D{Diamond}
E[(Database)]
F((Circle))

Direction options

  • TD or TB -- top to bottom
  • LR -- left to right
  • BT -- bottom to top
  • RL -- right to left

Subgraphs for grouping

flowchart LR
    subgraph Frontend
        A[React App] --> B[Components]
    end
    subgraph Backend
        C[API Server] --> D[(Database)]
    end
    B --> C

Common gotchas

  • Do not use spaces in node IDs (UserService, not User Service)
  • Wrap edge labels with special chars in quotes: A -->|"O(n)"| B
  • Avoid end as a node ID (reserved keyword)

Working out which model to run this on? See The Codex. Packaging it as a reusable skill? See The Armory.