Borrowing it
Nothing to install: this file belongs to re0wiki/wiki-bot. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/re0wiki/wiki-bot/main/.agents/skills/template-usage-audit/SKILL.mdgit clone --depth 1 https://github.com/re0wiki/wiki-botWrote 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/re0wiki/wiki-bot/template-usage-audit)<a href="https://agentmods.dev/skills/re0wiki/wiki-bot/template-usage-audit"><img src="https://agentmods.dev/badge/skills/re0wiki/wiki-bot/template-usage-audit/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.
<a href="https://agentmods.dev/skills/re0wiki/wiki-bot/template-usage-audit"><img src="https://agentmods.dev/badge/skills/re0wiki/wiki-bot/template-usage-audit.svg" alt="Reviewed on agentmods" width="80" 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.00038 | $0.02128 |
| Opus 5.5 | $0.00015 | $0.00851 |
| Sonnet 5.5 | $0.00008 | $0.00426 |
| Haiku 4.5 | $0.00004 | $0.00213 |
Grade A, and why
template-usage-audit scanned grade A with 0 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 9d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.
零引用模板审计(Fandom 模板删除前检查)
背景:审查 embeddedin() 报告零引用的模板,决定删除还是保留。
2026-07 模板清理实测:32 个候选,全站 11,207 页扫描。
每次盘点的数据与逐模板结论记录在 docs/templates.md,本文是可复用的工作流。
为什么 embeddedin 单独不可信
Fandom 的 templatelinks 曾被认为是「会漏真实使用」,2026-07-28 更正:当时唯一的证据
({{!}} 在 143 个图库页的 #tag:tabber 参数里、embeddedin=0)真实原因是
{{!}} 自 MW 1.24 起是内置 magic word,根本不产生 transclusion——embeddedin=0 是对的,
grep 命中的也只是语法不是调用。同理 {{=}}(1.39 起)。判「语法出现是否真是模板调用」
的最可靠手段是 action=parse&prop=templates:magic word 处理的不会出现在列表里。
(同名模板存在时 magic word 优先,模板是死代码。)
仍真实的 embeddedin 局限:
- 未使用模板里的
<includeonly>调用:死模板体内<includeonly>{{SomeOther}}</includeonly>在自身页面上永不解析,SomeOther显示 0 引用,但源码里依赖存在。
结论:对每个候选名跑全站 wikitext dump + 正则 grep
(\{\{\s*(?:subst\s*:\s*)?Name\s*[|}],首字母不区分大小写)。
注意 grep 命中 ⊇ 真实调用:magic word({{!}}、{{=}} 等)与 includeonly 死代码
都只是语法出现——拿不准时用 action=parse&prop=templates 判定。
grep 的三个坑(2026-07-28 复核实测,曾造成漏判/误判)
- 必须排除模板自身与自身
/doc:模板文档里的示例调用({{StructuredQuote|...}}之类) 会被 grep 算作「使用」——2026-07-26 首轮复核因此把StructuredQuote、未用 Infobox 系、Tocright误判为 used 而漏删,2026-07-28 排除自身后才暴露。 - 重定向别名的用量记在目标上:页面写
{{R}}时按本名 grepAuto ruby是 0, 但embeddedin(Auto ruby)=151——templatelinks 会把经重定向的引用归到目标页。 判「零」要 embeddedin 交叉验证(或 grep 时把所有重定向别名并进模式); 反过来,embeddedin 有的盲区(上节)靠 grep 补。两法都零才算零。 - 别漏命名空间:授权模板(
Fairuse/PD等)只用在 File 页(ns 6), 维护模板可能在 User/Project 页——dump 范围要含 0/2/4/6/8/10/14/828 (本节的旧配方排除 ns 6/7,只适用于当时已知名单,不复用)。
复核脚本:src/tools/recheck_template_usage.py(全命名空间批量 dump + 逐模板 grep,
排除自身/自身子页,输出零引用清单与重定向标注)。
全站 dump 配方(全命名空间,默认限速下 ~11k 页 ~3 分钟)
from pywikibot.data.api import QueryGenerator
for nsid in (0, 2, 4, 6, 8, 10, 14, 828):
for pg in QueryGenerator(site=site, generator="allpages",
gapnamespace=str(nsid), gaplimit="50",
prop="revisions", rvprop="content", rvslots="main"):
text = pg["revisions"][0].get("slots", {}).get("main", {}).get("*", "")
QueryGenerator配 generator 直接产出页面 dict——不要再解result["query"]["pages"](那样静默拿不到东西)。gapnamespace="*"会被拒(badvalue)——显式迭代命名空间 id。- 多页 generator 查询禁止
rvlimit/rvdir=newer(invalidparammix)——省略即可,prop=revisions本来就只返回每页最新版本。(单页查首版本另发simple_request带rvdir=newer, rvlimit=1。)
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.
- 9d ago Changed · +1 lines 38a6304891e1
- 1mo ago First seen · 104 lines · 38 tokens per session scan A d09747164902
template-usage-audit is a skill published in the GitHub repository re0wiki/wiki-bot (5 stars, last pushed 3d ago), licensed MIT. It adds 38 tokens to every session and 2,128 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-22.
template-usage-audit compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| template-usage-auditre0wiki/wiki-bot | Skill | 5 | 3d ago | MIT | A | 38 | Claude Code, Codex |
| schema-explorationlangchain-ai/deepagents | Skill | 31k | yesterday | MIT | A | 57 | Claude Code, Codex |
| matlabK-Dense-AI/scientific-agent-skills | Skill | 56k | 4d ago | MIT | A | 44 | Claude Code |
| mem0-oss-to-platformmem0ai/mem0 | Skill | 68k | 2d ago | Apache-2.0 | A | 217 | Claude Code, Codex |
| mempalace-recallMemPalace/mempalace | Skill | 60k | yesterday | MIT | A | 94 | Claude Code |
| analyze-marketlangchain-ai/deepagents | Skill | 31k | yesterday | MIT | A | 34 | Claude Code, Codex |
| haikuagno-agi/agno | Skill | 43k | yesterday | Apache-2.0 | A | 0 | Claude Code, Codex |