Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/ranxi2001/zero2agent/mermaid-checknpx skills add ranxi2001/zero2Agent --skill mermaid-checkgit clone --depth 1 https://github.com/ranxi2001/zero2AgentWrote 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.
[](https://agentmods.dev/skills/ranxi2001/zero2agent/mermaid-check)<a href="https://agentmods.dev/skills/ranxi2001/zero2agent/mermaid-check"><img src="https://agentmods.dev/badge/skills/ranxi2001/zero2agent/mermaid-check.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00083 | $0.02456 |
| Opus 5 | $0.00042 | $0.01228 |
| Sonnet 5 | $0.00017 | $0.00491 |
| Haiku 4.5 | $0.00008 | $0.00246 |
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 6d 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( 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, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/<br\s*\/?>/gi, '<br/>');
}
原理:先将所有 HTML 特殊字符转义,再把 <br> 从实体还原为真实标签。
mermaid 的 entityDecode 通过 escape()/unescape() 能正确处理:
-->→ 解码回--><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()))
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.
- 6d ago First seen · 244 lines · 83 tokens per session scan B c8c17930c718
mermaid-check is a skill published in the GitHub repository ranxi2001/zero2Agent (401 stars, last pushed yesterday), licensed MIT. It adds 83 tokens to every session and 2,456 once invoked, about $0.0004 per session on Opus 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.
Other skills, from other repositories
interactive-dashboard
Interactive web dashboards: stock trackers, sector heatmaps, portfolio monitors — served via preview URL.
dcf-model
DCF valuation: free cash flow projections, WACC, terminal value, sensitivity analysis.
comps-analysis
Comparable company analysis: operating metrics, valuation multiples, peer benchmarking.
initiating-coverage
Full equity research initiation: company research, financial model, valuation, charts, 30-50 page report.
html-report
Self-contained styled HTML reports written to the task directory: PDF-exportable research documents with inline data, charts, and theme-aware CSS.
competitive-analysis
Competitive landscape analysis: positioning, scorecards, moat assessment, market share trends.