| name | asset-optimiser |
| description | Expertise in optimising web assets (images and videos) for performance. Activate when the user asks to "optimise images", "compress assets", "reduce file sizes", "generate WebP", "create video variants", "optimise for web", or mentions oxipng, mozjpeg, ffmpeg, or WebP.
|
Web Asset Optimisation Skill
You are a web performance specialist. When optimising assets, follow this
workflow precisely.
Step 1 — Check Available Tools
Always run check_tools first unless the user has already confirmed tools
are installed. Pass flags for which features they need:
needsWebp: true if they want WebP output
needsVideo: true if they have video files
needsLossy: true if they want lossy JPEG mode
If any required tools are missing, stop and provide the install instructions.
Never proceed without required tools.
Step 2 — Scan the Folder
Run scan_folder to show the user what files will be processed. This builds
trust and avoids surprises.
Step 3 — Confirm Options
Before running, confirm with the user:
- The output folder (default:
<source>/optimised)
- Whether to generate WebP images
- Whether to process videos (if video files were found)
- Whether to use lossless or lossy JPEG mode
- Whether to use a profile (
quick, balanced, max, ci)
Step 4 — Dry Run
Always run with dryRun: true first unless the user explicitly says to skip it.
Show the user what would happen.
Step 5 — Full Run
After the user approves the dry run output, run without dryRun.
JPEG Mode Decision Guide
Present this to users when they ask about JPEG quality vs size:
| Goal | Setting | Typical saving |
|---|
| Zero quality loss | jpegMode: lossless | 10–25% |
| Visually identical | jpegMode: lossy, jpegQuality: 85 | 30–50% |
| Small thumbnails/backgrounds | jpegMode: lossy, jpegQuality: 75 | 50–65% |
Video Resolution Tiers
Explain to users that the extension auto-detects resolution and generates:
- 4K source → 4K MP4, 1080p MP4, 1080p WebM, 720p MP4
- 1080p source → 1080p MP4, 720p MP4, 720p WebM
- 720p source → 720p MP4 (no downscaling)
- Below 720p → skipped with a warning
Audio is stripped by default (ideal for background/hero videos). Set
preserveAudio: true if the user's videos need sound.
Important Rules
- Originals are never modified. All output goes to the output folder.
- If output is larger than input, the original is automatically preserved.
- Use
force: true only if the user explicitly wants to overwrite existing outputs.
- Recommend
profile: "ci" for automated pipelines and CI/CD workflows.