zero2Agent: Skill for Claude Code

.agents/skills/mermaid-check/SKILL.md

mermaid-check is a skill for Claude Code, Codex from ranxi2001/zero2Agent. It costs 83 tokens per session (2,456 once invoked), scanned B, original, MIT.

A checker for Mermaid diagrams, which are text descriptions of flowcharts and other diagrams. It focuses on Mermaid 9.4.3 diagrams in the zero2Agent project and can help fix syntax errors that stop them rendering.

In plain words
What is it for?
Use it to check flowcharts and other Mermaid blocks, investigate rendering failures, and validate diagram syntax with the Mermaid command-line tool.
Why use it?
It helps find why a diagram shows an error or fails to appear in a page. It also explains how the project converts HTML-escaped diagram text before Mermaid parses it.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is ranxi2001/zero2Agent's own configuration. It tells Claude Code and Codex how to work on zero2Agent itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything zero2Agent configures →

About the project

zero2Agent is a tutorial repository that teaches software developers how to build AI agents, covering core concepts, model APIs, tools, memory, frameworks, implementation, and complete projects. It is intended for programmers learning agent engineering and for candidates preparing for agent-related technical interviews.

ranxi2001/zero2Agent · 1,026 stars · on GitHub · onefly.top

Reuse

Borrowing it

Nothing to install: this file belongs to ranxi2001/zero2Agent. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ranxi2001/zero2Agent/main/.agents/skills/mermaid-check/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ranxi2001/zero2Agent

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mermaid-check

README.md
[![agentmods](https://agentmods.dev/badge/skills/ranxi2001/zero2agent/mermaid-check/github.svg)](https://agentmods.dev/skills/ranxi2001/zero2agent/mermaid-check)
Your own site
<a href="https://agentmods.dev/skills/ranxi2001/zero2agent/mermaid-check"><img src="https://agentmods.dev/badge/skills/ranxi2001/zero2agent/mermaid-check/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mermaid-check

Your own site · 80×15
<a href="https://agentmods.dev/skills/ranxi2001/zero2agent/mermaid-check"><img src="https://agentmods.dev/badge/skills/ranxi2001/zero2agent/mermaid-check.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,456 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Agent Snooping · line 206
    Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
    Fix: Remove all code or instructions that access agent configuration directories (.claude/, .codex/, .gemini/). If configuration values are needed, pass them explicitly as parameters or environment variabl
  • medium MCP Rug Pull · line 58
    npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
    Fix: Pin the version: npx @scope/[email protected]
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00083 $0.02456
Opus 5.5 $0.00033 $0.00982
Sonnet 5.5 $0.00017 $0.00491
Haiku 4.5 $0.00008 $0.00246

Measured 2mo ago against content hash c8c17930c718, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

mermaid-check scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

grep -rn '```mermaid' --include="*.md" . | grep -v ".claude/"

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(
.agents/skills/mermaid-check/SKILL.md · 244 lines

How it starts

The opening of the file, as written. The whole thing — 244 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Mermaid 语法检查与修复

本项目使用 mermaid 9.4.3(CDN 加载),配置 htmlLabels: false,securityLevel: 'loose'。 图表写在 ```mermaid 代码围栏中,由 _layouts/default.html 中的 JS 转换后渲染。


渲染管线原理

```mermaid 代码围栏
  ↓ kramdown 渲染
<div class="language-mermaid"><code>原始文本(HTML 实体转义)</code></div>
  ↓ 项目 JS(default.html)
code.textContent → 原始 mermaid 文本(含 <br>、-->、| 等)
  ↓ srcToInnerHTML() 转换
innerHTML: 转义 < > & 但保留 <br/> 为真实 HTML 标签
  ↓ mermaid.init()
读取 innerHTML → entityDecode() → 解析器

关键函数 srcToInnerHTML

function srcToInnerHTML(src) {
    return src
        .replace(/&/g, '&amp;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
        .replace(/&lt;br\s*\/?&gt;/gi, '<br/>');
}

原理:先将所有 HTML 特殊字符转义,再把 <br> 从实体还原为真实标签。 mermaid 的 entityDecode 通过 escape()/unescape() 能正确处理:

  • --&gt; → 解码回 -->
  • <br/> (真实标签) → escape 变为 %3Cbr/%3E → unescape 变回 <br/>
  • | → escape 变为 %7C → unescape 变回 |

使用 Node.js 验证 mermaid 语法

安装 mermaid CLI:

npm install -g @mermaid-js/mermaid-cli

验证单个图表:

echo 'flowchart LR
    A[text] -->|label| B' > /tmp/test.mmd
npx mmdc -i /tmp/test.mmd -o /tmp/test.svg 2>&1

批量验证项目中所有 mermaid 块:

python3 << 'EOF'
import re, os, subprocess, tempfile

base = os.getcwd()
errors = []
for root, dirs, files in os.walk(base):
    dirs[:] = [d for d in dirs if d not in ['.git', '.claude', 'node_modules']]
    for f in files:
        if not f.endswith('.md'): continue
        path = os.path.join(root, f)
        with open(path) as fh:
            content = fh.read()
        for m in re.finditer(r'```mermaid\n(.*?)\n```', content, re.DOTALL):
            block = m.group(1)
            line = content[:m.start()].count('\n') + 1
            with tempfile.NamedTemporaryFile(suffix='.mmd', mode='w', delete=False) as tmp:
                tmp.write(block)
                tmp_path = tmp.name
            result = subprocess.run(
                ['npx', 'mmdc', '-i', tmp_path, '-o', '/dev/null'],
                capture_output=True, text=True
            )
            os.unlink(tmp_path)
            if result.returncode != 0:
                errors.append((path, line, result.stderr.strip()))

Read the full file on GitHub · 244 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 244 lines · 83 tokens per session scan B c8c17930c718

Subscribe to this mod's changes

mermaid-check is a skill published in the GitHub repository ranxi2001/zero2Agent (1,026 stars, last pushed yesterday), licensed MIT. It adds 83 tokens to every session and 2,456 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it B with 2 findings (reads agent configuration directories, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

mermaid-check compared with skills from other repositories

mermaid-check next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
mermaid-checkranxi2001/zero2AgentSkill1.0kyesterdayMITB83Claude Code, Codex
reproduce-buggoogleapis/mcp-toolboxSkill17kyesterdayApache-2.0A130Claude Code, Codex
fix-failing-testsgoogleapis/mcp-toolboxSkill17kyesterdayApache-2.0A87Claude Code, Codex
triage-issuesgoogleapis/mcp-toolboxSkill17kyesterdayApache-2.0A164Claude Code, Codex
langbot-plugin-devlangbot-app/LangBotSkill19kyesterdayApache-2.0A115Claude Code, Codex
browser-edge-casesaden-hive/hiveSkill11k4d agoApache-2.0A40Claude Code
triage-issueaden-hive/hiveSkill11k4d agoApache-2.0A0Claude Code