img-optimize
Skill1 starsChanged 5 months agoApache-2.0View on GitHub
Batch web-optimize images into a new directory with a before/after size report (e.g. /img-optimize assets/*.png for the web)
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- imagemagickSkill
- img-compareSkill
- imgSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Never optimize in place: Write to an optimized/ directory (create it first) or a user-specified destination, preserving filenames.
- Distinctive: line 16
Default strategy, unless the user specified a format:
- Very specific: line 19
Keep-format requests → JPEG: -strip -interlace Plane -sampling-factor 4:2:0 -quality 85.
- Very specific: line 26
Verify every output opens (magick identify optimized/*) and spot-check the largest one visually with Read if quality was reduced.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/img-optimize — batch web optimization with a size report
The user wants images optimized: $ARGUMENTS
Instructions
- Consult the
imagemagickskill — especiallyreferences/formats.md(encoder choices) andreferences/recipes.md(web-optimization stanzas). Resolve the inputs with Glob; runmagick identifyover them to see formats, dimensions, and alpha before choosing a strategy. - Never optimize in place. Write to an
optimized/directory (create it first) or a user-specified destination, preserving filenames. - Default strategy, unless the user specified a format:
- Photographic JPEG/PNG without alpha → WebP:
magick in -quality 80 out.webp - PNG with alpha (UI, logos) → lossless WebP:
-define webp:lossless=true - Keep-format requests → JPEG:
-strip -interlace Plane -sampling-factor 4:2:0 -quality 85; PNG:png8:only when the color count allows it without visible banding - Cap oversized dimensions only if the user mentioned a display size:
-resize '1600x1600>'(quote the>)
- Photographic JPEG/PNG without alpha → WebP:
- Iterate with a shell loop (not
mogrify), collecting sizes:mkdir -p optimized for f in *.jpg; do magick "$f" -strip -quality 85 "optimized/${f%.*}.webp"; done - Verify every output opens (
magick identify optimized/*) and spot-check the largest one visually with Read if quality was reduced. - Report a table: per file, before size → after size and percent saved (
du -borstat -c%s), plus a totals row. Flag any file that got bigger (it happens — already-optimized inputs) and recommend keeping the original for those.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

