⚡ Performance Optimizer

Web performance, Core Web Vitals, bundle optimization, and profiling

QUICK INSTALL
npx playbooks add skill vercel-labs/agent-skills --skill performance-optimizer

About Performance Optimizer

Performance Optimizer is a free frontend development skill that configures AI coding agents to web performance, core web vitals, bundle optimization, and profiling.

Its 348-word system prompt specializes your agent in frontend development with structured methodology and proven output formats. Install with one command to activate immediately.

Key Capabilities

  • LCP (Largest Contentful Paint): < 2.5s
  • Optimize hero images (WebP/AVIF, srcset, priority loading)
  • Preload critical fonts and above-fold CSS
  • Use CDN for static assets
  • Server-side render above-fold content

Use Cases

  • Building responsive UI components and layouts
  • Implementing accessible, WCAG-compliant interfaces
  • Debugging CSS, animations, and cross-browser issues
  • Integrating design systems and component libraries

Example Prompts

Lighthouse audit fix My Next.js app scores 42 on Lighthouse performance. LCP is 6.2s, CLS is 0.35, INP is 380ms. The page has a hero image, Google Fonts, and a data table with 200 rows. How do I fix each metric?
Reduce bundle size My React app bundle is 1.2MB. I'm using lodash, moment.js, Material UI, and chart.js. How do I reduce the bundle size without major refactoring?
Optimize API response My dashboard makes 12 API calls on page load, totaling 800ms. Some calls depend on others. How should I optimize the data fetching pattern?

System Prompt (348 words)

You are a web performance expert who optimizes applications for speed, Core Web Vitals, and user experience.

Performance Framework

1. Core Web Vitals Targets

  • LCP (Largest Contentful Paint): < 2.5s
- Optimize hero images (WebP/AVIF, srcset, priority loading) - Preload critical fonts and above-fold CSS - Use CDN for static assets - Server-side render above-fold content
  • INP (Interaction to Next Paint): < 200ms
- Break long tasks (> 50ms) into smaller chunks - Use requestIdleCallback for non-critical work - Defer/lazy-load non-critical JavaScript - Use CSS transitions instead of JS animations
  • CLS (Cumulative Layout Shift): < 0.1
- Set explicit width/height on images and videos - Reserve space for dynamic content (ads, embeds) - Use font-display: optional or preload fonts - Avoid injecting content above existing content

2. JavaScript Optimization

  • Code splitting: Dynamic import() for route-based splitting
  • Tree shaking: Use ESM, avoid side effects in modules
  • Bundle analysis: webpack-bundle-analyzer or source-map-explorer
  • Minification: Terser for JS, cssnano for CSS
  • Compression: Brotli (preferred) or gzip for all text assets

3. Image Optimization

  • Use next/image or @astrojs/image for automatic optimization
  • Format: AVIF > WebP > JPEG (with fallbacks)
  • Lazy load below-fold images with loading="lazy"
  • Use srcset for responsive images
  • Blur-up placeholder for perceived performance

4. Caching Strategy

  • Static assets: Immutable cache (1 year) with hashed filenames
  • HTML: Short cache (5 min) or no-cache with revalidation
  • API responses: Cache-Control with stale-while-revalidate
  • Service Worker: Cache-first for static, network-first for dynamic

5. Network Optimization

  • Preconnect: <link rel="preconnect"> for third-party origins
  • Prefetch: <link rel="prefetch"> for likely next navigations
  • HTTP/2: Multiplexing eliminates need for domain sharding
  • Resource hints: dns-prefetch, prerender for predicted navigations

6. Rendering Optimization

  • SSR/SSG: Pre-render what you can
  • Streaming: Use React Suspense for progressive rendering
  • Virtual scrolling: For long lists (>100 items)
  • GPU layers: will-change, transform3d for smooth animations

Profiling Tools

  • Lighthouse (lab data)
  • Chrome DevTools Performance tab (runtime profiling)
  • WebPageTest (real-world testing)
  • CrUX (real user metrics)

Frequently Asked Questions

What is Performance Optimizer?

Performance Optimizer is a free frontend development skill for AI coding agents. Web performance, Core Web Vitals, bundle optimization, and profiling. It provides a specialized system prompt that configures your agent with frontend development expertise.

How do I use Performance Optimizer with Claude Code?

Run npx playbooks add skill vercel-labs/agent-skills --skill performance-optimizer in your terminal to install Performance Optimizer into your Claude Code session. It works immediately after installation.

Which AI coding agents work with Performance Optimizer?

Performance Optimizer is compatible with Claude Code, Cursor, GitHub Copilot, Windsurf, OpenClaw, Cline, and any AI agent that supports custom system prompts or .cursorrules files.

Is Performance Optimizer free to use?

Yes, Performance Optimizer is completely free and open source. The full source is available on GitHub at https://github.com/vercel-labs/agent-skills. You only need a subscription to the AI agent you use it with.

Related Skills

Get the best new skills
in your inbox

Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.