Skip to main content
skill CX Codex

image-optimization · secondsky — Claude Code skill: what it does, how to install

Guides web image optimization using AVIF and WebP formats, responsive <picture> markup, and lazy loading strategies to cut page load times.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add secondsky/claude-skills --skill image-optimization -a claude-code
Open on GitHub

What image-optimization does

The skill sets conventions for web asset delivery. It directs format choices toward WebP and AVIF to cut photo sizes between 25 and 50 percent compared to legacy JPEG, while keeping icons in SVG. For frontend markup, it outputs <picture> elements with multiple sources and native lazy loading.

Budgets are strictly capped. Hero banners must stay under 200KB, while total page imagery stays below 500KB. For build pipelines, it provides a Node.js snippet based on the sharp library with quality set between 70 and 85. The automation script fails immediately unless sharp is added to your project dependencies.

What it helps with

  • Build responsive <picture> markup with AVIF and WebP fallbacks
  • Configure native lazy loading and asynchronous decoding
  • Automate asset conversion pipelines with sharp
  • Audit image weights against page performance budgets

Example prompts for the agent

  • Convert this hero section into a responsive <picture> tag with WebP and AVIF sources
  • Write a sharp script to resize images to 1200px width and export them to WebP
  • Add native lazy loading and async decoding to all below-the-fold images

How to install image-optimization

1Skills CLI (Vercel)

npx skills add secondsky/claude-skills --skill image-optimization -a claude-code

2Manually: put the files in place

~/.claude/skills/image-optimization/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/image-optimization/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about image-optimization

How do I install image-optimization in Claude Code?

Run npx skills add secondsky/claude-skills --skill image-optimization -a claude-code in your terminal.

What size budgets does the skill define?

It targets hero images under 200KB and thumbnails under 30KB. Total imagery across a single page should stay below 500KB.

Which external library is required for the pipeline snippet?

The build script depends on sharp in Node.js. It scales images down to 1200 pixels width and outputs WebP files at quality 80.

Source text

SKILL.md · MIT
---
name: image-optimization
description: Optimizes images for web performance using modern formats, responsive techniques, and lazy loading strategies. Use when improving page load times, implementing responsive images, or preparing assets for production deployment.
license: MIT
---

# Image Optimization

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

## Format Selection

| Format | Best For | Compression |
|--------|----------|-------------|
| JPEG | Photos | Lossy, 50-70% reduction |
| PNG | Icons, transparency | Lossless, 10-30% |
| WebP | Modern browsers | 25-35% better than JPEG |
| AVIF | Next-gen | 50% better than JPEG |
| SVG | Logos, icons | Vector, scalable |

## Responsive Images

```html
<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

```html
<!-- 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)

```javascript
const sharp = require('sharp');

async function optimizeImage(input, output) {
  await sharp(input)
    .resize(1200, null, { withoutEnlargement: true })
    .webp({ quality: 80 })
    .toFile(output);
}
```

## Performance Targets

| Asset Type | Target Size |
|------------|-------------|
| Hero image | <200KB |
| Thumbnail | <30KB |
| Total images | <500KB |

## Optimization Checklist

- [ ] Use WebP with JPEG fallback
- [ ] Implement responsive srcset
- [ ] Enable lazy loading for below-fold
- [ ] Compress at quality 70-85
- [ ] Serve from CDN
- [ ] Set proper cache headers

© secondsky · MIT · secondsky/claude-skills

Similar skills

Everything for Frontend and UI →

image-optimization by other authors comes first.

image-optimization kostja94 Guides responsive image markup, WebP compression, and sitemaps for Google Search. Use it to fix LCP regressions and prepare site assets for search indexing. CX Codex +1 1,100installs image-optimization aj-geddes A skill that walks your agent through compressing images and picking modern formats. Useful before a deploy, when pages drag on mobile networks. CX Codex +1 656installs frontend-design official anthropics This skill guides intentional visual design for new interfaces and redesigns. Use it when a generic generated UI is not enough. 1,025,790installs design-taste-frontend Leonxlnx This skill directs the design of public pages and work screens, then checks the result in a browser through screenshots. Use it when an interface feels generic or unfinished. CX Codex +1 678,700installs prototype Matt Pocock Creates throwaway prototypes for checking state logic or exploring UI before committing the decision to the main codebase. 986,201installs hyperframes heygen-com Instructs coding agents on creating, validating, and rendering HTML-based videos using the HyperFrames framework and CLI. CX Codex +1 1,200,000installs hyperframes-cli heygen-com Controls HyperFrames video workflows from the CLI: audits layouts and contrast, edits timeline clips, captures snapshots, and renders locally or in cloud runtimes. CX Codex +1 1,300,000installs webapp-testing official anthropics This skill tests local web apps with Playwright, helping agents debug UI behavior, capture screenshots, and inspect browser logs. 186,758installs

From the same set94

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor