03-custom-skills/examples/image-optimize/SKILL.md
Optimize PNG and JPEG images locally using pngquant and mozjpeg/jpegtran — TinyPNG-level compression without API keys.
npx skillsauth add escapeboy/ai-prompts image-optimizeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Compress PNG and JPEG images locally. Achieves 60–80% size reduction with no visible quality loss.
brew install pngquant mozjpeg
Verify:
pngquant --version # 3.0.3+
/opt/homebrew/opt/mozjpeg/bin/jpegtran -version
# Single file, overwrite in place
pngquant --quality=75-90 --speed=1 --force --output image.png image.png
# All PNGs in a directory
for f in /path/to/dir/*.png; do
before=$(stat -f%z "$f")
pngquant --quality=75-90 --speed=1 --force --output "$f" "$f"
after=$(stat -f%z "$f")
pct=$(( (before - after) * 100 / before ))
echo "$f: $(( before/1024 ))KB → $(( after/1024 ))KB (-${pct}%)"
done
| Use case | --quality |
|----------|-------------|
| Blog covers, hero images | 75-90 |
| Product/portfolio (high quality) | 85-95 |
| Thumbnails, icons | 65-80 |
JPEGTRAN=/opt/homebrew/opt/mozjpeg/bin/jpegtran
# Single file
$JPEGTRAN -copy none -optimize -progressive -outfile output.jpg input.jpg
# All JPEGs in a directory, overwrite in place
for f in /path/to/dir/*.jpg /path/to/dir/*.jpeg; do
[ -f "$f" ] || continue
before=$(stat -f%z "$f")
$JPEGTRAN -copy none -optimize -progressive -outfile "$f.tmp" "$f" && mv "$f.tmp" "$f"
after=$(stat -f%z "$f")
pct=$(( (before - after) * 100 / before ))
echo "$f: $(( before/1024 ))KB → $(( after/1024 ))KB (-${pct}%)"
done
#!/bin/bash
# Usage: optimize-images.sh /path/to/dir
DIR="${1:-.}"
JPEGTRAN=/opt/homebrew/opt/mozjpeg/bin/jpegtran
total_before=0; total_after=0
for f in "$DIR"/*.png "$DIR"/*.PNG; do
[ -f "$f" ] || continue
before=$(stat -f%z "$f")
pngquant --quality=75-90 --speed=1 --force --output "$f" "$f"
after=$(stat -f%z "$f")
total_before=$((total_before + before))
total_after=$((total_after + after))
echo "PNG $f: $(( before/1024 ))KB → $(( after/1024 ))KB (-$(( (before-after)*100/before ))%)"
done
for f in "$DIR"/*.jpg "$DIR"/*.jpeg "$DIR"/*.JPG "$DIR"/*.JPEG; do
[ -f "$f" ] || continue
before=$(stat -f%z "$f")
$JPEGTRAN -copy none -optimize -progressive -outfile "$f.tmp" "$f" && mv "$f.tmp" "$f"
after=$(stat -f%z "$f")
total_before=$((total_before + before))
total_after=$((total_after + after))
echo "JPEG $f: $(( before/1024 ))KB → $(( after/1024 ))KB (-$(( (before-after)*100/before ))%)"
done
if [ $total_before -gt 0 ]; then
echo ""
echo "Total: $(( total_before/1024 ))KB → $(( total_after/1024 ))KB (-$(( (total_before-total_after)*100/total_before ))%)"
fi
| Format | Average reduction | |--------|------------------| | PNG (pngquant lossy) | 60–75% | | JPEG (jpegtran lossless) | 5–20% | | JPEG (cjpeg lossy) | 30–60% |
--output equals input — use --force flag.stat -f%z gives file size in bytes (Linux uses stat -c%s).development
Audit or install maximum-depth 1Password integration in the current project — fetches fresh 1Password developer docs first, detects existing integration, and either reviews/improves it or greenfield-installs (Service Account secret resolution + site-compat autocomplete/well-known). Stack-aware (Laravel, Node/Next, Python, Ruby/Rails, Go). Use when the user says "integrate 1Password", "make this site 1Password-friendly", "audit our 1P integration", or invokes /onepassword-integrate.
development
Merges all feature branches into develop, syncs master/main with develop, commits any uncommitted changes, and deletes all feature branches (local and remote). Handles git submodules automatically. Use when you want to clean up branches and leave only develop and master/main in sync.
testing
Three-phase autonomous bug fix — investigate all occurrences, fix with full coverage, validate with regression test. Prevents partial fixes (the
development
This skill should be used when performing legal and regulatory compliance audits on software projects. It covers GDPR, CCPA/CPRA, ePrivacy Directive, HIPAA, PCI DSS, SOC 2, and WCAG 2.2 accessibility. The skill generates a full compliance package: audit report with severity ratings, automatic code fixes, legal document templates (Privacy Policy, Cookie Policy, DPA, DPIA), and data flow diagrams. This skill should be triggered when the user asks to check compliance, audit privacy, generate legal documents, review data handling, or ensure regulatory readiness for any project type (web, mobile, API, desktop).