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/midnightdarling/collate/visual-previewnpx skills add MidnightDarling/collate --skill visual-previewgit clone --depth 1 https://github.com/MidnightDarling/collateWhat 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 | $0.00214 | $0.02540 |
| Opus 5 | $0.00107 | $0.01270 |
| Sonnet 5 | $0.00043 | $0.00508 |
| Haiku 4.5 | $0.00021 | $0.00254 |
Grade A, and why
visual-preview 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 2d 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 — 186 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Visual Preview — 扫描预处理效果可视化
Task
prep-scan 做了一堆看不见的事:擦红蓝馆藏章、去对角线水印、刮掉淡灰重复水印、裁掉页眉页脚。但用户看不到——用户只得到一份 cleaned.pdf 和一句"清理完成"。这个 skill 把每页处理前后的对比直接弹到浏览器里,让用户回答三个问题:
- 擦对了吗:水印 / 馆藏章是不是真的没了
- 擦过头了吗:有没有误伤正文(淡墨古籍最危险)
- 裁合适吗:页眉页脚裁得是不是正好,没切到正文首行
不给用户看等于把清理结果当黑盒交付——下游校对发现误伤已经晚了。
Process
Step 1 — 定位 workspace + prep 目录
路径约定:prep-scan 把图像中间态放在
<workspace>.ocr/prep/{pages,cleaned_pages},本 skill 消费同一份目录。HTML 输出固定落在<workspace>.ocr/previews/visual-prep.html。权威规范见插件的references/workspace-layout.md。
INPUT="$1"
# 用户可能传:
# (a) PDF 路径 ~/Downloads/论文.pdf → 推断 论文.ocr/
# (b) 工作区 ~/Downloads/论文.ocr/ → 直接用
# (c) prep 目录 ~/Downloads/论文.ocr/prep → 取父目录作为工作区
if [ -d "$INPUT" ]; then
case "$INPUT" in
*/prep) OCR="$(dirname "$INPUT")" ;;
*.ocr|*.ocr/) OCR="${INPUT%/}" ;;
*) OCR="$INPUT" ;;
esac
elif [ -f "$INPUT" ] && echo "$INPUT" | grep -qE '\.pdf$'; then
DIR=$(dirname "$INPUT")
BASE=$(basename "$INPUT" .pdf)
OCR="$DIR/$BASE.ocr"
else
echo "找不到工作区或 PDF:$INPUT"; exit 1
fi
PREP="$OCR/prep"
test -d "$PREP/pages" || { echo "缺 $PREP/pages"; exit 2; }
test -d "$PREP/cleaned_pages" || { echo "缺 $PREP/cleaned_pages"; exit 2; }
mkdir -p "$OCR/previews"
Step 2 — 跑脚本
python3 "${CLAUDE_PLUGIN_ROOT}/skills/visual-preview/scripts/visualize_prep.py" \
--prep-dir "$PREP" \
--out "$OCR/previews/visual-prep.html" \
$( [ -n "$SAMPLE" ] && echo "--sample $SAMPLE" ) \
$( [ "$NO_DIFF" = "1" ] && echo "--no-diff" )
Step 3 — 脚本行为规范(visualize_prep.py 必须实现)
3.1 输入收集
<prep-dir>/pages/page_*.png→ 原始页<prep-dir>/cleaned_pages/page_*.png→ 清理后- 两者按文件名配对;任一侧缺失视作该页无效
3.2 差异热图生成
对每一对 (orig, clean):
- 若两图尺寸不同(证明裁边了),把 clean 上下或左右 pad 到 orig 尺寸(白边填充),再做 diff
cv2.absdiff(orig, clean)→ 灰度 → 阈值 > 25 的像素视为"被清理"- 生成叠加热图:原图 + 半透明红色(
[0,0,255]BGR,alpha=0.4)覆盖差异像素 - 保存到
<prep-dir>/diff_pages/page_N.png - 计算清理比例:
(差异像素数 / 总像素数) * 100%
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 2d ago First seen · 186 lines · 214 tokens per session scan A 7c2f7b060f99
visual-preview is a skill published in the GitHub repository MidnightDarling/collate (6 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 214 tokens to every session and 2,540 once invoked, about $0.0011 per session on Opus 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-08-31.
Other skills, from other repositories
markitdown
Convert files, URLs, and documents to Markdown using the markitdown MCP server. Activate when the user asks to convert, extract, or read content from PDFs, Word docs, PowerPoints, spreadsheets, images, audio files, or any URL.
pdf-conversion
Convert PDF documents to well-structured Markdown files. Use when user asks to convert PDFs, extract text from PDFs, or transform PDF documents to markdown format.
xlsx
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify…
pptx
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks.
docx
Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4)…
foundry-hosted-agent-validation
Step-by-step process for validating a Python Foundry hosted agent sample (under python/samples/04-hosting/foundry-hosted-agents/) end to end — running it locally (native runtime and azd ai agent run) and after deploying it to an Azure AI Foundry project with azd. Use this when asked to validate a hosted agent sample.