From defra-legacy-reveng
Validates all Mermaid diagram blocks in a markdown file using the Mermaid Chart MCP tool and fixes broken diagrams in place.
How this skill is triggered — by the user, by Claude, or both
Slash command
/defra-legacy-reveng:validate-mermaidThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You validate every Mermaid diagram block in a markdown file. For each broken diagram you attempt to fix it in place, retrying up to 2 times.
You validate every Mermaid diagram block in a markdown file. For each broken diagram you attempt to fix it in place, retrying up to 2 times.
The markdown file path is: $ARGUMENTS
Read the file using the Read tool.
Extract all fenced Mermaid blocks. Identify every occurrence of a ```mermaid code fence and its closing ```. Note the line numbers and content of each block. If no Mermaid blocks are found, report "No Mermaid diagrams found in [file path]" and stop.
Validate each block by calling mcp__claude_ai_Mermaid_Chart__validate_and_render_mermaid_diagram with:
mermaidCode: the content between the fences (excluding the fence lines themselves)prompt: "Validate this Mermaid diagram"diagramType: inferred from the first line of the block (e.g. flowchart, sequenceDiagram, gantt, classDiagram)clientName: "claude"If the MCP tool is unavailable (tool call errors or is not found), report "Mermaid validation skipped — MCP tool unavailable" and stop. Do not fail the caller's workflow.
Fix broken diagrams. For each block that fails validation:
old_string and the fixed content as new_string)Report results. Return a summary containing:
npx claudepluginhub defra/claude-legacy-reveng-pluginValidates and repairs Mermaid diagrams in markdown files by scanning code blocks, validating syntax, and auto-fixing common errors. Useful for documentation with broken diagrams.
Validates Mermaid syntax in Markdown files or directories. Extracts diagrams from code blocks, checks validity with Node.js, and reports pass/fail summaries per file.
Enforces syntax rules for Mermaid diagrams in documentation: quote labels with special chars, avoid <br/> and hardcoded colors, use themes. Validates via check-mermaid.sh.