compression-runtime
FreeRuns bundled scriptsNot checkedCompress or convert generated images for delivery, preview, and social upload. Use when the user asks to compress an image, optimize image size, convert to…
by onfire7777★ 17 GitHub starsAbout this skill
Bundled Compression Runtime
Compress or convert generated images for delivery, preview, and social upload. Optimize image size, convert to webp, or reduce file size after generation.
This skill uses the best available local toolchain and stays self-contained.
Script:
scripts/main.ts
Use Cases
- files are too large to share easily
- output needs to be converted to
webp - a lighter preview image is needed
- images should be optimized before social upload
Example Prompts
Compress my cover image to webp for social uploadOptimize all images in the output directory to reduce file sizeConvert this PNG to a lighter webp format at quality 80
Important: at least one of cwebp, magick, or sips must be available locally.
Backend Preference
Preferred order:
cwebpfor WebP outputmagickorconvertfor conversion and flexible processingsipsas a macOS-native fallback
CLI
${BUN_X} {baseDir}/scripts/main.ts <input> [options]
Options
| Option | Description |
|---|---|
<input> |
input file or directory |
--output, -o |
output file or directory |
--format, -f |
webp, png, or jpeg (default: webp) |
--quality, -q |
quality 0-100 (default: 80) |
--keep, -k |
keep the original when the output extension matches the input |
--recursive, -r |
process directories recursively |
--json |
return JSON output |
Common Examples
Single image to WebP:
${BUN_X} {baseDir}/scripts/main.ts input.png -f webp -q 80
Single image to JPEG:
${BUN_X} {baseDir}/scripts/main.ts input.png -f jpeg -q 82
Recursive directory compression:
${BUN_X} {baseDir}/scripts/main.ts ./images -r -f webp
JSON output:
${BUN_X} {baseDir}/scripts/main.ts input.png --json
Workflow
- Identify the input: a single image file or a directory of images.
- Choose the target format (
webp,png, orjpeg) and quality level. - Run the CLI with the chosen options.
- Verify the output exists and is smaller than the input.
- If processing a directory, use
--recursiveto handle nested folders.
Output Convention
Recommended behavior:
- keep the original image untouched
- write the compressed result under a new name
- store results in the same directory or in a
compressed/subdirectory
Example:
cover-image/topic-slug/
├── cover.png
└── compressed/
└── cover.webp
Re-run Behavior
- Re-compressing the same input produces a new output file (or overwrites an existing one at the same path).
- The original input is never modified unless
--keepis used and the output extension matches the input. --recursivere-processes all matching files in the directory, including previously compressed ones.- To avoid double-compression, point
--outputto a separatecompressed/subdirectory.
Definition of Done
- The compressed output file exists and is smaller than the input.
- The original file is preserved (not overwritten) unless
--keepis used with matching extensions. - Output format matches the requested
--format. --jsonmode produces a valid JSON summary with input size, output size, and compression ratio.
Current Behavior
- prefers
cwebp->magick/convert->sips - supports single files and directories
- supports recursive scanning
- supports JSON summaries
- does not delete the original just because the format changes; use
--keepwhen the output extension matches the input webpoutput requirescwebpor ImageMagick; if onlysipsis available, preferpngorjpeg
Install compression-runtime in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the compression-runtime skill do?
Compress or convert generated images for delivery, preview, and social upload. Use when the user asks to compress an image, optimize image size, convert to webp, or reduce file size after generation.
How do I install the compression-runtime skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the compression-runtime skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic