compress-images

compress-images is a skill for Claude Code from rameerez/claude-code-startup-skills. It costs 38 tokens per session (1,120 once invoked), scanned A, original, MIT.

A procedure for compressing website images with cwebp, a tool that converts images to the WebP format. It keeps the original files and updates content references to the converted files.

In plain words
What is it for?
It helps optimize JPG, PNG, and GIF files for web and search-engine performance, including repeated compression until each image is below the stated size target.
Why use it?
It reduces image file sizes so pages can load faster while preserving the source images for recovery.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the startup plugin — 5 skills shipped together

Good fit It helps optimize JPG, PNG, and GIF files for web and search-engine performance, including repeated compression until each image is below the stated size target.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rameerez/claude-code-startup-skills/compress-images
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 rameerez/claude-code-startup-skills --skill compress-images
Clone the repo
git clone --depth 1 https://github.com/rameerez/claude-code-startup-skills

Made for: Claude Code.

Or install startup, the plugin that ships this one along with the rest of its 5 skills.

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 compress-images

README.md
[![agentmods](https://agentmods.dev/badge/skills/rameerez/claude-code-startup-skills/compress-images/github.svg)](https://agentmods.dev/skills/rameerez/claude-code-startup-skills/compress-images)
Your own site
<a href="https://agentmods.dev/skills/rameerez/claude-code-startup-skills/compress-images"><img src="https://agentmods.dev/badge/skills/rameerez/claude-code-startup-skills/compress-images/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 compress-images

Your own site · 80×15
<a href="https://agentmods.dev/skills/rameerez/claude-code-startup-skills/compress-images"><img src="https://agentmods.dev/badge/skills/rameerez/claude-code-startup-skills/compress-images.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,120 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.00038 $0.01120
Opus 5 $0.00019 $0.00560
Sonnet 5 $0.00008 $0.00224
Haiku 4.5 $0.00004 $0.00112

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

Security

Grade A, and why

compress-images 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 10d 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.

skills/compress-images/SKILL.md · 88 lines

How it starts

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

Image Compression Skill

Compress all images in $ARGUMENTS (or app/assets/images/content/ if no path provided) to WebP format, optimized for SEO performance (target: under 100KB per image).

Process

  1. Create originals folder - Create originals/ subfolder inside the target directory and move source files there. Never destroy source files.
  2. Compress each image (JPG, PNG, GIF) from originals/ to the parent directory as .webp
  3. Iterate until all images are under 100KB - check sizes after each pass, re-compress any that exceed the target
  4. Report results with before/after sizes
  5. Update references in content files from old extensions to .webp

File Structure

target-directory/
├── originals/           # High-quality source files preserved here
│   ├── hero.jpg
│   └── feature.png
├── hero.webp            # Compressed, web-optimized
└── feature.webp

Iterative Compression Algorithm

IMPORTANT: Keep compressing until ALL images are under 100KB. Check sizes after each pass and re-compress any that exceed the target.

Step 1: Initial pass (q 70)

cwebp -q 70 -resize 1200 0 originals/image.jpg -o image.webp
ls -lh image.webp  # Check size

Step 2: If still over 100KB, reduce quality progressively

# Try these in order until under 100KB:
cwebp -q 60 -resize 1200 0 originals/image.jpg -o image.webp
cwebp -q 50 -resize 1200 0 originals/image.jpg -o image.webp
cwebp -q 45 -resize 1200 0 originals/image.jpg -o image.webp
cwebp -q 40 -resize 1200 0 originals/image.jpg -o image.webp
cwebp -q 35 -resize 1200 0 originals/image.jpg -o image.webp

Step 3: For stubborn images, also reduce dimensions

# If q 35 at 1200px is still over 100KB, reduce to 1000px:
cwebp -q 30 -resize 1000 0 originals/image.jpg -o image.webp
cwebp -q 25 -resize 1000 0 originals/image.jpg -o image.webp

Real-World Results (Reference)

From actual compression run on content images:

Image Original First Try Final Settings Used
waves.jpg 198KB 33KB 33KB q 70, 1200px (1 pass)
calendar.jpg 246KB 42KB 42KB q 70, 1200px (1 pass)
floating.jpg 230KB 43KB 43KB q 70, 1200px (1 pass)
cash.jpg 409KB 88KB 88KB q 70, 1200px (1 pass)
knot.jpg 395KB 96KB 96KB q 70, 1200px (1 pass)
floating-dark.jpg 414KB 94KB 94KB q 70, 1200px (1 pass)
keyboard2.jpg 459KB 102KB 102KB q 70, 1200px (1 pass, acceptable)
perpetual.jpg 565KB 130KB 96KB q 40, 1200px (3 passes)
keyboard.jpg 718KB 196KB 98KB q 25, 1000px (5 passes)

Read the full file on GitHub · 88 lines

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. 10d ago First seen · 88 lines · 38 tokens per session scan A a990ce4dbb3e

Subscribe to this mod's changes

compress-images is a skill published in the GitHub repository rameerez/claude-code-startup-skills (29 stars, last pushed 6mo ago), licensed MIT. It adds 38 tokens to every session and 1,120 once invoked, about $0.0002 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-30.