Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
addyosmani avatar

Performance

  • 25.4k installs
  • 2.5k repo stars
  • Updated June 14, 2026
  • addyosmani/web-quality-skills

The performance skill is an agent skill for optimizing web project loading speed, runtime efficiency, and resource usage based on Lighthouse and Core Web Vitals best practices.

About

The performance skill from Addy Osmani's Web Quality Skills collection focuses on loading speed and runtime efficiency optimization for web projects. Developers use it when optimizing page load times, reducing JavaScript bundle sizes, and fixing slow-running code. The skill encodes real-world performance engineering expertise and covers critical rendering paths, image optimization, and caching strategies.

  • 150+ Lighthouse audits across performance patterns
  • Core Web Vitals optimization (LCP, INP, CLS)
  • Framework-agnostic approach for any web stack

Performance by the numbers

  • 25,371 all-time installs (skills.sh)
  • +1,484 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #14 of 1,382 Code Review & Quality skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

performance capabilities & compatibility

Capabilities
performance audit · lcp optimization · inp optimization · cls reduction · bundling optimization · image optimization
Use cases
frontend · web search · web design
npx skills add https://github.com/addyosmani/web-quality-skills --skill performance

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs25.4k
repo stars2.5k
Security audit3 / 3 scanners passed
Last updatedJune 14, 2026
Repositoryaddyosmani/web-quality-skills

What it does

Optimize web performance metrics including Core Web Vitals and Lighthouse scores

Who is it for?

Frontend developers optimizing production web apps with slow Lighthouse scores or poor Core Web Vitals metrics.

Skip if: Native mobile app performance tuning or backend-only API latency work without a web frontend.

When should I use this skill?

When optimizing page load times, fixing slow loading, or improving Core Web Vitals scores

What you get

Developers achieve fast page loads, green Lighthouse scores, and improved user experience metrics

  • prioritized optimization plan
  • code-level performance fixes

By the numbers

  • 150+ Lighthouse audits across performance categories
  • Three Core Web Vitals metrics (LCP < 2.5s, INP < 200ms, CLS < 0.1)
  • Performance budget: JavaScript < 300 KB (compressed), CSS < 100 KB, Images < 500 KB above-fold

Files

SKILL.mdMarkdownGitHub ↗

Performance optimization

Deep performance optimization based on Lighthouse performance audits. Focuses on loading speed, runtime efficiency, and resource optimization.

How it works

1. Identify performance bottlenecks in code and assets 2. Prioritize by impact on Core Web Vitals 3. Provide specific optimizations with code examples 4. Measure improvement with before/after metrics

Performance budget

ResourceBudgetRationale
Total page weight< 1.5 MB3G loads in ~4s
JavaScript (compressed)< 300 KBParsing + execution time
CSS (compressed)< 100 KBRender blocking
Images (above-fold)< 500 KBLCP impact
Fonts< 100 KBFOIT/FOUT prevention
Third-party< 200 KBUncontrolled latency

Critical rendering path

Server response

  • TTFB < 800ms. Time to First Byte should be fast. Use CDN, caching, and efficient backends.
  • Enable compression. Gzip or Brotli for text assets. Brotli preferred (15-20% smaller).
  • HTTP/2 or HTTP/3. Multiplexing reduces connection overhead.
  • Edge caching. Cache HTML at CDN edge when possible.
  • Send Early Hints (HTTP 103) for slow origins. When the origin needs hundreds of milliseconds to assemble the final response, return a 103 Early Hints with Link: </hero.webp>; rel=preload; as=image (and similar for critical CSS/fonts) so the browser starts fetching before the 200 OK lands. Cloudflare reports 20–30% LCP improvements on image-heavy pages. Requires HTTP/2+ and is supported by Chromium-based browsers; other browsers ignore the 103 and fall through to the 200 — safe to enable. CDNs (Cloudflare, Fastly, Akamai) can synthesize 103s automatically from prior responses; on your own origin, emit them from the same handler that issues the 200.

Resource loading

Preconnect to required origins:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://cdn.example.com" crossorigin>

Preload critical resources:

<!-- LCP image -->
<link rel="preload" href="/hero.webp" as="image" fetchpriority="high">

<!-- Critical font -->
<link rel="preload" href="/font.woff2" as="font" type="font/woff2" crossorigin>

Prerender likely-next navigations with the Speculation Rules API:

<script type="speculationrules">
{
  "prerender": [{
    "where": { "href_matches": "/*" },
    "eagerness": "moderate"
  }]
}
</script>

moderate triggers after a ~200ms hover — usually intent-correlated, rarely wasted. See core-web-vitals → LCP for the full discussion of eagerness tradeoffs and the prerenderingchange gating you'll need for analytics.

Defer non-critical CSS:

<!-- Critical CSS inlined -->
<style>/* Above-fold styles */</style>

<!-- Non-critical CSS -->
<link rel="preload" href="/styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/styles.css"></noscript>

JavaScript optimization

Defer non-essential scripts:

<!-- Parser-blocking (avoid) -->
<script src="/critical.js"></script>

<!-- Deferred (preferred) -->
<script defer src="/app.js"></script>

<!-- Async (for independent scripts) -->
<script async src="/analytics.js"></script>

<!-- Module (deferred by default) -->
<script type="module" src="/app.mjs"></script>

Code splitting patterns:

// Route-based splitting
const Dashboard = lazy(() => import('./Dashboard'));

// Component-based splitting
const HeavyChart = lazy(() => import('./HeavyChart'));

// Feature-based splitting
if (user.isPremium) {
  const PremiumFeatures = await import('./PremiumFeatures');
}

Tree shaking best practices:

// ❌ Imports entire library
import _ from 'lodash';
_.debounce(fn, 300);

// ✅ Imports only what's needed
import debounce from 'lodash/debounce';
debounce(fn, 300);

Image optimization

Format selection

FormatUse caseBrowser support
AVIFPhotos, best compression92%+
WebPPhotos, good fallback97%+
PNGGraphics with transparencyUniversal
SVGIcons, logos, illustrationsUniversal

Responsive images

<picture>
  <!-- AVIF for modern browsers -->
  <source 
    type="image/avif"
    srcset="hero-400.avif 400w,
            hero-800.avif 800w,
            hero-1200.avif 1200w"
    sizes="(max-width: 600px) 100vw, 50vw">
  
  <!-- WebP fallback -->
  <source 
    type="image/webp"
    srcset="hero-400.webp 400w,
            hero-800.webp 800w,
            hero-1200.webp 1200w"
    sizes="(max-width: 600px) 100vw, 50vw">
  
  <!-- JPEG fallback -->
  <img 
    src="hero-800.jpg"
    srcset="hero-400.jpg 400w,
            hero-800.jpg 800w,
            hero-1200.jpg 1200w"
    sizes="(max-width: 600px) 100vw, 50vw"
    width="1200" 
    height="600"
    alt="Hero image"
    loading="lazy"
    decoding="async">
</picture>

LCP image priority

<!-- Above-fold LCP image: eager loading, high priority -->
<img 
  src="hero.webp" 
  fetchpriority="high"
  loading="eager"
  decoding="sync"
  alt="Hero">

<!-- Below-fold images: lazy loading -->
<img 
  src="product.webp" 
  loading="lazy"
  decoding="async"
  alt="Product">

Font optimization

Loading strategy

/* System font stack as fallback */
body {
  font-family: 'Custom Font', -apple-system, BlinkMacSystemFont, 
               'Segoe UI', Roboto, sans-serif;
}

/* Prevent invisible text */
@font-face {
  font-family: 'Custom Font';
  src: url('/fonts/custom.woff2') format('woff2');
  font-display: swap; /* or optional for non-critical */
  font-weight: 400;
  font-style: normal;
  unicode-range: U+0000-00FF; /* Subset to Latin */
}

Preloading critical fonts

<link rel="preload" href="/fonts/heading.woff2" as="font" type="font/woff2" crossorigin>

Variable fonts

/* One file instead of multiple weights */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

Caching strategy

Cache-Control headers

# HTML (short or no cache)
Cache-Control: no-cache, must-revalidate

# Static assets with hash (immutable)
Cache-Control: public, max-age=31536000, immutable

# Static assets without hash
Cache-Control: public, max-age=86400, stale-while-revalidate=604800

# API responses
Cache-Control: private, max-age=0, must-revalidate

Service worker caching

// Cache-first for static assets
self.addEventListener('fetch', (event) => {
  if (event.request.destination === 'image' ||
      event.request.destination === 'style' ||
      event.request.destination === 'script') {
    event.respondWith(
      caches.match(event.request).then((cached) => {
        return cached || fetch(event.request).then((response) => {
          const clone = response.clone();
          caches.open('static-v1').then((cache) => cache.put(event.request, clone));
          return response;
        });
      })
    );
  }
});

Runtime performance

Avoid layout thrashing

// ❌ Forces multiple reflows
elements.forEach(el => {
  const height = el.offsetHeight; // Read
  el.style.height = height + 10 + 'px'; // Write
});

// ✅ Batch reads, then batch writes
const heights = elements.map(el => el.offsetHeight); // All reads
elements.forEach((el, i) => {
  el.style.height = heights[i] + 10 + 'px'; // All writes
});

Debounce expensive operations

function debounce(fn, delay) {
  let timeout;
  return (...args) => {
    clearTimeout(timeout);
    timeout = setTimeout(() => fn(...args), delay);
  };
}

// Debounce scroll/resize handlers
window.addEventListener('scroll', debounce(handleScroll, 100));

Use requestAnimationFrame

// ❌ May cause jank
setInterval(animate, 16);

// ✅ Synced with display refresh
function animate() {
  // Animation logic
  requestAnimationFrame(animate);
}
requestAnimationFrame(animate);

Virtualize long lists

// For lists > 100 items, render only visible items
// Use libraries like react-window, vue-virtual-scroller, or native CSS:
.virtual-list {
  content-visibility: auto;
  contain-intrinsic-size: 0 50px; /* Estimated item height */
}

Smooth navigations with View Transitions

The View Transitions API lets the browser cross-fade (or custom-animate) between two DOM states using a single GPU-composited snapshot — no double-render, no layout thrash, and the snapshot doesn't count toward CLS.

Same-document (SPA-style) — Baseline 2026:

// Wrap the DOM mutation that swaps the view
function navigate(newView) {
  if (!document.startViewTransition) return swapDOM(newView);
  document.startViewTransition(() => swapDOM(newView));
}

Cross-document (MPA-style) — Chromium-stable, progressive enhancement elsewhere:

/* On both source and destination pages */
@view-transition { navigation: auto; }

That's the entire integration — same-origin navigations now fade automatically. To opt specific elements into shared-element transitions (e.g. a thumbnail expanding into a hero), give them a matching view-transition-name:

.product-thumb[data-id="42"], .product-hero { view-transition-name: product-42; }

Pair this with Speculation Rules (above) for instant + animated navigations.

Third-party scripts

Load strategies

// ❌ Blocks main thread
<script src="https://analytics.example.com/script.js"></script>

// ✅ Async loading
<script async src="https://analytics.example.com/script.js"></script>

// ✅ Delay until interaction
<script>
document.addEventListener('DOMContentLoaded', () => {
  const observer = new IntersectionObserver((entries) => {
    if (entries[0].isIntersecting) {
      const script = document.createElement('script');
      script.src = 'https://widget.example.com/embed.js';
      document.body.appendChild(script);
      observer.disconnect();
    }
  });
  observer.observe(document.querySelector('#widget-container'));
});
</script>

Facade pattern

<!-- Show static placeholder until interaction -->
<div class="youtube-facade" 
     data-video-id="abc123" 
     onclick="loadYouTube(this)">
  <img src="/thumbnails/abc123.jpg" alt="Video title">
  <button aria-label="Play video">▶</button>
</div>

Measurement

Key metrics

MetricTargetTool
LCP< 2.5sLighthouse, CrUX
FCP< 1.8sLighthouse
Speed Index< 3.4sLighthouse
TBT< 200msLighthouse
TTI< 3.8sLighthouse

Testing commands

# Lighthouse CLI
npx lighthouse https://example.com --output html --output-path report.html

# Web Vitals library
import {onLCP, onINP, onCLS} from 'web-vitals';
onLCP(console.log);
onINP(console.log);
onCLS(console.log);

References

For Core Web Vitals specific optimizations, see Core Web Vitals.

Related skills

How it compares

Pick performance over generic frontend skills when you need Lighthouse-driven Core Web Vitals fixes with measured before/after validation.

FAQ

What triggers the performance skill?

The performance skill activates when developers ask to speed up a site, optimize performance, reduce load time, fix slow loading, improve page speed, or run a performance audit on a web application.

How does the performance skill prioritize fixes?

The performance skill ranks bottlenecks by impact on Core Web Vitals, then supplies specific code-level optimizations with examples and recommends before/after measurement to confirm Lighthouse and runtime improvements.

Is Performance safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Code Review & Qualityfrontenddevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.