[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CA5W80QAXDSZC196SY8DZC":3,"skill-same:01M6CA5W80QAXDSZC196SY8DZC":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":14,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":6,"updatedAt":44,"install":45,"resources":58},"01M6CA5W80QAXDSZC196SY8DZC","performance",null,"Optimize web performance for faster loading and better user experience. Use when asked to \"speed up my site\", \"optimize performance\", \"reduce load time\", \"fix slow loading\", \"improve page speed\", or \"performance audit\".","thegiantbeast\u002Fdotfiles","thegiantbeast","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F31733?v=4","01M6C3CJSWCN22VMJ7DZ7KJX02","Ricardo Ferreira","01M6C3CJY6G03VP48FRFK8HEGE",0,"MIT","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Fperformance\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29],"web","web performance","audit","improve","site","page","quality","user","fix","use","up","2026-11-10 10:12:30",false,"---\nname: performance\ndescription: Optimize web performance for faster loading and better user experience. Use when asked to \"speed up my site\", \"optimize performance\", \"reduce load time\", \"fix slow loading\", \"improve page speed\", or \"performance audit\".\nlicense: MIT\nmetadata:\n  author: web-quality-skills\n  version: \"1.0\"\n---\n\n# Performance optimization\n\nDeep performance optimization based on Lighthouse performance audits. Focuses on loading speed, runtime efficiency, and resource optimization.\n\n## How it works\n\n1. Identify performance bottlenecks in code and assets\n2. Prioritize by impact on Core Web Vitals\n3. Provide specific optimizations with code examples\n4. Measure improvement with before\u002Fafter metrics\n\n## Performance budget\n\n| Resource | Budget | Rationale |\n|----------|--------|-----------|\n| Total page weight | \u003C 1.5 MB | 3G loads in ~4s |\n| JavaScript (compressed) | \u003C 300 KB | Parsing + execution time |\n| CSS (compressed) | \u003C 100 KB | Render blocking |\n| Images (above-fold) | \u003C 500 KB | LCP impact |\n| Fonts | \u003C 100 KB | FOIT\u002FFOUT prevention |\n| Third-party | \u003C 200 KB | Uncontrolled latency |\n\n## Critical rendering path\n\n### Server response\n* **TTFB \u003C 800ms.** Time to First Byte should be fast. Use CDN, caching, and efficient backends.\n* **Enable compression.** Gzip or Brotli for text assets. Brotli preferred (15-20% smaller).\n* **HTTP\u002F2 or HTTP\u002F3.** Multiplexing reduces connection overhead.\n* **Edge caching.** Cache HTML at CDN edge when possible.\n* **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: \u003C\u002Fhero.webp>; rel=preload; as=image` (and similar for critical CSS\u002Ffonts) so the browser starts fetching before the `200 OK` lands. Cloudflare reports [20–30% LCP improvements](https:\u002F\u002Fblog.cloudflare.com\u002Fearly-hints-performance\u002F) on image-heavy pages. Requires HTTP\u002F2+ 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.\n\n### Resource loading\n\n**Preconnect to required origins:**\n```html\n\u003Clink rel=\"preconnect\" href=\"https:\u002F\u002Ffonts.googleapis.com\">\n\u003Clink rel=\"preconnect\" href=\"https:\u002F\u002Fcdn.example.com\" crossorigin>\n```\n\n**Preload critical resources:**\n```html\n\u003C!-- LCP image -->\n\u003Clink rel=\"preload\" href=\"\u002Fhero.webp\" as=\"image\" fetchpriority=\"high\">\n\n\u003C!-- Critical font -->\n\u003Clink rel=\"preload\" href=\"\u002Ffont.woff2\" as=\"font\" type=\"font\u002Fwoff2\" crossorigin>\n```\n\n**Prerender likely-next navigations** with the [Speculation Rules API](https:\u002F\u002Fdeveloper.chrome.com\u002Fdocs\u002Fweb-platform\u002Fprerender-pages):\n```html\n\u003Cscript type=\"speculationrules\">\n{\n  \"prerender\": [{\n    \"where\": { \"href_matches\": \"\u002F*\" },\n    \"eagerness\": \"moderate\"\n  }]\n}\n\u003C\u002Fscript>\n```\n`moderate` triggers after a ~200ms hover — usually intent-correlated, rarely wasted. See [core-web-vitals → LCP](..\u002Fcore-web-vitals\u002FSKILL.md#lcp-largest-contentful-paint) for the full discussion of eagerness tradeoffs and the `prerenderingchange` gating you'll need for analytics.\n\n**Defer non-critical CSS:**\n```html\n\u003C!-- Critical CSS inlined -->\n\u003Cstyle>\u002F* Above-fold styles *\u002F\u003C\u002Fstyle>\n\n\u003C!-- Non-critical CSS -->\n\u003Clink rel=\"preload\" href=\"\u002Fstyles.css\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\">\n\u003Cnoscript>\u003Clink rel=\"stylesheet\" href=\"\u002Fstyles.css\">\u003C\u002Fnoscript>\n```\n\n### JavaScript optimization\n\n**Defer non-essential scripts:**\n```html\n\u003C!-- Parser-blocking (avoid) -->\n\u003Cscript src=\"\u002Fcritical.js\">\u003C\u002Fscript>\n\n\u003C!-- Deferred (preferred) -->\n\u003Cscript defer src=\"\u002Fapp.js\">\u003C\u002Fscript>\n\n\u003C!-- Async (for independent scripts) -->\n\u003Cscript async src=\"\u002Fanalytics.js\">\u003C\u002Fscript>\n\n\u003C!-- Module (deferred by default) -->\n\u003Cscript type=\"module\" src=\"\u002Fapp.mjs\">\u003C\u002Fscript>\n```\n\n**Code splitting patterns:**\n```javascript\n\u002F\u002F Route-based splitting\nconst Dashboard = lazy(() => import('.\u002FDashboard'));\n\n\u002F\u002F Component-based splitting\nconst HeavyChart = lazy(() => import('.\u002FHeavyChart'));\n\n\u002F\u002F Feature-based splitting\nif (user.isPremium) {\n  const PremiumFeatures = await import('.\u002FPremiumFeatures');\n}\n```\n\n**Tree shaking best practices:**\n```javascript\n\u002F\u002F ❌ Imports entire library\nimport _ from 'lodash';\n_.debounce(fn, 300);\n\n\u002F\u002F ✅ Imports only what's needed\nimport debounce from 'lodash\u002Fdebounce';\ndebounce(fn, 300);\n```\n\n## Image optimization\n\n### Format selection\n| Format | Use case | Browser support |\n|--------|----------|-----------------|\n| AVIF | Photos, best compression | 92%+ |\n| WebP | Photos, good fallback | 97%+ |\n| PNG | Graphics with transparency | Universal |\n| SVG | Icons, logos, illustrations | Universal |\n\n### Responsive images\n```html\n\u003Cpicture>\n  \u003C!-- AVIF for modern browsers -->\n  \u003Csource \n    type=\"image\u002Favif\"\n    srcset=\"hero-400.avif 400w,\n            hero-800.avif 800w,\n            hero-1200.avif 1200w\"\n    sizes=\"(max-width: 600px) 100vw, 50vw\">\n  \n  \u003C!-- WebP fallback -->\n  \u003Csource \n    type=\"image\u002Fwebp\"\n    srcset=\"hero-400.webp 400w,\n            hero-800.webp 800w,\n            hero-1200.webp 1200w\"\n    sizes=\"(max-width: 600px) 100vw, 50vw\">\n  \n  \u003C!-- JPEG fallback -->\n  \u003Cimg \n    src=\"hero-800.jpg\"\n    srcset=\"hero-400.jpg 400w,\n            hero-800.jpg 800w,\n            hero-1200.jpg 1200w\"\n    sizes=\"(max-width: 600px) 100vw, 50vw\"\n    width=\"1200\" \n    height=\"600\"\n    alt=\"Hero image\"\n    loading=\"lazy\"\n    decoding=\"async\">\n\u003C\u002Fpicture>\n```\n\n### LCP image priority\n```html\n\u003C!-- Above-fold LCP image: eager loading, high priority -->\n\u003Cimg \n  src=\"hero.webp\" \n  fetchpriority=\"high\"\n  loading=\"eager\"\n  decoding=\"sync\"\n  alt=\"Hero\">\n\n\u003C!-- Below-fold images: lazy loading -->\n\u003Cimg \n  src=\"product.webp\" \n  loading=\"lazy\"\n  decoding=\"async\"\n  alt=\"Product\">\n```\n\n## Font optimization\n\n### Loading strategy\n```css\n\u002F* System font stack as fallback *\u002F\nbody {\n  font-family: 'Custom Font', -apple-system, BlinkMacSystemFont, \n               'Segoe UI', Roboto, sans-serif;\n}\n\n\u002F* Prevent invisible text *\u002F\n@font-face {\n  font-family: 'Custom Font';\n  src: url('\u002Ffonts\u002Fcustom.woff2') format('woff2');\n  font-display: swap; \u002F* or optional for non-critical *\u002F\n  font-weight: 400;\n  font-style: normal;\n  unicode-range: U+0000-00FF; \u002F* Subset to Latin *\u002F\n}\n```\n\n### Preloading critical fonts\n```html\n\u003Clink rel=\"preload\" href=\"\u002Ffonts\u002Fheading.woff2\" as=\"font\" type=\"font\u002Fwoff2\" crossorigin>\n```\n\n### Variable fonts\n```css\n\u002F* One file instead of multiple weights *\u002F\n@font-face {\n  font-family: 'Inter';\n  src: url('\u002Ffonts\u002FInter-Variable.woff2') format('woff2-variations');\n  font-weight: 100 900;\n  font-display: swap;\n}\n```\n\n## Caching strategy\n\n### Cache-Control headers\n```\n# HTML (short or no cache)\nCache-Control: no-cache, must-revalidate\n\n# Static assets with hash (immutable)\nCache-Control: public, max-age=31536000, immutable\n\n# Static assets without hash\nCache-Control: public, max-age=86400, stale-while-revalidate=604800\n\n# API responses\nCache-Control: private, max-age=0, must-revalidate\n```\n\n### Service worker caching\n```javascript\n\u002F\u002F Cache-first for static assets\nself.addEventListener('fetch', (event) => {\n  if (event.request.destination === 'image' ||\n      event.request.destination === 'style' ||\n      event.request.destination === 'script') {\n    event.respondWith(\n      caches.match(event.request).then((cached) => {\n        return cached || fetch(event.request).then((response) => {\n          const clone = response.clone();\n          caches.open('static-v1').then((cache) => cache.put(event.request, clone));\n          return response;\n        });\n      })\n    );\n  }\n});\n```\n\n## Runtime performance\n\n### Avoid layout thrashing\n```javascript\n\u002F\u002F ❌ Forces multiple reflows\nelements.forEach(el => {\n  const height = el.offsetHeight; \u002F\u002F Read\n  el.style.height = height + 10 + 'px'; \u002F\u002F Write\n});\n\n\u002F\u002F ✅ Batch reads, then batch writes\nconst heights = elements.map(el => el.offsetHeight); \u002F\u002F All reads\nelements.forEach((el, i) => {\n  el.style.height = heights[i] + 10 + 'px'; \u002F\u002F All writes\n});\n```\n\n### Debounce expensive operations\n```javascript\nfunction debounce(fn, delay) {\n  let timeout;\n  return (...args) => {\n    clearTimeout(timeout);\n    timeout = setTimeout(() => fn(...args), delay);\n  };\n}\n\n\u002F\u002F Debounce scroll\u002Fresize handlers\nwindow.addEventListener('scroll', debounce(handleScroll, 100));\n```\n\n### Use requestAnimationFrame\n```javascript\n\u002F\u002F ❌ May cause jank\nsetInterval(animate, 16);\n\n\u002F\u002F ✅ Synced with display refresh\nfunction animate() {\n  \u002F\u002F Animation logic\n  requestAnimationFrame(animate);\n}\nrequestAnimationFrame(animate);\n```\n\n### Virtualize long lists\n```javascript\n\u002F\u002F For lists > 100 items, render only visible items\n\u002F\u002F Use libraries like react-window, vue-virtual-scroller, or native CSS:\n.virtual-list {\n  content-visibility: auto;\n  contain-intrinsic-size: 0 50px; \u002F* Estimated item height *\u002F\n}\n```\n\n### Smooth navigations with View Transitions\n\nThe [View Transitions API](https:\u002F\u002Fdeveloper.chrome.com\u002Fdocs\u002Fweb-platform\u002Fview-transitions) 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.\n\n**Same-document (SPA-style) — Baseline 2026:**\n```javascript\n\u002F\u002F Wrap the DOM mutation that swaps the view\nfunction navigate(newView) {\n  if (!document.startViewTransition) return swapDOM(newView);\n  document.startViewTransition(() => swapDOM(newView));\n}\n```\n\n**Cross-document (MPA-style) — Chromium-stable, progressive enhancement elsewhere:**\n```css\n\u002F* On both source and destination pages *\u002F\n@view-transition { navigation: auto; }\n```\nThat'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`:\n```css\n.product-thumb[data-id=\"42\"], .product-hero { view-transition-name: product-42; }\n```\n\nPair this with Speculation Rules (above) for instant + animated navigations.\n\n## Third-party scripts\n\n### Load strategies\n```javascript\n\u002F\u002F ❌ Blocks main thread\n\u003Cscript src=\"https:\u002F\u002Fanalytics.example.com\u002Fscript.js\">\u003C\u002Fscript>\n\n\u002F\u002F ✅ Async loading\n\u003Cscript async src=\"https:\u002F\u002Fanalytics.example.com\u002Fscript.js\">\u003C\u002Fscript>\n\n\u002F\u002F ✅ Delay until interaction\n\u003Cscript>\ndocument.addEventListener('DOMContentLoaded', () => {\n  const observer = new IntersectionObserver((entries) => {\n    if (entries[0].isIntersecting) {\n      const script = document.createElement('script');\n      script.src = 'https:\u002F\u002Fwidget.example.com\u002Fembed.js';\n      document.body.appendChild(script);\n      observer.disconnect();\n    }\n  });\n  observer.observe(document.querySelector('#widget-container'));\n});\n\u003C\u002Fscript>\n```\n\n### Facade pattern\n```html\n\u003C!-- Show static placeholder until interaction -->\n\u003Cdiv class=\"youtube-facade\" \n     data-video-id=\"abc123\" \n     onclick=\"loadYouTube(this)\">\n  \u003Cimg src=\"\u002Fthumbnails\u002Fabc123.jpg\" alt=\"Video title\">\n  \u003Cbutton aria-label=\"Play video\">▶\u003C\u002Fbutton>\n\u003C\u002Fdiv>\n```\n\n## Measurement\n\n### Key metrics\n| Metric | Target | Tool |\n|--------|--------|------|\n| LCP | \u003C 2.5s | Lighthouse, CrUX |\n| FCP | \u003C 1.8s | Lighthouse |\n| Speed Index | \u003C 3.4s | Lighthouse |\n| TBT | \u003C 200ms | Lighthouse |\n| TTI | \u003C 3.8s | Lighthouse |\n\n### Testing commands\n```bash\n# Lighthouse CLI\nnpx lighthouse https:\u002F\u002Fexample.com --output html --output-path report.html\n\n# Web Vitals library\nimport {onLCP, onINP, onCLS} from 'web-vitals';\nonLCP(console.log);\nonINP(console.log);\nonCLS(console.log);\n```\n\n## References\n\nFor Core Web Vitals specific optimizations, see [Core Web Vitals](..\u002Fcore-web-vitals\u002FSKILL.md).\n","# Performance optimization\n\nDeep performance optimization based on Lighthouse performance audits. Focuses on loading speed, runtime efficiency, and resource optimization.\n\n## How it works\n\n1. Identify performance bottlenecks in code and assets\n2. Prioritize by impact on Core Web Vitals\n3. Provide specific optimizations with code examples\n4. Measure improvement with before\u002Fafter metrics\n\n## Performance budget\n\n| Resource | Budget | Rationale |\n|----------|--------|-----------|\n| Total page weight | \u003C 1.5 MB | 3G loads in ~4s |\n| JavaScript (compressed) | \u003C 300 KB | Parsing + execution time |\n| CSS (compressed) | \u003C 100 KB | Render blocking |\n| Images (above-fold) | \u003C 500 KB | LCP impact |\n| Fonts | \u003C 100 KB | FOIT\u002FFOUT prevention |\n| Third-party | \u003C 200 KB | Uncontrolled latency |\n\n## Critical rendering path\n\n### Server response\n* **TTFB \u003C 800ms.** Time to First Byte should be fast. Use CDN, caching, and efficient backends.\n* **Enable compression.** Gzip or Brotli for text assets. Brotli preferred (15-20% smaller).\n* **HTTP\u002F2 or HTTP\u002F3.** Multiplexing reduces connection overhead.\n* **Edge caching.** Cache HTML at CDN edge when possible.\n* **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: \u003C\u002Fhero.webp>; rel=preload; as=image` (and similar for critical CSS\u002Ffonts) so the browser starts fetching before the `200 OK` lands. Cloudflare reports [20–30% LCP improvements](https:\u002F\u002Fblog.cloudflare.com\u002Fearly-hints-performance\u002F) on image-heavy pages. Requires HTTP\u002F2+ 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.\n\n### Resource loading\n\n**Preconnect to required origins:**\n```html\n\u003Clink rel=\"preconnect\" href=\"https:\u002F\u002Ffonts.googleapis.com\">\n\u003Clink rel=\"preconnect\" href=\"https:\u002F\u002Fcdn.example.com\" crossorigin>\n```\n\n**Preload critical resources:**\n```html\n\u003C!-- LCP image -->\n\u003Clink rel=\"preload\" href=\"\u002Fhero.webp\" as=\"image\" fetchpriority=\"high\">\n\n\u003C!-- Critical font -->\n\u003Clink rel=\"preload\" href=\"\u002Ffont.woff2\" as=\"font\" type=\"font\u002Fwoff2\" crossorigin>\n```\n\n**Prerender likely-next navigations** with the [Speculation Rules API](https:\u002F\u002Fdeveloper.chrome.com\u002Fdocs\u002Fweb-platform\u002Fprerender-pages):\n```html\n\u003Cscript type=\"speculationrules\">\n{\n  \"prerender\": [{\n    \"where\": { \"href_matches\": \"\u002F*\" },\n    \"eagerness\": \"moderate\"\n  }]\n}\n\u003C\u002Fscript>\n```\n`moderate` triggers after a ~200ms hover — usually intent-correlated, rarely wasted. See [core-web-vitals → LCP](..\u002Fcore-web-vitals\u002FSKILL.md#lcp-largest-contentful-paint) for the full discussion of eagerness tradeoffs and the `prerenderingchange` gating you'll need for analytics.\n\n**Defer non-critical CSS:**\n```html\n\u003C!-- Critical CSS inlined -->\n\u003Cstyle>\u002F* Above-fold styles *\u002F\u003C\u002Fstyle>\n\n\u003C!-- Non-critical CSS -->\n\u003Clink rel=\"preload\" href=\"\u002Fstyles.css\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\">\n\u003Cnoscript>\u003Clink rel=\"stylesheet\" href=\"\u002Fstyles.css\">\u003C\u002Fnoscript>\n```\n\n### JavaScript optimization\n\n**Defer non-essential scripts:**\n```html\n\u003C!-- Parser-blocking (avoid) -->\n\u003Cscript src=\"\u002Fcritical.js\">\u003C\u002Fscript>\n\n\u003C!-- Deferred (preferred) -->\n\u003Cscript defer src=\"\u002Fapp.js\">\u003C\u002Fscript>\n\n\u003C!-- Async (for independent scripts) -->\n\u003Cscript async src=\"\u002Fanalytics.js\">\u003C\u002Fscript>\n\n\u003C!-- Module (deferred by default) -->\n\u003Cscript type=\"module\" src=\"\u002Fapp.mjs\">\u003C\u002Fscript>\n```\n\n**Code splitting patterns:**\n```javascript\n\u002F\u002F Route-based splitting\nconst Dashboard = lazy(() => import('.\u002FDashboard'));\n\n\u002F\u002F Component-based splitting\nconst HeavyChart = lazy(() => import('.\u002FHeavyChart'));\n\n\u002F\u002F Feature-based splitting\nif (user.isPremium) {\n  const PremiumFeatures = await import('.\u002FPremiumFeatures');\n}\n```\n\n**Tree shaking best practices:**\n```javascript\n\u002F\u002F ❌ Imports entire library\nimport _ from 'lodash';\n_.debounce(fn, 300);\n\n\u002F\u002F ✅ Imports only what's needed\nimport debounce from 'lodash\u002Fdebounce';\ndebounce(fn, 300);\n```\n\n## Image optimization\n\n### Format selection\n| Format | Use case | Browser support |\n|--------|----------|-----------------|\n| AVIF | Photos, best compression | 92%+ |\n| WebP | Photos, good fallback | 97%+ |\n| PNG | Graphics with transparency | Universal |\n| SVG | Icons, logos, illustrations | Universal |\n\n### Responsive images\n```html\n\u003Cpicture>\n  \u003C!-- AVIF for modern browsers -->\n  \u003Csource \n    type=\"image\u002Favif\"\n    srcset=\"hero-400.avif 400w,\n            hero-800.avif 800w,\n            hero-1200.avif 1200w\"\n    sizes=\"(max-width: 600px) 100vw, 50vw\">\n  \n  \u003C!-- WebP fallback -->\n  \u003Csource \n    type=\"image\u002Fwebp\"\n    srcset=\"hero-400.webp 400w,\n            hero-800.webp 800w,\n            hero-1200.webp 1200w\"\n    sizes=\"(max-width: 600px) 100vw, 50vw\">\n  \n  \u003C!-- JPEG fallback -->\n  \u003Cimg \n    src=\"hero-800.jpg\"\n    srcset=\"hero-400.jpg 400w,\n            hero-800.jpg 800w,\n            hero-1200.jpg 1200w\"\n    sizes=\"(max-width: 600px) 100vw, 50vw\"\n    width=\"1200\" \n    height=\"600\"\n    alt=\"Hero image\"\n    loading=\"lazy\"\n    decoding=\"async\">\n\u003C\u002Fpicture>\n```\n\n### LCP image priority\n```html\n\u003C!-- Above-fold LCP image: eager loading, high priority -->\n\u003Cimg \n  src=\"hero.webp\" \n  fetchpriority=\"high\"\n  loading=\"eager\"\n  decoding=\"sync\"\n  alt=\"Hero\">\n\n\u003C!-- Below-fold images: lazy loading -->\n\u003Cimg \n  src=\"product.webp\" \n  loading=\"lazy\"\n  decoding=\"async\"\n  alt=\"Product\">\n```\n\n## Font optimization\n\n### Loading strategy\n```css\n\u002F* System font stack as fallback *\u002F\nbody {\n  font-family: 'Custom Font', -apple-system, BlinkMacSystemFont, \n               'Segoe UI', Roboto, sans-serif;\n}\n\n\u002F* Prevent invisible text *\u002F\n@font-face {\n  font-family: 'Custom Font';\n  src: url('\u002Ffonts\u002Fcustom.woff2') format('woff2');\n  font-display: swap; \u002F* or optional for non-critical *\u002F\n  font-weight: 400;\n  font-style: normal;\n  unicode-range: U+0000-00FF; \u002F* Subset to Latin *\u002F\n}\n```\n\n### Preloading critical fonts\n```html\n\u003Clink rel=\"preload\" href=\"\u002Ffonts\u002Fheading.woff2\" as=\"font\" type=\"font\u002Fwoff2\" crossorigin>\n```\n\n### Variable fonts\n```css\n\u002F* One file instead of multiple weights *\u002F\n@font-face {\n  font-family: 'Inter';\n  src: url('\u002Ffonts\u002FInter-Variable.woff2') format('woff2-variations');\n  font-weight: 100 900;\n  font-display: swap;\n}\n```\n\n## Caching strategy\n\n### Cache-Control headers\n```\n# HTML (short or no cache)\nCache-Control: no-cache, must-revalidate\n\n# Static assets with hash (immutable)\nCache-Control: public, max-age=31536000, immutable\n\n# Static assets without hash\nCache-Control: public, max-age=86400, stale-while-revalidate=604800\n\n# API responses\nCache-Control: private, max-age=0, must-revalidate\n```\n\n### Service worker caching\n```javascript\n\u002F\u002F Cache-first for static assets\nself.addEventListener('fetch', (event) => {\n  if (event.request.destination === 'image' ||\n      event.request.destination === 'style' ||\n      event.request.destination === 'script') {\n    event.respondWith(\n      caches.match(event.request).then((cached) => {\n        return cached || fetch(event.request).then((response) => {\n          const clone = response.clone();\n          caches.open('static-v1').then((cache) => cache.put(event.request, clone));\n          return response;\n        });\n      })\n    );\n  }\n});\n```\n\n## Runtime performance\n\n### Avoid layout thrashing\n```javascript\n\u002F\u002F ❌ Forces multiple reflows\nelements.forEach(el => {\n  const height = el.offsetHeight; \u002F\u002F Read\n  el.style.height = height + 10 + 'px'; \u002F\u002F Write\n});\n\n\u002F\u002F ✅ Batch reads, then batch writes\nconst heights = elements.map(el => el.offsetHeight); \u002F\u002F All reads\nelements.forEach((el, i) => {\n  el.style.height = heights[i] + 10 + 'px'; \u002F\u002F All writes\n});\n```\n\n### Debounce expensive operations\n```javascript\nfunction debounce(fn, delay) {\n  let timeout;\n  return (...args) => {\n    clearTimeout(timeout);\n    timeout = setTimeout(() => fn(...args), delay);\n  };\n}\n\n\u002F\u002F Debounce scroll\u002Fresize handlers\nwindow.addEventListener('scroll', debounce(handleScroll, 100));\n```\n\n### Use requestAnimationFrame\n```javascript\n\u002F\u002F ❌ May cause jank\nsetInterval(animate, 16);\n\n\u002F\u002F ✅ Synced with display refresh\nfunction animate() {\n  \u002F\u002F Animation logic\n  requestAnimationFrame(animate);\n}\nrequestAnimationFrame(animate);\n```\n\n### Virtualize long lists\n```javascript\n\u002F\u002F For lists > 100 items, render only visible items\n\u002F\u002F Use libraries like react-window, vue-virtual-scroller, or native CSS:\n.virtual-list {\n  content-visibility: auto;\n  contain-intrinsic-size: 0 50px; \u002F* Estimated item height *\u002F\n}\n```\n\n### Smooth navigations with View Transitions\n\nThe [View Transitions API](https:\u002F\u002Fdeveloper.chrome.com\u002Fdocs\u002Fweb-platform\u002Fview-transitions) 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.\n\n**Same-document (SPA-style) — Baseline 2026:**\n```javascript\n\u002F\u002F Wrap the DOM mutation that swaps the view\nfunction navigate(newView) {\n  if (!document.startViewTransition) return swapDOM(newView);\n  document.startViewTransition(() => swapDOM(newView));\n}\n```\n\n**Cross-document (MPA-style) — Chromium-stable, progressive enhancement elsewhere:**\n```css\n\u002F* On both source and destination pages *\u002F\n@view-transition { navigation: auto; }\n```\nThat'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`:\n```css\n.product-thumb[data-id=\"42\"], .product-hero { view-transition-name: product-42; }\n```\n\nPair this with Speculation Rules (above) for instant + animated navigations.\n\n## Third-party scripts\n\n### Load strategies\n```javascript\n\u002F\u002F ❌ Blocks main thread\n\u003Cscript src=\"https:\u002F\u002Fanalytics.example.com\u002Fscript.js\">\u003C\u002Fscript>\n\n\u002F\u002F ✅ Async loading\n\u003Cscript async src=\"https:\u002F\u002Fanalytics.example.com\u002Fscript.js\">\u003C\u002Fscript>\n\n\u002F\u002F ✅ Delay until interaction\n\u003Cscript>\ndocument.addEventListener('DOMContentLoaded', () => {\n  const observer = new IntersectionObserver((entries) => {\n    if (entries[0].isIntersecting) {\n      const script = document.createElement('script');\n      script.src = 'https:\u002F\u002Fwidget.example.com\u002Fembed.js';\n      document.body.appendChild(script);\n      observer.disconnect();\n    }\n  });\n  observer.observe(document.querySelector('#widget-container'));\n});\n\u003C\u002Fscript>\n```\n\n### Facade pattern\n```html\n\u003C!-- Show static placeholder until interaction -->\n\u003Cdiv class=\"youtube-facade\" \n     data-video-id=\"abc123\" \n     onclick=\"loadYouTube(this)\">\n  \u003Cimg src=\"\u002Fthumbnails\u002Fabc123.jpg\" alt=\"Video title\">\n  \u003Cbutton aria-label=\"Play video\">▶\u003C\u002Fbutton>\n\u003C\u002Fdiv>\n```\n\n## Measurement\n\n### Key metrics\n| Metric | Target | Tool |\n|--------|--------|------|\n| LCP | \u003C 2.5s | Lighthouse, CrUX |\n| FCP | \u003C 1.8s | Lighthouse |\n| Speed Index | \u003C 3.4s | Lighthouse |\n| TBT | \u003C 200ms | Lighthouse |\n| TTI | \u003C 3.8s | Lighthouse |\n\n### Testing commands\n```bash\n# Lighthouse CLI\nnpx lighthouse https:\u002F\u002Fexample.com --output html --output-path report.html\n\n# Web Vitals library\nimport {onLCP, onINP, onCLS} from 'web-vitals';\nonLCP(console.log);\nonINP(console.log);\nonCLS(console.log);\n```\n\n## References\n\nFor Core Web Vitals specific optimizations, see [Core Web Vitals](..\u002Fcore-web-vitals\u002FSKILL.md).\n",{"name":5,"license":15,"metadata":35,"description":7},{"author":36,"version":37},"web-quality-skills","1.0","main","215248b05d6d96e163fec33f3c171019a95abd72",".claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Fperformance","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles","https:\u002F\u002Fgithub.com\u002Fthegiantbeast","https:\u002F\u002Fthegiantbeast.tech","2026-11-11 21:04:22",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add thegiantbeast\u002Fdotfiles --skill performance",{"tool":51,"command":52},"bunx","bunx skills add thegiantbeast\u002Fdotfiles --skill performance",{"tool":54,"command":55},"pnpm","pnpm dlx skills add thegiantbeast\u002Fdotfiles --skill performance","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Fperformance\u002FSKILL.md",true,[59,65,69],{"path":60,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":64},".cloud-manifest.json","REFERENCE","参考文档",156,"https:\u002F\u002Fgithub.com\u002Frotifer-protocol\u002Frotifer-playground\u002Fblob\u002Fmain\u002Fgenes\u002Ftesting-strategist\u002F.cloud-manifest.json",{"path":66,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":67,"sourceHtmlUrl":68},".gene-manifest.json",275,"https:\u002F\u002Fgithub.com\u002Frotifer-protocol\u002Frotifer-playground\u002Fblob\u002Fmain\u002Fgenes\u002Ftesting-strategist\u002F.gene-manifest.json",{"path":70,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":71,"sourceHtmlUrl":72},"phenotype.json",2172,"https:\u002F\u002Fgithub.com\u002Frotifer-protocol\u002Frotifer-playground\u002Fblob\u002Fmain\u002Fgenes\u002Ftesting-strategist\u002Fphenotype.json",[74,100,115,124,138,152],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":90,"publishedAt":30},"01M6CA623HKJ9PE7HJC00DXM04","web-quality-audit","Comprehensive web quality audit covering performance, accessibility, SEO, and best practices. Use when asked to \"audit my site\", \"review web quality\", \"run lighthouse audit\", \"check page quality\", or \"optimize my website\".","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Fweb-quality-audit\u002FSKILL.md",[80,85],{"categoryNo":81,"categoryName":82,"taxonomyType":83,"taxonomyTypeDesc":84},"01JBSEEDCAT000000000000019","营销推广","SCENARIO","使用场景",{"categoryNo":86,"categoryName":87,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000035","市场营销","PROFESSION","适用职业",[19,21,91,25,92,93,24,23,94,95,96,97,98,5,99,28],"web quality audit","run","check","Lighthouse","seo","website","best practices","accessibility","review",{"skillNo":101,"name":95,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":107,"publishedAt":30},"01M6CA5Z9ZK57YANF0QTVXNNKJ","Optimize for search engine visibility and ranking. Use when asked to \"improve SEO\", \"optimize for search\", \"fix meta tags\", \"add structured data\", \"sitemap optimization\", or \"search engine optimization\".","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Fseo\u002FSKILL.md",[105,106],{"categoryNo":81,"categoryName":82,"taxonomyType":83,"taxonomyTypeDesc":84},{"categoryNo":86,"categoryName":87,"taxonomyType":88,"taxonomyTypeDesc":89},[95,108,109,110,111,19,112,25,113,28,27,114,22],"Meta","data","Optimization","search","structured data","Meta Tags","engine",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":30},"01M6CA5SHNJN3B562C279YE2BV","core-web-vitals","Optimize Core Web Vitals (LCP, INP, CLS) for better page experience and search ranking. Use when asked to \"improve Core Web Vitals\", \"fix LCP\", \"reduce CLS\", \"optimize INP\", \"page experience optimization\", or \"fix layout shifts\".","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Fcore-web-vitals\u002FSKILL.md",[],[122,19,123,27,28,25,24,22,110,111],"core web vitals","core",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":30},"01M6CA5PSD25C6WSNBEHKHR8QK","best-practices","Apply modern web development best practices for security, compatibility, and code quality. Use when asked to \"apply best practices\", \"security audit\", \"modernize code\", \"code quality review\", or \"check for vulnerabilities\".","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Fbest-practices\u002FSKILL.md",[],[97,131,28,93,25,132,133,21,134,135,19,136,137,99],"code quality","web development","security audit","code","development","vulnerabilities","security",{"skillNo":139,"name":98,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":30},"01M6CA5KGMHWYVB4M5TJK13ZM5","Audit and improve web accessibility following WCAG 2.2 guidelines. Use when asked to \"improve accessibility\", \"a11y audit\", \"WCAG compliance\", \"screen reader support\", \"keyboard navigation\", or \"make accessible\".","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fweb-quality-picks\u002Fskills\u002Faccessibility\u002FSKILL.md",[],[98,22,144,145,21,146,147,19,148,25,149,28,150,151],"WCAG","compliance","web accessibility","guidelines","support","navigation","a11y audit","reader",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":30},"01M6CA5GW3TJ8Y1CP75TB7R20S","style-maker","Interviews the user with ~10 questions about how they want Claude to talk, optionally collects writing samples they like and hate, then generates a personal Claude Code output style file and activates it. Use when the user says \"make my output style\", \"build me a custom style\", \"I want Claude to talk like...\", \"create a personal writing style\", or complains about Claude's tone and wants a tailored fix rather than a preset.","https:\u002F\u002Fgithub.com\u002Fthegiantbeast\u002Fdotfiles\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fstyle-maker\u002FSKILL.md",[],[159,160,28,27,26,161,162,134,163,164,165],"style maker","writing","how","file","create","preset","personal"]