Image optimization

Reduce transferred bytes while preserving layout, detail, and image meaning.

Customize the recipe

0/1500 characters
Workflow boosters

Prompt preview

# Image optimization

Reduce transferred bytes while preserving layout, detail, and image meaning.

## Deliverable
An asset and rendering patch with byte and quality comparisons.

## Stack and visual direction
- Recommended starting stack: Use the existing stack, browser tooling and the project's test commands. Capture before-and-after evidence.
- Minimalism: Use deliberate spacing, a compact palette and a clear typographic hierarchy. Retain the labels, feedback and affordances people need to act. Use this direction for any new or revised UI within the agreed patch scope.

## Tools and setup · Universal
Use the receiving agent’s documented skill and tool mechanisms. Match setup to the agent and workspace you actually have.

Check available tools first. Propose documented project-level setup only when it materially helps and follow the host's permission prompts. If a tool or integration is unavailable, continue with the workflow below using existing tools, local fixtures or a manual check. Keep secrets in the intended configuration environment.

- [Web Design Guidelines](https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines) (Skill) — Review frontend UI against usability and accessibility guidance.
  Access to the current upstream guidelines for the skill's full review. Fallback: Perform the recipe's keyboard, focus, responsive and feedback checks manually.
- [Sharp](https://github.com/lovell/sharp) (Repository) — Generate appropriately sized derivatives and preserve originals during asset optimization.
- [Lighthouse](https://github.com/GoogleChrome/lighthouse) (Repository) — Capture comparable page performance, SEO and accessibility diagnostics.
- [Next.js](https://github.com/vercel/next.js) (Repository) — Use App Router conventions, server rendering, metadata and accessible route structure.
  [Official setup](https://nextjs.org/docs/app/getting-started/installation).

## Workflow
1. Inventory large assets, record display sizes and select appropriate formats and derivatives. Set dimensions, responsive sources and sensible loading priority while preserving originals.
2. Use the simplest implementation that delivers the stated outcome. Follow the user's project constraints and treat the starting stack as a default. Reuse existing work and ask for essential input only when it would change the result. Use realistic labeled sample data when real inputs are unavailable.
3. Run the applicable checks and report what actually passed along with any checks you could not run.

## Acceptance checks
- [ ] Image bytes drop for representative narrow and desktop pages.
- [ ] The optimized images retain useful detail, alternatives and stable layout.
- [ ] Walk the primary journey with keyboard only. Check visible focus, logical order, accessible names, readable contrast, zoom and reduced motion. Use axe where available and manually check behavior that automation cannot assess.
- [ ] Capture a reproducible baseline, validate the changed flow afterward, and report evidence and any findings still open.

Recipe resources

Source, setup, and compatibility details.