visual-diff

visual-diff is a skill for Claude Code from zwolf25/tokenminning. It costs 0 tokens per session (1,043 once invoked), scanned A, original, MIT.

A screenshot comparison tool that checks whether a new image differs from a saved version before an agent views it. It can report no meaningful change or provide only the changed area for inspection.

In plain words
What is it for?
Use it to validate screenshots, slide exports, or interface mockups after edits using pixel-based comparison.
Why use it?
It avoids repeatedly reading unchanged screenshots and limits inspection to relevant parts when an edit changes only a small area.

Skill for Claude Code

Written for Claude Code: PostToolUse hook event. Also seen: reads .claude/ paths; mentions Claude Code.

Good fit Use it to validate screenshots, slide exports, or interface mockups after edits using pixel-based comparison.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zwolf25/tokenminning/visual-diff
Install

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.

Any agent
npx skills add zwolf25/tokenminning --skill visual-diff
Clone the repo
git clone --depth 1 https://github.com/zwolf25/tokenminning

Made for: Claude Code.

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 visual-diff

README.md
[![agentmods](https://agentmods.dev/badge/skills/zwolf25/tokenminning/visual-diff/github.svg)](https://agentmods.dev/skills/zwolf25/tokenminning/visual-diff)
Your own site
<a href="https://agentmods.dev/skills/zwolf25/tokenminning/visual-diff"><img src="https://agentmods.dev/badge/skills/zwolf25/tokenminning/visual-diff/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 visual-diff

Your own site · 80×15
<a href="https://agentmods.dev/skills/zwolf25/tokenminning/visual-diff"><img src="https://agentmods.dev/badge/skills/zwolf25/tokenminning/visual-diff.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,043 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00000 $0.01043
Opus 5 $0.00000 $0.00522
Sonnet 5 $0.00000 $0.00209
Haiku 4.5 $0.00000 $0.00104

Measured 3d ago against content hash 96a6ffba92ed, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-17, from the pricing page.

Security

Grade A, and why

visual-diff 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 3d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (visual-diff.js), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

tools/visual-diff/SKILL.md · 67 lines

How it starts

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

visual-diff

Pixel-diff pre-filter for screenshot validation. Compares a new screenshot against a cached baseline of the same artifact: if nothing meaningfully changed, you never view the image at all (near-zero vision tokens); if something did change, you view a small crop of just the changed region instead of the full screenshot.

Token rule (do not break): on a skip decision, do not Read the screenshot — the JSON result is the answer ("no visual change, X% diff"). On a crop decision, Read only cropPath, never the original full screenshot. On a full decision (first time seeing this artifact), there's no baseline yet to compare against — view the original if you need to, that only happens once per artifact.

Step 1 — Prereq gate

Needs node on PATH plus the global pixelmatch/pngjs packages (npm install -g pixelmatch pngjs, one-time). If missing, install first — don't fall back to viewing the raw screenshot just to avoid the install step, that's the exact token cost this skill exists to avoid.

Step 2 — Run it

node visual-diff.js "<screenshot-path>" --key "<stable-artifact-key>"

Point the path at wherever this tool is installed. <stable-artifact-key> should identify this artifact, not this invocation — e.g. roadmap-deck/slide-04, or a Figma node id. Reuse the same key across repeat checks on the same thing so the cache actually compares against the right prior state.

Optional flags: --threshold <pct> (default 0.5 — % of pixels differing to count as a real change), --pad <px> (default 24 — padding around the changed-pixel bounding box before crop), --max-dim <px> (default 768 — long-edge cap after crop, downsampled if exceeded).

Step 3 — Act on the JSON result

The script always prints one JSON object to stdout:

  • "decision": "skip" — nothing meaningfully changed (diffPercent below threshold). Report this directly to the user ("no visual change, 0.1% diff") without viewing anything.
  • "decision": "crop" — something changed. Read only cropPath (a small PNG of just the changed region + padding), not the original screenshot.
  • "decision": "full" — first time this artifact's been checked, nothing to compare against yet. View the original screenshot if you need to; it becomes the baseline for next time.

Read the full file on GitHub · 67 lines

Files

What ships with it

2 files 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.

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. 3d ago First seen · 67 lines · 0 tokens per session scan A 96a6ffba92ed

Subscribe to this mod's changes

visual-diff is a skill published in the GitHub repository zwolf25/tokenminning (30 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,043 tokens. 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-15.