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.
npx skills add secondsky/claude-skills --skill image-optimization -a claude-codeWhat 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
sharpscript 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-code2Manually: put the files in place
~/.claude/skills/image-optimization/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/image-optimization/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill image-optimization -a codex2Manually: put the files in place
.agents/skills/image-optimization/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill image-optimization -a cursor2Manually: put the files in place
.cursor/skills/image-optimization/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install secondsky/claude-skills image-optimization2Manually: put the files in place
.github/skills/image-optimization/SKILL.md1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill image-optimization -a gemini-cli2Platform CLI
gemini skills install https://github.com/secondsky/claude-skills --path plugins/image-optimization/skills/image-optimizationManually: put the files in place
.devin/skills/image-optimization/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill image-optimization -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.