.claude/skills/performance-optimization/SKILL.md
Optimize web application performance. Use when improving page load times, Core Web Vitals, Lighthouse scores, bundle sizes, rendering performance, or server response times. Covers HTML/CSS/JS optimization, image optimization, caching strategies, CDN configuration, lazy loading, and performance monitoring.
npx skillsauth add wallacedobbs428/thecalltaker performance-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Systematically improve web performance through measurement, optimization, and monitoring.
Run this before ANY optimization work:
# Lighthouse CLI audit
npx lighthouse https://yoursite.com --output=json --output-path=./audit.json
# Core Web Vitals
# LCP (Largest Contentful Paint) < 2.5s
# FID (First Input Delay) < 100ms
# CLS (Cumulative Layout Shift) < 0.1
# INP (Interaction to Next Paint) < 200ms
<head>)<!-- Preload critical resources -->
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/hero.webp" as="image">
<!-- Inline critical CSS (above-the-fold styles) -->
<style>/* Critical CSS here — extract with Critical npm package */</style>
<!-- Defer non-critical CSS -->
<link rel="preload" href="/styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<!-- Defer JavaScript -->
<script defer src="/app.js"></script>
<!-- DNS prefetch for third-party domains -->
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//cdn.jsdelivr.net">
<!-- Preconnect for critical third-party origins -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<!-- Prefetch next-page resources -->
<link rel="prefetch" href="/pricing.html">
| Format | Use Case | Savings vs PNG | |--------|----------|---------------| | WebP | Photos, general images | 25-35% smaller | | AVIF | Photos (modern browsers) | 50% smaller | | SVG | Icons, logos, illustrations | Resolution independent | | PNG | Screenshots with text | Baseline |
<picture>
<source srcset="/hero.avif" type="image/avif">
<source srcset="/hero.webp" type="image/webp">
<img src="/hero.jpg" alt="Hero"
width="1200" height="600"
loading="lazy"
decoding="async">
</picture>
<!-- Responsive srcset -->
<img srcset="/hero-400.webp 400w,
/hero-800.webp 800w,
/hero-1200.webp 1200w"
sizes="(max-width: 768px) 100vw, 50vw"
src="/hero-800.webp"
alt="Hero image"
loading="lazy">
loading="lazy" to all images below the folddecoding="async" for non-critical imageswidth and height to prevent CLS# Extract critical CSS automatically
npx critical index.html --base ./ --inline --minify > index-optimized.html
npx purgecss --css styles.css --content index.htmlnpx csso styles.css --output styles.min.csscontain: layout style painttransform and opacity for animations (GPU-accelerated)@import in CSS (blocks parallel download)/* Use font-display: swap to prevent FOIT */
@font-face {
font-family: 'Inter';
src: url('/fonts/inter.woff2') format('woff2');
font-display: swap;
unicode-range: U+0000-00FF; /* Latin subset only */
}
# Analyze bundle size
npx source-map-explorer bundle.js
# or
npx webpack-bundle-analyzer stats.json
import() for non-critical features<!-- Load analytics after page is interactive -->
<script>
window.addEventListener('load', function() {
setTimeout(function() {
var s = document.createElement('script');
s.src = 'https://analytics.example.com/script.js';
document.body.appendChild(s);
}, 3000);
});
</script>
# Static assets (CSS, JS, images) — cache for 1 year
Cache-Control: public, max-age=31536000, immutable
# HTML pages — revalidate every time
Cache-Control: no-cache
# API responses — short cache
Cache-Control: public, max-age=300, stale-while-revalidate=600
// Cache static assets on install
self.addEventListener('install', e => {
e.waitUntil(
caches.open('v1').then(cache =>
cache.addAll(['/styles.css', '/app.js', '/offline.html'])
)
);
});
// Serve from cache, fallback to network
self.addEventListener('fetch', e => {
e.respondWith(
caches.match(e.request).then(r => r || fetch(e.request))
);
});
Set these limits and enforce in CI:
| Metric | Budget | Tool | |--------|--------|------| | Total page weight | < 500KB | Lighthouse | | JavaScript | < 200KB (compressed) | bundlesize | | CSS | < 50KB (compressed) | bundlesize | | LCP | < 2.5s | Web Vitals | | CLS | < 0.1 | Web Vitals | | INP | < 200ms | Web Vitals | | TTFB | < 600ms | Web Vitals | | Lighthouse Performance | > 90 | Lighthouse CI |
loading="lazy" to below-fold imagesdefer attributedocumentation
Agentic memory system for writers - track characters, relationships, scenes, and themes
tools
Automate repetitive development tasks and workflows. Use when creating build scripts, automating deployments, or setting up development workflows. Handles npm scripts, Makefile, GitHub Actions workflows, and task automation.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices". Fetches latest Vercel guidelines and checks files against all rules.
development
Implement web accessibility (a11y) standards following WCAG 2.1 guidelines. Use when building accessible UIs, fixing accessibility issues, or ensuring compliance with disability standards. Handles ARIA attributes, keyboard navigation, screen readers, semantic HTML, and accessibility testing.