optimizing-images

Optimizes Next.js and React images for CLS prevention and LCP improvement.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/alexejluft/brudi --skill optimizing-images-alexejluft
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimizing-images
Source: https://github.com/alexejluft/brudi/tree/main/skills/optimizing-images
Command: npx skills add https://github.com/alexejluft/brudi --skill optimizing-images-alexejluft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the common issue of slow website loading times and poor user experience caused by unoptimized images, preventing layout shifts and oversized payloads.

Core Features & Use Cases

  • Prevents CLS: Ensures images have dimensions set to avoid layout shifts.
  • Optimizes LCP: Uses priority for above-the-fold images to improve Largest Contentful Paint.
  • Efficient Formats: Leverages modern formats like AVIF and WebP for smaller file sizes.
  • Responsive Images: Configures sizes for optimal image loading across different viewports.
  • External Image Handling: Supports optimization of images from external sources via remotePatterns.
  • Accessibility: Enforces descriptive alt text for all images.
  • Use Case: When adding a hero image to a Next.js application, use this skill to ensure it's rendered with correct dimensions, priority loading, and an optimized format to improve initial page load performance and user experience.

Quick Start

Optimize the hero image '/hero.jpg' for a Next.js app, ensuring it has dimensions, priority loading, and uses the WebP format.

Frequently Asked Questions about optimizing-images

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize images in Next.js to prevent Cumulative Layout Shift?

Prevent Cumulative Layout Shift in Next.js images by setting correct width and height attributes, which reserves layout space before rendering and stops visual jumps.

How do I improve Largest Contentful Paint for hero images in React applications?

Improve Largest Contentful Paint for React hero images by applying priority loading, which tells the browser to fetch the above-the-fold image immediately. This accelerates initial page rendering and boosts web vitals.

How do I configure Next.js to optimize images from external domains?

Configure Next.js external image optimization by defining remotePatterns in your configuration file. This allows the image optimizer to securely fetch, process, and serve images from specified external sources.

What are the best image formats for web performance in React applications?

AVIF and WebP are the best image formats for web performance in React applications. They provide superior compression and smaller file sizes compared to legacy formats, significantly reducing payload overhead.

How do I set responsive image sizes for different viewports in Next.js?

Set responsive image sizes in Next.js using the sizes attribute to inform the browser which image dimension to load based on viewport width. This prevents downloading oversized images on mobile devices.

Does image optimization for web vitals require descriptive alt text for accessibility?

Yes, optimizing images for web vitals mandates descriptive alt text for accessibility. Providing accurate alt attributes ensures screen readers can interpret images correctly while maintaining performance standards.