MCP HubMCP Hub
スキル一覧に戻る

creating-mermaid-flowcharts

majiayu000
更新日 Yesterday
27 閲覧
58
9
58
GitHubで表示
メタaidata

について

このスキルは、開発者がMermaidフローチャート構文の作成とデバッグを支援し、解析エラーを防ぐためのノード形状、接続、スタイル設定に関するガードレールを提供します。特に、最新の構文を使用したObsidian互換ダイアグラムの作成に特化しています。フローチャートの記述や編集、他形式からの変換、構文問題のトラブルシューティングの際にご利用ください。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/majiayu000/claude-skill-registry
Git クローン代替
git clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/creating-mermaid-flowcharts

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

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.

GitHub リポジトリ

majiayu000/claude-skill-registry
パス: skills/creating-mermaid-flowcharts

関連スキル

content-collections

メタ

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

スキルを見る

evaluating-llms-harness

テスト

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

スキルを見る

sglang

メタ

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

スキルを見る

polymarket

メタ

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

スキルを見る