secondsky avatar

Image Optimization

Covers the essentials for getting images production-ready: format selection (WebP, AVIF, with JPEG fallbacks), responsive srcset implementation, and lazy loading patterns. Includes a Sharp-based build pipeline example and concrete performance targets like keeping hero images under 200KB. The checklist format makes it easy to audit existing sites. Use this when you're trying to shave seconds off page load times or when lighthouse is yelling at you about unoptimized images. The picture element examples are copy-paste ready, which saves you from looking up the syntax for the hundredth time.

skills.sh installs
604
GitHub stars
248
last updated
Aug 21, 2026

Install

$ npx -y skills add secondsky/claude-skills --skill image-optimization --agent claude-code

Installs into .claude/skills of the current project.

Files

Image Optimization

Optimize images for web performance with modern formats and responsive techniques.

Format Selection

FormatBest ForCompression
JPEGPhotosLossy, 50-70% reduction
PNGIcons, transparencyLossless, 10-30%
WebPModern browsers25-35% better than JPEG
AVIFNext-gen50% better than JPEG
SVGLogos, iconsVector, scalable

Responsive Images

<picture>
  <source srcset="image.avif" type="image/avif">
  <source srcset="image.webp" type="image/webp">
  <img
    src="image.jpg"
    srcset="image-400.jpg 400w, image-800.jpg 800w, image-1200.jpg 1200w"
    sizes="(max-width: 600px) 100vw, 50vw"
    alt="Description"
    loading="lazy"
    decoding="async"
  >
</picture>

Lazy Loading

<!-- Native lazy loading -->
<img src="image.jpg" loading="lazy" alt="Description">

<!-- With blur placeholder -->
<img
  src="placeholder-blur.jpg"
  data-src="image.jpg"
  class="lazy"
  alt="Description"
>

Build Pipeline (Sharp)

const sharp = require('sharp');

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Categories
Frontend Development, Debugging
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1joneqian avatarwechat-miniprogramjoneqian/claude-skills-suiteWeChat Mini Program development framework. Use for building WeChat mini apps, WXML templates, WXSS styles, WXS scripting, component development, and WeChat API 599skills.sh installs
2kochetkov-ma avatarbrewpage-publishkochetkov-ma/claude-brewcodePublish HTML, markdown, text, any file, or a multi-file site to brewpage.app — free hosting with no sign-up. Paste text, share a file, upload a site, or host a 598skills.sh installs
3onewave-ai avatarpresentation-design-enhanceronewave-ai/claude-skillsTransform text-heavy slides into visual storytelling. Suggest layout improvements, icon usage, and data visualization.596skills.sh installs
4davila7 avatarlatex-postersdavila7/claude-code-templatesCreate professional research posters in LaTeX using beamerposter, tikzposter, or baposter. Support for conference presentations, academic posters, and scientifi592skills.sh installs
5google-labs-code avatarstitch-sdk-usagegoogle-labs-code/stitch-sdkUse the Stitch SDK to generate, edit, and iterate on UI screens from text prompts, manage projects, and retrieve screen HTML/images. Use when the user wants to 576skills.sh installs
6cycleuser avatarofficial-document-writercycleuser/skillsOfficial document writing assistant for Chinese government documents based on GB/T 9704-2012 standard. Triggers when: Writing Chinese official documents (公文), f573skills.sh installs