Skip to content

Mermaid Validation

FieldValue
TypeSkill Resource
Source~/.copilot/skills/technical-writing/references/mermaid/validation.md
DescriptionNot specified

Source Content

Mermaid Validation

Lint Workflow

For a Markdown or MDX file:

Terminal window
python3 ~/.copilot/skills/technical-writing/scripts/mermaid_lint.py /path/to/file.md

For an isolated diagram, write a temp file first:

Terminal window
cat > /tmp/diagram.mmd << 'EOF'
flowchart TD
A["Start"] --> B{"Done?"}
EOF
python3 ~/.copilot/skills/technical-writing/scripts/mermaid_lint.py /tmp/diagram.mmd

Exit 0 is clean. Exit 1 means errors were found. Fix every error and re-run. If mmdc is installed, the script also runs Mermaid CLI validation.

Common Errors

WrongCorrectWhy
graph TDflowchart TDgraph is legacy
A->BA --> BSingle dash is not a flowchart arrow
A[label: text]A["label: text"]Punctuation needs quoting
stateDiagramstateDiagram-v2v1 is deprecated
A->>B in flowchartA --> BWrong arrow family
Node ID endEndStateend is reserved
Bare < in label&lt; or quoted textBreaks renderers
classDef in beautiful-mermaid flowchartstyle Node ...Avoid stray visible class node

Final Self-Rubric

  • Pre-generation checklist completed.
  • Diagram starts with the person/actor when a person drives the flow.
  • Roles are visible early enough to answer “where am I?” quickly.
  • Role labels use canonical names.
  • Diagram answers one reader question.
  • Layout is balanced and print-safe.
  • Labels are short and concrete.
  • No reserved words are used as node IDs.
  • Every block opener has a matching end.
  • Special-character labels are quoted.
  • beautiful-mermaid flowcharts use style, not classDef / class.
  • Linter exits 0.