Baoyu-skills baoyu-compress-image
Compresses images to WebP (default) or PNG with automatic tool selection. Use when user asks to "compress image", "optimize image", "convert to webp", or reduce image file size.
install
source · Clone the upstream repo
git clone https://github.com/JimLiu/baoyu-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/JimLiu/baoyu-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/baoyu-compress-image" ~/.claude/skills/jimliu-baoyu-skills-baoyu-compress-image && rm -rf "$T"
manifest:
skills/baoyu-compress-image/SKILL.mdsource content
Image Compressor
Compresses images using best available tool (sips → cwebp → ImageMagick → Sharp).
Script Directory
Scripts in
scripts/ subdirectory. {baseDir} = this SKILL.md's directory path. Resolve ${BUN_X} runtime: if bun installed → bun; if npx available → npx -y bun; else suggest installing bun. Replace {baseDir} and ${BUN_X} with actual values.
| Script | Purpose |
|---|---|
| Image compression CLI |
Preferences (EXTEND.md)
Check EXTEND.md in priority order — the first one found wins:
| Priority | Path | Scope |
|---|---|---|
| 1 | | Project |
| 2 | | XDG |
| 3 | | User home |
If none found, use defaults.
EXTEND.md supports: Default format, default quality, keep-original preference.
Usage
${BUN_X} {baseDir}/scripts/main.ts <input> [options]
Options
| Option | Short | Description | Default |
|---|---|---|---|
| File or directory | Required | |
| | Output path | Same path, new ext |
| | webp, png, jpeg | webp |
| | Quality 0-100 | 80 |
| | Keep original | false |
| | Process subdirs | false |
| JSON output | false |
Examples
# Single file → WebP (replaces original) ${BUN_X} {baseDir}/scripts/main.ts image.png # Keep PNG format ${BUN_X} {baseDir}/scripts/main.ts image.png -f png --keep # Directory recursive ${BUN_X} {baseDir}/scripts/main.ts ./images/ -r -q 75 # JSON output ${BUN_X} {baseDir}/scripts/main.ts image.png --json
Output:
image.png → image.webp (245KB → 89KB, 64% reduction)
Extension Support
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.