Agent skill

Mermaid Diagrams

by jjmartres in jjmartres/opencode

Helps an agent pick the right Mermaid diagram type and write the syntax for class, sequence, flow, ER, C4, state and other software diagrams.

MITAuto-check passedDevelopment

Install Mermaid Diagrams

skills CLI
$ npx skills add jjmartres/opencode --skill mermaid-diagrams -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jjmartres/opencode mermaid-diagrams --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jjmartres/opencode.git skills-src && mkdir -p .claude/skills && cp -r skills-src/opencode/skills/mermaid-diagrams .claude/skills/mermaid-diagrams && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mermaid-diagrams
GitHub stars
133
Used in
6 other repos
Token cost
~1.9k tokens
SKILL.md length
536 words
Files
8 (incl. references)
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

Helps an agent pick the right Mermaid diagram type and write the syntax for class, sequence, flow, ER, C4, state and other software diagrams.

  • Works in 9 steps: Class Diagrams - Domain modeling, OOP… → Sequence Diagrams - Temporal… → Flowcharts - Processes, algorithms,… → …
  • Documenting a service's request flow as a sequence diagram
  • SKILL.md covers Core Syntax Structure, Diagram Type Selection Guide, Quick Start Examples and Detailed References, plus 5 more sections
  • Calls npm and docker

What it does

The skill explains Mermaid's text syntax, where the first line names the diagram type and `%%` marks comments, and it includes a selection guide matching tasks to diagram types: class diagrams for domain models, sequence diagrams for API and authentication flows, flowcharts for processes and user journeys, ER diagrams for schemas, and C4 diagrams at context, container, component and code levels. State diagrams, git graphs, Gantt charts and pie or bar charts are listed as well.

Quick-start examples show a domain model, an API flow, a user journey and a database schema. Detailed reference files cover class, sequence, flowchart, ER and C4 diagrams plus architecture diagrams and advanced features. The skill warns that unknown words break a diagram and that parameters can fail silently. Because Mermaid is plain text, the diagrams can be version-controlled next to the code.

When your agent uses it

  • Documenting a service's request flow as a sequence diagram
  • Sketching a database schema as an ER diagram
  • Drawing C4 architecture views of a system
  • Showing a branching strategy as a git graph

Example prompts

  • “Draw a sequence diagram of the login flow between the browser, API and auth service.”
  • “Create an ER diagram for users, orders and line items in Mermaid.”
  • “Show our release branching strategy as a Mermaid git graph.”

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. Class Diagrams - Domain modeling, OOP design, entity relationships
  2. Sequence Diagrams - Temporal interactions, message flows
  3. Flowcharts - Processes, algorithms, decision trees
  4. Entity Relationship Diagrams (ERD) - Database schemas
  5. C4 Diagrams - Software architecture at multiple levels
  6. State Diagrams - State machines, lifecycle states
  7. Git Graphs - Version control branching strategies
  8. Gantt Charts - Project timelines, scheduling
  9. Pie/Bar Charts - Data visualization

What it can do on your machine

Read from SKILL.md and the folder at commit 28dc323. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • docker

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • mermaid.live

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mermaid Diagrams loads about 1.9k tokens when it runs, and up to ~19k if it reads all its reference files. Until then it costs about 180 tokens; SKILL.md has 536 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~180
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~19k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jjmartres/opencode at commit 28dc323, republished under its MIT licence (© jjmartres). 536 words, ~1,866 tokens.

Download SKILL.mdSave it as .claude/skills/mermaid-diagrams/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
mermaid-diagrams
description
Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts, gantt charts, or any other diagram type. Triggers include requests to "diagram", "visualize", "model", "map out", "show the flow", or when explaining system architecture, database design, code structure.

Mermaid Diagramming

Create professional software diagrams using Mermaid's text-based syntax. Mermaid renders diagrams from simple text definitions, making diagrams version-controllable, easy to update, and maintainable alongside code.

Core Syntax Structure

All Mermaid diagrams follow this pattern:

mermaid
diagramType
  definition content

Key principles:

  • First line declares diagram type (e.g., classDiagram, sequenceDiagram, flowchart)
  • Use %% for comments
  • Line breaks and indentation improve readability but aren't required
  • Unknown words break diagrams; parameters fail silently

Diagram Type Selection Guide

Choose the right diagram type:

  1. Class Diagrams - Domain modeling, OOP design, entity relationships

    • Domain-driven design documentation
    • Object-oriented class structures
    • Entity relationships and dependencies
  2. Sequence Diagrams - Temporal interactions, message flows

    • API request/response flows
    • User authentication flows
    • System component interactions
    • Method call sequences
  3. Flowcharts - Processes, algorithms, decision trees

    • User journeys and workflows
    • Business processes
    • Algorithm logic
    • Deployment pipelines
  4. Entity Relationship Diagrams (ERD) - Database schemas

    • Table relationships
    • Data modeling
    • Schema design
  5. C4 Diagrams - Software architecture at multiple levels

    • System Context (systems and users)
    • Container (applications, databases, services)
    • Component (internal structure)
    • Code (class/interface level)
  6. State Diagrams - State machines, lifecycle states

  7. Git Graphs - Version control branching strategies

  8. Gantt Charts - Project timelines, scheduling

  9. Pie/Bar Charts - Data visualization

Quick Start Examples

Class Diagram (Domain Model)
mermaid
classDiagram
    Title -- Genre
    Title *-- Season
    Title *-- Review
    User --> Review : creates

    class Title {
        +string name
        +int releaseYear
        +play()
    }

    class Genre {
        +string name
        +getTopTitles()
    }
Sequence Diagram (API Flow)
mermaid
sequenceDiagram
    participant User
    participant API
    participant Database

    User->>API: POST /login
    API->>Database: Query credentials
    Database-->>API: Return user data
    alt Valid credentials
        API-->>User: 200 OK + JWT token
    else Invalid credentials
        API-->>User: 401 Unauthorized
    end
Flowchart (User Journey)
mermaid
flowchart TD
    Start([User visits site]) --> Auth{Authenticated?}
    Auth -->|No| Login[Show login page]
    Auth -->|Yes| Dashboard[Show dashboard]
    Login --> Creds[Enter credentials]
    Creds --> Validate{Valid?}
    Validate -->|Yes| Dashboard
    Validate -->|No| Error[Show error]
    Error --> Login
ERD (Database Schema)
mermaid
erDiagram
    USER ||--o{ ORDER : places
    ORDER ||--|{ LINE_ITEM : contains
    PRODUCT ||--o{ LINE_ITEM : includes

    USER {
        int id PK
        string email UK
        string name
        datetime created_at
    }

    ORDER {
        int id PK
        int user_id FK
        decimal total
        datetime created_at
    }

Detailed References

For in-depth guidance on specific diagram types, see:

Best Practices

  1. Start Simple - Begin with core entities/components, add details incrementally
  2. Use Meaningful Names - Clear labels make diagrams self-documenting
  3. Comment Extensively - Use %% comments to explain complex relationships
  4. Keep Focused - One diagram per concept; split large diagrams into multiple focused views
  5. Version Control - Store .mmd files alongside code for easy updates
  6. Add Context - Include titles and notes to explain diagram purpose
  7. Iterate - Refine diagrams as understanding evolves
Show full SKILL.md (193 more words)Show less

Configuration and Theming

Configure diagrams using frontmatter:

mermaid
---
config:
  theme: base
  themeVariables:
    primaryColor: "#ff6b6b"
---
flowchart LR
    A --> B

Available themes: default, forest, dark, neutral, base

Layout options:

  • layout: dagre (default) - Classic balanced layout
  • layout: elk - Advanced layout for complex diagrams (requires integration)

Look options:

  • look: classic - Traditional Mermaid style
  • look: handDrawn - Sketch-like appearance

Exporting and Rendering

Native support in:

  • GitHub/GitLab - Automatically renders in Markdown
  • VS Code - With Markdown Mermaid extension
  • Notion, Obsidian, Confluence - Built-in support

Export options:

  • Mermaid Live Editor - Online editor with PNG/SVG export
  • Mermaid CLI - npm install -g @mermaid-js/mermaid-cli then mmdc -i input.mmd -o output.png
  • Docker - docker run --rm -v $(pwd):/data minlag/mermaid-cli -i /data/input.mmd -o /data/output.png

Common Pitfalls

  • Breaking characters - Avoid {} in comments, use proper escape sequences for special characters
  • Syntax errors - Misspellings break diagrams; validate syntax in Mermaid Live
  • Overcomplexity - Split complex diagrams into multiple focused views
  • Missing relationships - Document all important connections between entities

When to Create Diagrams

Always diagram when:

  • Starting new projects or features
  • Documenting complex systems
  • Explaining architecture decisions
  • Designing database schemas
  • Planning refactoring efforts
  • Onboarding new team members

Use diagrams to:

  • Align stakeholders on technical decisions
  • Document domain models collaboratively
  • Visualize data flows and system interactions
  • Plan before coding
  • Create living documentation that evolves with code

© jjmartres, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (references) in opencode/skills/mermaid-diagrams of jjmartres/opencode.

  • SKILL.md
  • references/advanced-features.md
  • references/architecture-diagrams.md
  • references/c4-diagrams.md
  • references/class-diagrams.md
  • references/erd-diagrams.md
  • references/flowcharts.md
  • references/sequence-diagrams.md

Open the folder on GitHubat commit 28dc323

Used in 6 other repositories

We found 6 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 6 other GitHub owners. This page covers the copy in jjmartres/opencode, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Mermaid Diagrams next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mermaid Diagrams compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mermaid Diagrams this skilljjmartres/opencode1336 repos~1.9kAutomated safety check: PassMIT
C4 Architecture Diagramslexler/skill-factory239—~2.3kAutomated safety check: PassApache-2.0
Archify Diagramstt-a1i/archify82k—~2.9kAutomated safety check: PassMIT
Diagram Designcathrynlavery/diagram-design49k1 repos~7.6kAutomated safety check: PassMIT
Draw.io Diagram StudioAgents365-ai/drawio-skill10k—~2.4kAutomated safety check: NotesMIT
Dark Architecture Diagram BuilderCocoon-AI/architecture-diagram-generator7.4k1 repos~2.1kAutomated safety check: PassMIT

Similar skills

  • C4 Architecture Diagrams

    lexler/skill-factory

    Creates C4 model diagrams at every zoom level, from system landscape to code, in ASCII, Mermaid or Structurizr, for designing or documenting software architecture.

    239 GitHub stars~2.3k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Archify Diagrams

    tt-a1i/archify

    Creates interactive architecture, workflow, sequence, data-flow and lifecycle diagrams as standalone HTML with inline SVG, themes and image or video export.

    82k GitHub stars~2.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Diagram Design

    cathrynlavery/diagram-design

    Creates branded diagrams, from architecture, flowchart and sequence to charts and maps, as self-contained HTML with inline SVG, with import from draw.io, Mermaid and Excalidraw.

    49k GitHub starsUsed in 1 repo~7.6k tokens
    DevelopmentAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check: notes
  • Dark Architecture Diagram Builder

    Cocoon-AI/architecture-diagram-generator

    Creates dark-themed system, cloud, security and network architecture diagrams as self-contained HTML files with inline SVG and CSS.

    7.4k GitHub starsUsed in 1 repo~2.1k tokens
    DevelopmentAuto-check passed
  • Pretty Mermaid Renderer

    imxv/Pretty-mermaid-skills

    Writes and renders Mermaid diagrams as themed SVG, PNG or terminal ASCII and Unicode art with a bundled Node.js CLI that needs no browser.

    1.5k GitHub stars~2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed

More from jjmartres/opencode

All 11 skills in this repo
  • Marp Slide Creator

    jjmartres/opencode

    Builds Marp slide decks in one of seven ready-made themes, using bundled templates plus syntax, image and style references to keep slides short and readable.

    133 GitHub starsUsed in 3 repos~2.2k tokens
    Auto-check passed
  • Lets an agent view, create, update and transition Jira issues in natural language, automatically choosing between the jira CLI and Atlassian MCP tools.

    133 GitHub starsUsed in 3 repos~1.7k tokens
    Auto-check passed
  • Google Style Code Docs

    jjmartres/opencode

    Applies Google Style documentation to Python docstrings, Go comments and Terraform descriptions, for writing new docs or reviewing existing ones.

    133 GitHub stars~1.9k tokensUpdated 5 mo ago
    Auto-check passed
  • Guides use of Worktrunk (wt), a CLI that makes git worktrees as easy as branches so several AI agents can work in parallel on isolated branches.

    133 GitHub stars~1.9k tokensUpdated 5 mo ago
    Auto-check: notes
  • A skill your agent uses when writing prose humans will read—documentation, commit messages, error messages, explanations, reports, or UI text.

    133 GitHub starsUsed in 6 repos~1k tokens
    Auto-check passed
  • Asdf

    jjmartres/opencode

    A skill your agent uses whenever the user wants to install, configure, or use asdf (asdf-vm), the universal version manager.

    133 GitHub stars~2.1k tokensUpdated 5 mo ago
    Auto-check: notes

Works with

Categories

Questions about Mermaid Diagrams

What does Mermaid Diagrams do?

Helps an agent pick the right Mermaid diagram type and write the syntax for class, sequence, flow, ER, C4, state and other software diagrams. The skill explains Mermaid's text syntax, where the first line names the diagram type and `%%` marks comments, and it includes a selection guide matching tasks to diagram types: class diagrams for domain models, sequence diagrams for API and authentication flows, flowcharts for processes and user journeys, ER diagrams for schemas, and C4 diagrams at context, container, component and code levels. State diagrams, git graphs, Gantt charts and pie or bar charts are listed as well.

When should I use Mermaid Diagrams?

Mermaid Diagrams fits situations like: documenting a service's request flow as a sequence diagram; sketching a database schema as an ER diagram; drawing C4 architecture views of a system; showing a branching strategy as a git graph.

How do I install Mermaid Diagrams in Claude Code?

Run `npx skills add jjmartres/opencode --skill mermaid-diagrams -a claude-code`. Or copy the skill folder (opencode/skills/mermaid-diagrams in jjmartres/opencode) into .claude/skills/mermaid-diagrams in your project. Claude Code loads it when a task matches its description.

How do I install Mermaid Diagrams in Codex?

Run `npx skills add jjmartres/opencode --skill mermaid-diagrams -a codex`. Or copy the skill folder (opencode/skills/mermaid-diagrams in jjmartres/opencode) into .agents/skills/mermaid-diagrams in your project. Codex loads it when a task matches its description.

Can I use Mermaid Diagrams in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jjmartres/opencode --skill mermaid-diagrams -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mermaid-diagrams, .gemini/skills/mermaid-diagrams, .github/skills/mermaid-diagrams and .opencode/skills/mermaid-diagrams in your project.

What does Mermaid Diagrams need to run?

Going by SKILL.md and its folder, Mermaid Diagrams needs the command-line tools its instructions call (npm and docker).

Does Mermaid Diagrams access the network?

SKILL.md names 1 domain. As links in the text: mermaid.live. This is read from the text; nothing was executed.

Is Mermaid Diagrams safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mermaid Diagrams use?

Mermaid Diagrams is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mermaid Diagrams use?

About 1.9k tokens (SKILL.md is roughly 7.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17k tokens, read only when the agent opens those files.

What are the alternatives to Mermaid Diagrams?

Skills that share tags, products or a category with Mermaid Diagrams: C4 Architecture Diagrams (lexler/skill-factory, 239 stars), Archify Diagrams (tt-a1i/archify, 82k stars), Diagram Design (cathrynlavery/diagram-design, 49k stars) and Draw.io Diagram Studio (Agents365-ai/drawio-skill, 10k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mermaid Diagrams?

jjmartres (a GitHub user) maintains it in jjmartres/opencode, which has 133 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on April 20, 2026.

Source: jjmartres/opencode on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.