# Image Optimization

> Audit and fix image delivery for Core Web Vitals: LCP, CLS, srcset/sizes, AVIF/WebP, lazy loading, image CDNs.

Image Optimization is a free AI agent skill on Agensi by Igor Varyvoda, in Frontend & Web Apps. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Igor Varyvoda](https://www.agensi.io/creators/igor-varyvoda)
- Category: [Frontend & Web Apps](https://www.agensi.io/skills/frontend-web-apps)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-19
- Security: scan passed (2026-10-19); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/image-optimization
- Tags: web-design, image, marketing, performance, nextjs, sirv, image-optimization, core-web-vitals

## About this skill

### What it does

Image Optimization gives your agent a working method for image delivery on the web. It inspects the real page first, finds the images that matter (LCP hero, product gallery, thumbnails, CSS backgrounds), and fixes the highest-impact problems before anything cosmetic.

### What it covers

- **Core Web Vitals:** LCP priority (`fetchpriority`, preload, no lazy-loading on the hero), CLS (width/height or aspect-ratio), INP-safe decoding
- **Responsive images:** correct `srcset` + `sizes`, `<picture>` art direction, density vs width descriptors
- **Formats and quality:** AVIF, WebP, JPEG XL, SVG, HDR; quality settings with SSIM/VMAF thresholds
- **Image CDNs:** URL syntax for Sirv, Cloudinary, imgix, Vercel and Cloudflare, plus Next.js 16, Astro, Vite and Eleventy integrations
- **Placeholders and loading:** LQIP, blur-up, BlurHash, lazy loading below the fold
- **Accessibility:** alt text rules for content vs decorative images

### Bundled audit script

`scripts/audit-images.mjs` is a dependency-free Node script. Point it at an HTML file or a URL and it reports lazy-loaded LCP images, missing dimensions, missing `sizes`, oversized CDN widths, CSS backgrounds hidden from the preload scanner, and missing alt text. The agent runs it, then fixes what it finds.

### Requirements

Node.js 18+ for the audit script. No accounts or API keys. Sirv-specific parts are optional.

Source and the other 7 skills in this family (video optimization, Sirv dynamic imaging, Sirv Media Viewer, and more): https://github.com/IgorVaryvoda/image-optimization-skill

## Requires

- Node.js 18+

## Known limitations

Audit script focuses on server HTML; client-side injected images in SPAs may not be detected. Requires Node.js for the bundled audit script.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Image Optimization skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill specifically improve Core Web Vitals like LCP and CLS?

This skill targets the two most common image-related performance issues: Large Contentful Paint (LCP) by optimizing delivery speed, and Cumulative Layout Shift (CLS) by automating aspect-ratio constraints and dimension attributes.

### Can this skill handle both local image processing and external CDN configurations?

Yes, the skill is designed to update components in Next.js, Astro, Vite, and Eleventy, and it includes logic to configure external CDN pipelines like Cloudinary, Sirv, and imgix.

### What is included in this skill?

The SKILL.md workflow, six reference guides (formats, optimization, performance, responsive images, tools, Sirv workflows), and the dependency-free audit script scripts/audit-images.mjs. It is free and MIT-licensed.

### Are there any limitations when using this skill with Single Page Applications (SPAs)?

While it excels with server-rendered and static frameworks, images injected purely via client-side JavaScript in complex SPAs may require manual identification as the audit script primarily scans server-side HTML.

### How does this skill differ from simply asking a standard LLM to compress my images?

It gives the agent a fixed method: inspect the real page, rank images by role (LCP hero, gallery, thumbnail), fix the highest-impact problem first, then re-run the audit script to verify. It covers browser hints such as fetchpriority and sizes that a generic prompt often gets wrong.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
