skills/image-optimization/SKILL.md
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, CDN delivery, Sirv/Cloudinary/imgix/Vercel/Cloudflare image pipelines, format conversion, compression, alt text, product media, Sirv Media Viewer galleries/zoom/spins/videos, or image-heavy frontend code. Covers AVIF, WebP, JPEG, PNG, GIF, SVG, HEIC, JPEG XL, HDR/wide gamut, quality settings, placeholders, image audits, Sirv dynamic imaging/API/viewer workflows, and implementation verification.
npx skillsauth add igorvaryvoda/image-optimization-skill image-optimizationInstall 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.
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:
node skills/image-optimization/scripts/audit-images.mjs ./dist/index.html
node skills/image-optimization/scripts/audit-images.mjs --head https://example.com/
node skills/image-optimization/scripts/audit-images.mjs --json https://example.com/ > image-audit.json
The script checks image markup, srcset/sizes, preload hints, likely LCP mistakes, Sirv URL usage, and optional HTTP headers/content length.
| 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. |
| CSS background hero | Consider replacing with semantic <img>/picture; if it must remain CSS, use image-set() 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:
../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 |
sizes="100vw" for images that render in a 33-50vw grid.alt text, filename, CDN metadata, and visible captions as interchangeable.development
Sirv Media Viewer guidance. Use when building, auditing, or debugging Sirv product galleries, zoom viewers, 360 spins, videos, YouTube/Vimeo embeds, 3D models, PDF galleries, smart .view galleries, thumbnails, fullscreen/mobile behavior, SMV class="Sirv" markup, data-src/data-options/data-breakpoints, Sirv JS loading, viewer API/events, CSP, accessibility, or Core Web Vitals for Sirv interactive media.
development
Sirv dynamic imaging URL API for on-the-fly image transformation. Use when building image URLs with Sirv CDN, resizing images via URL parameters, adding watermarks/text overlays, cropping, applying filters, format conversion (WebP, AVIF), or any Sirv URL-based image manipulation. Covers 100+ URL parameters for scaling, cropping, effects, text, watermarks, frames, and optimization.
development
Sirv REST API integration for image and file management. Use when working with Sirv CDN, uploading/downloading files to Sirv, managing image metadata, searching files, creating 360 spins, converting videos, or any Sirv API operations. Covers authentication, file operations, metadata, search queries, async jobs, and account management.
tools
Guide for using Sirv AI Studio (www.sirv.studio), an AI-powered image and video processing platform. Use when working with product images, background removal, image upscaling, AI generation, video creation, batch processing, or e-commerce image workflows. Triggers on mentions of Sirv AI Studio, product photography, background removal, image upscaling, AI image generation, batch image processing, or marketplace optimization. IMPORTANT - If sirv-ai MCP tools are available (sirv_remove_background, sirv_upscale, sirv_generate, etc.), USE THEM directly for image processing tasks instead of telling user to visit the website.