{"slug":"mermaid-diagrams","title":"mermaid-diagrams","summary":"Practical guide for creating human-readable and agent-parseable diagrams using Mermaid. Includes conservative, renderer-compatible templates and when-to-use guidance.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-08-24T17:35:11.499318Z","repo":{"url":"https://github.com/Desko77/claude-code-skills-1c","stars":72,"forks":16,"license":"MIT","updatedAt":"2026-09-24T10:53:41Z"},"bodyHtml":"<hr>\n<h2>name: mermaid-diagrams\ndescription: \"Practical guide for creating human-readable and agent-parseable diagrams using Mermaid. Includes conservative, renderer-compatible templates and when-to-use guidance.\"</h2>\n<h1>Mermaid Diagrams Skill</h1>\n<p>This skill provides:</p>\n<ul>\n<li>A conservative set of Mermaid templates that render on older renderers (VS Code/Markdown previewers, Git platforms) and remain clear to humans.</li>\n<li>Guidance on which diagram type to use for which situation.</li>\n<li>Compatibility tips and fallbacks when advanced Mermaid types are unavailable.</li>\n</ul>\n<h2>Compatibility Rules (Read First)</h2>\n<ul>\n<li>Prefer <code>graph LR</code>/<code>graph TB</code> for flowcharts; some renderers fail on <code>flowchart</code> keyword.</li>\n<li>Quote labels containing spaces/special characters: <code>A[\"Text (x|y) |\"]</code>.</li>\n<li><strong>Do not use literal <code>\\n</code> inside labels</strong> — Mermaid does not interpret such line breaks. Use <code>&lt;br/&gt;</code> for line breaks.</li>\n<li>Advanced types like <code>quadrantChart</code>, <code>sankey-beta</code>, <code>requirementDiagram</code>, <code>gitGraph</code> may not be available. Use provided flowchart fallbacks.</li>\n<li>Code fences must start at column 0 with language <code>mermaid</code>.</li>\n</ul>\n<h2>ASCII/Unicode Sidecar (Human-Readable Raw Markdown)</h2>\n<p>To optimize for quick human scanning in raw Markdown and robust parsing by agents, always ship an ASCII/Unicode sidecar immediately below each Mermaid block.</p>\n<p>Policy:</p>\n<ul>\n<li>MUST include a monospace, text-only diagram right under the Mermaid block using fenced code with language <code>text</code>.</li>\n<li>MUST keep Mermaid and sidecar in sync (same nodes/edges, same labels where feasible). If they diverge, treat Mermaid as the source of truth and update the sidecar.</li>\n<li>SHOULD limit width to ~80 columns for readability in diffs and terminals.</li>\n<li>SHOULD use simple line art characters (ASCII first; Unicode box-drawing optional when environment supports it).</li>\n<li>MAY add a one-line caption above the pair: <code>Diagram: &lt;name&gt; (&lt;type&gt;)</code>.</li>\n</ul>\n<p>Recommended primitives:</p>\n<ul>\n<li>Boxes: <code>[Name]</code>, <code>(Name)</code>, <code>+-----+\\n| N |\\n+-----+</code></li>\n<li>Flows: <code>--&gt;</code>, decisions as <code>{cond?}</code> lines, lists with <code>-</code>.</li>\n<li>Sequence (text-based): <code>Actor -&gt; Actor: message</code> with indented lifelines.</li>\n</ul>\n<p>Example (Flowchart):</p>\n<pre>graph LR\n  A[\"Start\"] --&gt; B{Auth?}\n  B --&gt;|Yes| C[\"Dashboard\"]\n  B --&gt;|No|  D[\"Login\"]\n</pre>\n<pre><code>Diagram: Auth flow (flowchart)\n  [Start] --&gt; {Auth?}\n      {Auth?} -- Yes --&gt; [Dashboard]\n      {Auth?} -- No  --&gt; [Login]\n</code></pre>\n<p>Example (Text-based Sequence):</p>\n<pre>sequenceDiagram\n  participant U as User\n  participant W as WebApp\n  U-&gt;&gt;W: Open\n  W--&gt;&gt;U: OK\n</pre>\n<pre><code>Diagram: Happy path (sequence)\n  User -&gt; WebApp : Open\n  WebApp -&gt; User : OK\n</code></pre>\n<h2>Working Templates (Renderer-Compatible)</h2>\n<h3>Flowchart</h3>\n<pre>graph LR\n  A[\"Start\"] --&gt; B{Auth?}\n  B --&gt;|Yes| C[\"Dashboard\"]\n  B --&gt;|No|  D[\"Login\"]\n  C --&gt; E[\"Settings\"]\n</pre>\n<h3>Sequence</h3>\n<pre>sequenceDiagram\n  autonumber\n  participant U as User\n  participant W as WebApp\n  participant API\n  U-&gt;&gt;W: Open\n  W-&gt;&gt;API: GET /status\n  API--&gt;&gt;W: 200\n  W--&gt;&gt;U: OK\n</pre>\n<h3>Class</h3>\n<pre>classDiagram\n  class User {\n    +String id\n    +String name\n    +login(): bool\n  }\n  class Order {\n    +String id\n    +Decimal total\n    +submit()\n  }\n  User \"1\" o-- \"*\" Order\n</pre>\n<h3>State (v2)</h3>\n<pre>stateDiagram-v2\n  [*] --&gt; Idle\n  Idle --&gt; Loading : fetch\n  Loading --&gt; Ready : ok\n  Loading --&gt; Error : fail\n  state Ready {\n    [*] --&gt; Viewing\n    Viewing --&gt; Editing : edit\n    Editing --&gt; Viewing : save\n  }\n  Error --&gt; Idle : retry\n</pre>\n<h3>ER (Entity-Relationship)</h3>\n<pre>erDiagram\n  USER ||--o{ ORDER : places\n  ORDER ||--|{ ORDER_LINE : contains\n  PRODUCT ||--o{ ORDER_LINE : referenced\n  USER {\n    string id\n    string email\n  }\n  PRODUCT {\n    string id\n    string name\n    float price\n  }\n</pre>\n<h3>Journey (User Journey)</h3>\n<pre>journey\n  title Checkout UX\n  section Browse\n    \"See product\": 5: User\n    \"Add to cart\": 4: User\n  section Payment\n    \"Enter card\": 2: User\n    \"3DS confirm\": 2: User\n  section Result\n    \"Success page\": 5: User\n</pre>\n<h3>Gantt</h3>\n<pre>gantt\n  title Release Plan\n  dateFormat  YYYY-MM-DD\n  section Dev\n  Spec  :done,   des1, 2025-10-01,2025-10-05\n  Impl  :active, des2, 2025-10-06,2025-10-20\n  Tests :        des3, 2025-10-21, 7d\n  section Release\n  Freeze :milestone, m1, 2025-10-28, 0d\n  Deploy :crit,    des4, 2025-10-29, 1d\n</pre>\n<h3>Pie (compatible syntax)</h3>\n<pre>pie\n  title Traffic by Source\n  \"Direct\"  : 35\n  \"Organic\" : 45\n  \"Ads\"     : 20\n</pre>\n<h3>Quadrant — flowchart fallback</h3>\n<pre>graph TB\n  Q1[\"Quick Wins&lt;br/&gt;High Impact - Low Effort&lt;br/&gt;&lt;br/&gt;- Improve UX\"]\n  Q2[\"Major Projects&lt;br/&gt;High Impact - High Effort&lt;br/&gt;&lt;br/&gt;- Rewrite Core\"]\n  Q3[\"Fill-ins&lt;br/&gt;Low Impact - Low Effort&lt;br/&gt;&lt;br/&gt;- Docs polish\"]\n  Q4[\"Thankless&lt;br/&gt;Low Impact - High Effort&lt;br/&gt;&lt;br/&gt;- Legacy migration\"]\n\n  Q1 --&gt; Q2\n  Q1 --&gt; Q3\n  Q2 --&gt; Q4\n  Q3 --&gt; Q4\n</pre>\n<h3>Requirement — flowchart fallback</h3>\n<pre>graph LR\n  R1[\"Requirement: PCI-DSS compliant\"]\n  T1[\"Test: PCI checklist\"]\n  SVC[\"Service\"]\n\n  SVC -- satisfies --&gt; R1\n  T1  -- verifies  --&gt; R1\n</pre>\n<h3>Sankey — flowchart fallback (weights on edges)</h3>\n<pre>graph LR\n  Checkout[\"Checkout\"] --&gt;|100| PSP[\"PSP\"]\n  PSP --&gt;|60|  Settled[\"Settled\"]\n  PSP --&gt;|40|  Declined[\"Declined\"]\n</pre>\n<h3>Git graph — flowchart fallback (simple DAG)</h3>\n<pre>graph LR\n  A[\"init\"] --&gt; B[\"feat-A\"]\n  A --&gt; C[\"fix-1\"]\n  B --&gt; D[\"merge\"]\n  C --&gt; D\n</pre>\n<h2>When to Use Which Diagram</h2>\n<ul>\n<li>Flowchart: General flows, decisions, and data movement in specs and PRDs.</li>\n<li>Sequence: Interactions over time between actors/services (APIs, requests, responses).</li>\n<li>Class: Domain models and static structure; useful for entity attributes and relations.</li>\n<li>State: Lifecycle of an entity/component (idle -&gt; loading -&gt; ready/error, nested states).</li>\n<li>ER: Database/logical data model with cardinalities.</li>\n<li>Journey: User experience across steps/sections (great for PRD acceptance flows).</li>\n<li>Gantt: Scheduling, releases, and dependencies by dates.</li>\n<li>Pie: Simple composition/ratios; prefer tables when precision matters.</li>\n<li>Quadrant (fallback): Prioritization matrix (Impact/Effort) without experimental chart support.</li>\n<li>Requirement (fallback): Traceability between requirements, tests, and system elements.</li>\n<li>Sankey (fallback): Convey relative volumes along a path when <code>sankey</code> is unavailable.</li>\n<li>Git graph (fallback): Small branch/merge DAGs when <code>gitGraph</code> is unavailable.</li>\n</ul>\n<h2>Troubleshooting</h2>\n<ul>\n<li>If a diagram fails to render, try:\n<ol>\n<li>Replace <code>flowchart</code> with <code>graph</code> and simplify shapes.</li>\n<li>Quote node texts.</li>\n<li>Test in <code>https://mermaid.live</code> to isolate environment issues.</li>\n<li>Fall back to the templates above for maximum compatibility.</li>\n</ol>\n</li>\n</ul>\n","files":[{"path":"evals/evals.json","sizeBytes":3416,"isText":true},{"path":"SKILL.md","sizeBytes":6564,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-08-28T19:24:51.815573Z","sha256":"0D60831958C537E50B6A7AEF782F79F1E96ABCF1D617FA157F756262AB6B2FE7","sizeBytes":4467},"review":null,"source":{"repositoryUrl":"https://github.com/Desko77/claude-code-skills-1c","path":"skills/mermaid-diagrams","license":"MIT","commit":"3accdd9a57aca1aabbe49a892a932df403ad5059","subtreeSha":"339072DE4443BA3561EB0E45B0376BF0C87094C81B2157D4A8ECA47992E151D9","lastSyncedAt":"2026-09-27T20:54:37.190964Z"},"reviewedAt":"2026-08-28T19:29:41.591005Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/Desko77/claude-code-skills-1c/tree/main/skills/mermaid-diagrams"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install desko77-claude-code-skills-1c@llmmart"},{"target":"git","command":"git clone https://github.com/Desko77/claude-code-skills-1c.git"}]}