Serve images at the correct display size

SkillMedia

Responsive-size is a skill for AI agents that reviews image assets, markup, and CDN or build transforms related to serve images at the correct display size. It checks encoded size, rendered size, loading strategy, and above-the-fold impact together, flagging images whose intrinsic width far exceeds their rendered width and propo

Available today. Use it from your connected AI after setup.

Have an agent that can load skills, and a codebase containing image assets and markup to review.

Then ask your AI: use the Serve images at the correct display size skill

What your AI can do with it

  • Audit images in a codebase for oversizing using Lighthouse 'Properly size images' results
  • Compare each image's intrinsic width to its rendered CSS width across common viewports
  • Flag images over 200px wide that lack srcset variants
  • Check whether the sizes attribute reflects the actual CSS layout
  • Generate size variants (400w, 800w, 1200w, 1600w) and write srcset/sizes markup
  • Use <picture> with media attributes for art direction and show before/after HTML

Getting started

  1. Have an agent that can load skills, and a codebase containing image assets and markup to review.
  2. Add the responsive-size skill to the agent's available skills.
  3. Run Lighthouse's 'Properly size images' audit on the site to provide the primary signal.
  4. Ask the agent to audit images for oversizing; it will flag files where intrinsic width exceeds 2x rendered width.
  5. Ask the agent to apply fixes, including generating variants with Sharp or Squoosh and updating srcset and sizes attributes.

What this skill tells your AI

The instructions your AI receives, as published by thedaviddias/front-end-checklist in skills/responsive-size/SKILL.md and read by ahel’s review.

A single oversized hero image can add several megabytes to a page load unnecessarily. On mobile devices with 375px screens, serving a 1600px image downloads 4x the data users need. The 'Properly size images' Lighthouse audit consistently identifies this as one of the highest-impact performance opportunities on most websites.

Quick Reference

  • Serving a 1600px image in a 400px container wastes ~16x the necessary bandwidth
  • Use srcset with width descriptors and sizes with actual layout widths
  • The sizes attribute is critical—without it the browser assumes 100vw and picks the largest image
  • Lighthouse 'Properly size images' audit reports estimated savings per oversized image

Check

Audit images in this codebase for oversizing. Use Lighthouse 'Properly size images' audit results as the primary signal. For each in the HTML: 1) Compare the image file's intrinsic width to the element's rendered CSS width (check CSS rules, container constraints). 2) Flag any image where the intrinsic width is more than 2x the rendered width at any common viewport size. 3) Check for srcset usage—images over 200px wide should have srcset variants. 4) Check sizes attribute accuracy—does it reflect the actual CSS layout?

Fix

For each oversized image: 1) Generate multiple size variants: 400w, 800w, 1200w, 1600w (use Sharp or Squoosh). 2) Add srcset listing each variant with its width descriptor. 3) Add a sizes attribute describing the image's display width at each breakpoint (e.g., sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 400px"). 4) For art direction (different crops), use with media attributes. 5) For the src fallback, use the medium size (800w). Show complete before/after HTML.

Explain

Explain why serving oversized images wastes bandwidth. If a browser renders an image at 400px wide but the image file is 2000px wide, the browser downloads ~25x more pixel data than it can display (bandwidth scales with pixel count, not linear dimensions). The Lighthouse 'Properly size images' audit estimates potential savings in KiB for each oversized image. The sizes attribute is the key to accuracy—without it, the browser assumes 100vw and downloads the largest srcset candidate even on narrow viewports.

Code Review

Review image assets, markup, and delivery configuration related to Serve images at the correct display size. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/en/rules/images/responsive-size

Signals

GitHub stars
74k
Forks
7k
Last commit
Aug 2026

Questions

Why does serving oversized images waste bandwidth?
Bandwidth scales with pixel count, not linear dimensions. A browser rendering an image at 400px wide but downloading a 2000px file fetches roughly 25x more pixel data than it can display.
Why is the sizes attribute critical?
Without a sizes attribute the browser assumes 100vw and picks the largest srcset candidate, even on narrow viewports. An accurate sizes value describing display width at each breakpoint lets the browser choose correctly.
Advanced
Item type
skill
Key
responsive-size
Source
github.com/thedaviddias/front-end-checklist