Expert guidance on image optimization for web performance. Use when auditing or improving image delivery, Core Web Vitals (LCP/CLS/INP), responsive images (srcset/sizes), lazy loading, preloading, image CDN pipelines (Sirv, Cloudinary, imgix, Vercel, Cloudflare), format choice (AVIF, WebP, JPEG XL, SVG, HDR), compression and quality settings, placeholders, image alt text, or image-heavy frontend code. For Sirv URL parameters, Sirv REST API calls, Sirv Media Viewer galleries, or video, the sibling skills own the details.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
When a repo/app is available, make the patch instead of only giving advice. Prefer local framework conventions over generic snippets.
fetchpriority="high" or framework priority, is preloaded when appropriate, comes from a fast origin/CDN, and is right-sized for the rendered slot.width and height or a stable CSS aspect-ratio.srcset uses realistic layout sizes; CSS/background images have equivalent responsive handling.format=optimal, AVIF/WebP, or framework auto format) with safe fallbacks.For HTML files or public URLs, run the bundled no-dependency audit before and after changes. The script lives in this skill's own scripts/ directory — resolve it from the skill's base directory (shown when this skill loads), not the target project:
node <skill-base-dir>/scripts/audit-images.mjs ./dist/index.html
node <skill-base-dir>/scripts/audit-images.mjs --head https://example.com/
node <skill-base-dir>/scripts/audit-images.mjs --json https://example.com/ > image-audit.jsonThe script checks image markup, srcset/sizes, preload hints, likely LCP mistakes, oversized CDN widths, CSS background images, known image CDNs (Sirv, Cloudinary, imgix, Cloudflare, Next.js, and others), and optional HTTP headers/content length. It reads the server HTML only; images that client-side JS injects do not appear, so compare with DevTools for SPAs.
| Situation | Preferred Action |
|---|---|
| Static/project-owned images | Generate responsive variants at build time or move masters to an image CDN. |
| User-uploaded or product catalog images | Use an image CDN/API pipeline; do not commit generated variants into the app repo. |
| Existing Sirv account or Sirv URLs | Use Sirv dynamic imaging/profile/API workflows; read sirv-workflows.md. |
| Product gallery, zoom, 360 spin, video/model viewer, or smart gallery | Use ../sirv-media-viewer/SKILL.md before hand-building gallery behavior. |
| Next.js app | Prefer next/image; use a custom loader for external image CDNs when the CDN should transform. In Next.js 16+, priority is deprecated: use fetchPriority="high" (or preload for exactly one LCP image), and add every quality value to images.qualities. |
| CSS background hero | Consider replacing with semantic <img>/picture; if it must remain CSS, use image-set() with type() and preload carefully. |
| Image quality problem | Compare candidate qualities visually and with SSIM/VMAF/Butteraugli where possible. |
| Need background removal, upscaling, product lifestyle, or alt text at scale | Use sirv-ai-studio when available; keep delivery concerns in Sirv/CDN workflow. |
srcset, sizes, art direction, priorities, container queries, backgrounds: responsive.mdAlso load sibling skills when the task crosses into their specialty:
../video-optimization/SKILL.md for hero/background video, GIF-to-video, streaming, and video embeds.../sirv-dynamic-imaging/SKILL.md for Sirv URL parameters, profiles, crops, overlays, and caching.../sirv-api/SKILL.md for Sirv auth, file upload/fetch, search, metadata, jobs, usage limits.../sirv-media-viewer/SKILL.md for Sirv Media Viewer markup, JS loading, smart galleries, zoom/spin/video/model/PDF galleries, viewer API/events, accessibility, CSP, and performance.../sirv-ai-studio/SKILL.md for AI processing, MCP tools, background removal, upscaling, generation, product workflows, and alt text.| Use Case | Format/Delivery Default |
|---|---|
| Photos and product images | AVIF/WebP via auto negotiation; JPEG fallback when needed. |
| Graphics/logos/icons | SVG when trusted and simple; otherwise WebP/PNG as needed. |
| Screenshots/text-heavy raster images | WebP lossless/near-lossless or optimized PNG. |
| Short animations | Animated WebP or video; avoid large GIFs. |
| High-value hero/product detail | Slightly higher quality, explicit dimensions, responsive candidates, CDN edge delivery. |
| Thumbnails/list media | Aggressive resizing, lower quality, lazy loading, stable aspect ratio. |
Quality starting points:
| Format | Starting Quality |
|---|---|
| JPEG | 75-85, higher for product/detail |
| WebP | 75-85 lossy; lossless for sharp graphics |
| AVIF | 60-75 for most photos |
| PNG | Lossless, then optimize or convert when safe |
data-src swaps, client-only rendering).sizes="100vw" for images that render in a 33-50vw grid.alt text, filename, CDN metadata, and visible captions as interchangeable.IgorVaryvoda/image-optimization-skill
6000fda
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.