mermaid-diagram
Skill9 starsChanged 6 months agoApache-2.0View on GitHub
Turn requirements, code, or a system description into validated Mermaid diagrams (flowchart, sequence, class, ER, state, C4, Gantt, mindmap, git graph) and verify they render via mermaid-cli before delivering.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- j99way99/claude-skillstheir own version, first seen Sep 16, 2026
- talhaMah56/claude_skillstheir own version, first seen Sep 12, 2026
- wookat/ai-research-skillstheir own version, first seen Jul 15, 2026
- wanshuiyin/Auto-claude-code-research-in-sleeptheir own version, first seen Jul 15, 2026
- amjadjibon/skillstheir own version, first seen Jul 12, 2026
- georgekhananaev/claude-skills-vaulttheir own version, first seen May 25, 2026
Used with
Projects with it also use paper-illustration, deepxiv and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
raja21068Skillpaper-illustration
Generate publication-quality AI illustrations for academic papers using Gemini image generation. Creates architecture diagrams, method illustrations with Claude-supervised iterative refinement loop. Use when user says \"生成图表\", \"画架构图\", \"AI绘图\", \"paper illustration\", \"generate diagram\", or needs visual figures for papers.
Also in 5 projects that use this
raja21068Skilldeepxiv
Search and progressively read open-access academic papers through DeepXiv. Use when the user wants layered paper access, section-level reading, trending papers, or DeepXiv-backed literature retrieval.
Also in 4 projects that use this
- +10 more from raja21068
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- wanshuiyin/Auto-claude-code-research-in-sleep★ 17ksame name
- shiwenwen/hope-agent★ 1.7ksame name
- Chanw-research/claude-code-paper-writing★ 42same name
- georgekhananaev/claude-skills-vault★ 28same name
- mjunaidca/robolearn★ 9same name
- amjadjibon/skills★ 2same name
- raja21068/AutoResearch★ 2same name
- wookat/ai-research-skills★ 2same name
- j99way99/claude-skills★ 1same name
- romain325/skills★ 1same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository147 other files it gives its agents.
- second-brain/AGENTS.mdAGENTS.md
- second-brain/CLAUDE.mdCLAUDE.md
- agent-tool-mcp-builderSkill
- api-design-reviewSkill
- async-concurrency-correctnessSkill
- audit-accessibility-wcagSkill
- audit-license-complianceSkill
- audit-technical-seoSkill
- auth-jwt-sessionSkill
- author-codemodSkill
- brainstorm-designSkill
- build-audit-loggingSkill
- build-cdc-streaming-pipelineSkill
- build-cli-toolSkill
- build-data-tableSkill
- build-etl-pipelineSkill
- build-form-validationSkill
- build-native-mobile-uiSkill
- build-office-docsSkill
- build-offline-first-syncSkill
- build-react-componentSkill
- build-realtime-channelSkill
- build-spreadsheetSkill
- build-vector-searchSkill
- caching-strategySkill
- cicd-pipeline-authorSkill
- cloud-cost-optimizeSkill
- code-commentsSkill
- code-reviewSkill
- compose-local-dev-stackSkill
- configure-bundler-buildSkill
- configure-dns-tlsSkill
- configure-reverse-proxy-lbSkill
- configure-security-headers-cspSkill
- contract-testingSkill
- datetime-timezone-correctnessSkill
- db-migration-safetySkill
- debug-ci-pipeline-failureSkill
- debug-flaky-testsSkill
- debug-frontend-browserSkill
- debug-root-causeSkill
- defend-llm-prompt-injectionSkill
- deliver-webhooksSkill
- dependency-upgradeSkill
- deploy-releaseSkill
- design-api-paginationSkill
- design-authorization-modelSkill
- design-backup-dr-recoverySkill
- design-event-sourcing-cqrsSkill
- design-multi-tenancySkill
- design-protobuf-grpc-serviceSkill
- design-relational-schemaSkill
- design-search-index-infraSkill
- design-state-machineSkill
- design-token-systemSkill
- diff-table-paritySkill
- distributed-locks-leasesSkill
- dockerfile-optimizeSkill
- encrypt-sensitive-dataSkill
- error-messageSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
If unsure between flowchart and sequence: does order-of-time + who-does-what matter?
- Distinctive: line 27
Read the source of truth, don't guess: If diagramming code, open the actual files/functions and trace real control flow, call edges, or …
- Very specific: line 38
Tighten for readability: before delivery: short node labels (offload detail to surrounding prose), subgraph to group related nodes, …
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to Use
Trigger when the intent is "show this as a diagram" and the target is Mermaid (renders natively in GitHub, GitLab, Obsidian, VS Code, most docs). Map intent → diagram type up front; picking wrong wastes a render cycle:
| Intent / phrasing | Diagram type | Header keyword |
| Steps, branches, "the flow of X", decision logic | flowchart | flowchart TD / LR |
| Actors talking over time, API calls, request/response | sequence | sequenceDiagram |
| DB schema, tables + relations + cardinality | ER | erDiagram |
| OOP model, types, fields, inheritance | class | classDiagram |
| Lifecycle, status machine, "states of an order" | state | stateDiagram-v2 |
| System / container / service boundaries | C4 | C4Context / C4Container |
| Timeline, project phases, dependencies-over-time | gantt | gantt |
| Hierarchy of ideas, brainstorm tree | mindmap | mindmap |
| Branch/merge history | git graph | gitGraph |
If unsure between flowchart and sequence: does order-of-time + who-does-what matter? yes → sequence, no → flowchart.
Steps
- Read the source of truth, don't guess. If diagramming code, open the actual files/functions and trace real control flow, call edges, or schema — not an assumed design. For ER/class, pull field names and FKs from the real schema/models.
- Pick the type from the table above and the direction. Default
flowchart TD(top-down) for processes;LR(left-right) when there are many sequential steps (wide reads better than tall). - Write the Mermaid source to a temp file, e.g.
/tmp/diagram.mmd— do not hand-build it inline; you need a file to validate. - Validate by rendering — this is non-negotiable, a diagram that doesn't parse is a failure:
npx -y @mermaid-js/mermaid-cli@latest -i /tmp/diagram.mmd -o /tmp/diagram.svg- First run downloads the package; that's expected. If
mmdcis already on PATH, use it directly:mmdc -i in.mmd -o out.svg. - On headless/CI or if Chromium fails to launch, add a puppeteer config: write
{"args":["--no-sandbox"]}to/tmp/pp.jsonand append-p /tmp/pp.json. - SVG is the cheapest/fastest output for a syntax check. Use
-o out.pngonly if the user wants a raster image.
- First run downloads the package; that's expected. If
- If it fails, fix the root cause and re-render. Read the parser error (it gives a line/token), correct the syntax, run step 4 again. Loop until it renders clean. Never "soften" by deleting the failing node or wrapping problem text — fix the actual syntax (see Common Errors).
- Tighten for readability before delivery: short node labels (offload detail to surrounding prose),
subgraphto group related nodes, consistent edge labels, and a sane direction. A correct-but-unreadable diagram still fails the task. - Deliver as a fenced ```mermaid block ready to paste into markdown/Obsidian. Do not deliver the SVG path as the answer unless the user explicitly asked for an image file — the fenced source is the product.
Common Errors
- Parens/brackets/quotes inside a label break the parser.
A[Fetch (cached)]fails. Wrap the whole label in double quotes:A["Fetch (cached)"]. Same fix for:,;,#,&,<,>,/. - HTML in labels needs
<br/>not\n. Newlines inside a node useA["Line one<br/>Line two"]. A literal\nrenders as text. - Reserved word
endas a lowercase node id silently corrupts flowcharts. UseEnd,END, ore_end. - Sequence diagrams: declare or imply participants consistently. Mixing
participant A as Auththen referring toAuthlater (the alias, not the id) breaks. Reference the id in arrows, the alias is display-only. - ER cardinality syntax is strict:
USER ||--o{ ORDER : places(one-to-many). Common crash is using1/*instead of the||,o{,}o,|{tokens. - C4 diagrams need the right header (
C4Context,C4Container,C4Component) andRel(a, b, "label")— they do NOT use flowchart arrow syntax. Don't mix the two grammars. ganttdates must be ISO (YYYY-MM-DD) and need adateFormatline; freeform dates fail.%%is the comment marker, not//or#. A stray//comment is parsed as a node and throws.graphis the legacy keyword; preferflowchart. Both parse, butflowchartgets newer features (e.g.&chaining). Don't mix dialects in one block.- Indentation matters in
mindmap— it's whitespace-structured like YAML, not bracket-structured. Inconsistent indent = wrong tree.
Verify
Done only when ALL hold:
mmdc/npx ... mermaid-cliexited 0 on the final source (an actual render happened — not "it looks right").- Diagram type matches the user's intent (flow vs sequence vs schema), not just "a diagram."
- Every node/edge in the diagram maps to something real in the source code/spec — no invented steps, no dropped branches.
- Labels are concise and the layout direction reads cleanly; groups use
subgraphwhere it reduces crossing edges. - Delivered as a copy-paste-ready ```mermaid fenced block (plus the image path only if an image was requested).
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
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.

