Automated summary
This skill checks and fixes the syntax of Mermaid diagrams embedded in Markdown files to prevent parse errors when generating documentation.
Strengths
- Covers the four most common diagram types — C4, sequence, flowchart and ER — each with a syntax cheat sheet.
- Ships a catalogue of frequent errors paired with the exact fix (C4 title, sequence arrows, subgraph indentation, ER relationships).
- Includes an automated validation path via mermaid-cli plus a GitHub Actions example that runs on pull requests.
- States explicit auto-fix rules: indentation normalization, quote insertion, and arrow notation unification.
Limitations
- Manual checking relies on grep and visual inspection rather than a real parser built into the skill.
- The CI snippet runs mmdc against whole Markdown files, which can be unreliable or fail depending on the tool version.
- Does not cover other Mermaid diagram types (Gantt, state, class, pie) or themes and configuration options.
Use it when Mermaid diagrams in your docs throw parse errors, or as a pre-PR check on Markdown files containing diagrams.
Skip it if you need a complete programmatic validator for every Mermaid diagram type, or if the project does not use Mermaid.
Security analysis
CautionThe skill relies on Bash for legitimate Mermaid diagram validation using standard tooling. The commands are non-destructive and scoped to documentation files, but they do involve network package installation and shell execution, warranting a caution rating rather than completely safe.
- •Uses Bash to run npm install and mermaid-cli, which involves network downloads and global package installation.
- •Includes a complex shell one-liner with find -exec sh -c for CI validation, though it is not inherently destructive.
Examples
docs/design/architecture.md の C4Context 図がレンダリング時にパースエラーになります。構文を検証して修正してください。docs/ 配下の Markdown ファイルに含まれる Mermaid 図をすべて検証し、未閉じの括弧や不正な矢印記法があれば修正して差分を教えてください。GitHub Actions で PR 時に Mermaid 図の構文を検証するワークフローを追加してください。mermaid-cli を使ってください。name: mermaid-validator description: | Mermaid図の構文検証と修正を行うスキル。 architecture.md生成時のパースエラーを防止。 allowed-tools: Bash, Read, Grep, Glob, WebFetch, Edit, Write
Mermaid Validator スキル
目的
Mermaid図の構文エラーを検出し、自動修正を行うことで、ドキュメント生成時のパースエラーを防止する。
対象ファイル
自動検証対象
docs/**/architecture.mddocs/**/design.mddocs/**/sequence.md*.md(Mermaid図を含むすべてのMarkdownファイル)
主な検証ポイント
-
構文エラー検出
- 未閉じの括弧、引用符
- 無効なキーワード
- インデントの問題
-
C4モデル構文検証
C4Context,C4Container,C4Componentの正しい使用Person(),System(),Rel()の引数チェック
-
シーケンス図検証
participant宣言の確認- 矢印記法(
->>,-->>,->>)の正しい使用
-
グラフ構文検証
- ノード定義の正しい記法
- サブグラフの構文チェック
Mermaid構文クイックリファレンス
C4モデル
C4Context
title System Context Diagram
Person(user, "User", "エンドユーザー")
System(system, "System Name", "システム説明")
System_Ext(external, "External System", "外部システム")
Rel(user, system, "Uses", "HTTPS")
Rel(system, external, "Integrates", "REST/HTTPS")
注意点:
C4Contextの後に改行が必要titleは必須ではないが推奨Rel()の引数は必ず4つ(from, to, label, technology)
シーケンス図
sequenceDiagram
participant User
participant Frontend
participant Backend
User->>Frontend: リクエスト
Frontend->>Backend: API呼び出し
Backend-->>Frontend: レスポンス
Frontend-->>User: 表示
注意点:
participant宣言は必須ではないが推奨->>(同期)、-->>(非同期)、-x(破棄)を区別- ラベルに日本語を含む場合、引用符は不要
グラフ(フローチャート)
graph TB
A[クライアント] --> B[APIゲートウェイ]
B --> C[バックエンドサービス]
C --> D[データベース]
C --> E[外部API]
注意点:
graph TB(上から下)、graph LR(左から右)- ノードラベルに日本語を含む場合、
[]で囲む subgraphはインデント必須
ER図
erDiagram
USER ||--o{ ORDER : places
USER {
string id
string name
string email
}
ORDER {
string id
string userId
date createdAt
}
注意点:
- リレーションシップ記法:
||--o{(1対多)、}o--o{(多対多) - フィールド定義は
type nameの順
検証方法
オンライン検証(推奨)
# Mermaid Live Editorで検証
# https://mermaid.live/
# または、mermaid-cliを使用
npx @mermaid-js/mermaid-cli mmdc -i diagram.mmd -o diagram.svg
手動検証
# Markdownファイル内のMermaid図を抽出
grep -A 50 '```mermaid' architecture.md > extracted-diagrams.txt
# 構文エラーを目視確認
cat extracted-diagrams.txt
よくある構文エラーと修正方法
エラー1: C4モデルでタイトルが不正
誤り:
C4Context
title: System Context Diagram
修正:
C4Context
title System Context Diagram
エラー2: シーケンス図で矢印記法が不正
誤り:
sequenceDiagram
User->Frontend: リクエスト
修正:
sequenceDiagram
User->>Frontend: リクエスト
エラー3: グラフでサブグラフのインデント不足
誤り:
graph TB
subgraph "Production"
A[Pod 1]
end
修正:
graph TB
subgraph "Production"
A[Pod 1]
end
エラー4: ER図でリレーションシップ記法が不正
誤り:
erDiagram
USER -> ORDER : places
修正:
erDiagram
USER ||--o{ ORDER : places
自動修正ルール
ルール1: インデント正規化
- C4モデルの要素をインデント
- サブグラフをインデント
- ERDのフィールド定義をインデント
ルール2: 引用符の補完
- 特殊文字を含むラベルに引用符を追加
- ただし、日本語のみの場合は不要
ルール3: 矢印記法の統一
- シーケンス図で
->>に統一(同期呼び出し) - 非同期の場合は
-->>を使用
CI/CDへの組み込み
GitHub Actions 例
name: Mermaid Validation
on:
pull_request:
paths:
- 'docs/**/*.md'
- '**/*.md'
jobs:
validate-mermaid:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Validate Mermaid Diagrams
run: |
npm install -g @mermaid-js/mermaid-cli
find . -name "*.md" -exec sh -c '
grep -l "```mermaid" "$1" && {
echo "Validating $1"
mmdc -i "$1" -o /tmp/test.svg || exit 1
}
' _ {} \;
参考資料
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/mermaid-validator-mmlj2nwz' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/mermaid-validator-mmlj2nwz/download' --output '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md.part' && mv '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md.part' '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Bash, Read, Grep, Glob, WebFetch, Edit, Write
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md' && test -s '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/mermaid-validator' && cp -R '.skill-downloads/mermaid-validator-mmlj2nwz' '.claude/skills/mermaid-validator'Cursor
test -f '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md' && test -s '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/mermaid-validator' && cp -R '.skill-downloads/mermaid-validator-mmlj2nwz' '.cursor/skills/mermaid-validator'Codex
test -f '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md' && test -s '.skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/mermaid-validator' && cp -R '.skill-downloads/mermaid-validator-mmlj2nwz' '.agents/skills/mermaid-validator'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/mermaid-validator-mmlj2nwz'openskills read 'mermaid-validator-mmlj2nwz'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/mermaid-validator-mmlj2nwz/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Supabase Docs Authoring
Documentation
Write, edit, and review Supabase documentation content including guides, tutorials, reference docs, and partials. Follow style guides and MDX/TOML validation rules.
Create Architecture Decision Record
Documentation
Create a new Architecture Decision Record with sequential numbering, register it in the AgentDB graph, and link related ADRs.
Plan update with deep research
Documentation
Updates a plan document by launching parallel subagents to analyze a topic across all compiler passes, then consolidates findings into the plan doc.