web-perf
Skill2 starsChanged 6 months agoMITView on GitHub
Diagnose and fix web performance through a disciplined measure-first loop. Forces evidence-based optimization: measure → identify bottleneck → fix ONE thing → re-measure → repeat. Prevents guessing. Use when pages load slowly, user mentions performance, LCP, INP, CLS, lighthouse, bundle size, or "make it faster".
24 other projects use a version of this.
Adopted by
Most recently taken up by
- hencter/hencte.toptheir own version, first seen Oct 4, 2026
- Quad4-Software/skillstheir own version, first seen Oct 3, 2026
- cloudflare/skillstheir own version, first seen Oct 1, 2026
- casoon/ai-agent-configtheir own version, first seen Sep 27, 2026
- meowdiocre/meowpitheir own version, first seen Sep 19, 2026
- transitive-bullshit/skillstheir own version, first seen Sep 19, 2026
Used with
Projects with it also use sandbox-stable, cloudflare-one and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
CloudflareSkillsandbox-stable
Build or maintain Cloudflare Sandbox apps on the stable @cloudflare/sandbox package. Use sandbox-next for preview apps and sandbox-migrate-to-next for stable-to-preview migrations.
Also in 4 projects that use this
CloudflareSkillcloudflare-one
Design, configure, troubleshoot, or review Cloudflare One Zero Trust and SASE deployments. Use cloudflare-one-migrations for migration planning from other vendors.
Also in 11 projects that use this
OpenAISkillplaywright
Use when the task requires automating a real browser from the terminal (navigation, form filling, snapshots, screenshots, data extraction, UI-flow debugging) via `playwright-cli` or the bundled wrapper script.
Also in 4 projects that use this
AWSSkillresolving-merge-conflicts
Use when you need to resolve an in-progress git merge/rebase conflict.
Also in 3 projects that use this
AWSSkillgrilling
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
Also in 5 projects that use this
VercelSkillweb-design-guidelines
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".
Also in 4 projects that use this
- +3 more from cloudflare
- +2 more from aws
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 24
- openai/plugins★ 7.3ksame name
- cloudflare/skills★ 3ksame name
- secondsky/sap-skills★ 458same name
- swyxio/skills★ 171same name
- open-fox/agents★ 55same name
- PanPanFR/oh-my-kilo★ 12same name
- kevyder/banrepco_mcp★ 9same name
- PanPanFR/oh-my-openkilo★ 9same name
- transitive-bullshit/skills★ 3same name
- adrienlupo/Claude-code-config★ 2same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- skill-forgeSkill
- ai-debt-detectorSkill
- arch-from-codeSkill
- context-builderSkill
- db-schemaSkill
- design-modeSkill
- diagnoseSkill
- dynamic-workflowSkill
- error-resilienceSkill
- git-workflowSkill
- grillSkill
- handoffSkill
- mcp-conductorSkill
- prove-itSkill
- self-reviewSkill
- session-guardSkill
- setupSkill
- zoom-outSkill
The file
Files
Overview
Measure-first performance optimization loop — measure baseline, identify the worst metric, fix ONE thing, re-measure. Prevents guessing and proves every optimization with before/after numbers.
Web Performance Optimization
Persistence
ACTIVE whenever performance is the goal. Never optimize without measuring first. Never declare "faster" without before/after numbers.
The Loop (never skip steps)
1. MEASURE — get baseline numbers (Lighthouse, bundle size, TTFB)
2. IDENTIFY — which metric is worst? (LCP? INP? CLS? TTFB?)
3. DIAGNOSE — what's causing THAT specific metric to be bad?
4. FIX ONE THING — smallest change that moves the needle
5. RE-MEASURE — did the number actually improve? By how much?
6. REPEAT — next worst metric. Never fix two things at once.Why This Order Matters
Without measuring first: you optimize something that wasn't the bottleneck. Wasted work. Without re-measuring: you "optimized" but might have made it worse (happens more than you think). Fixing two things at once: you don't know which one helped (or hurt).
# Lighthouse CI (if available)
npx lighthouse https://your-site.com --output json --output-path ./lh-report.json
# Bundle analysis (Next.js / Vite / Webpack)
npx next build --analyze # Next.js
npx vite-bundle-visualizer # Vite
npx webpack-bundle-analyzer stats.json # WebpackCore Web Vitals Targets
| Metric | Good | Needs Work | Poor | What It Measures |
| LCP | < 2.5s | 2.5-4.0s | > 4.0s | Largest visible element render time |
| INP | < 200ms | 200-500ms | > 500ms | Responsiveness to user input |
| CLS | < 0.1 | 0.1-0.25 | > 0.25 | Visual stability (layout shifts) |
Fix by Metric
LCP (Largest Contentful Paint)
Most common causes and fixes:
- Render-blocking resources
<!-- BAD: blocks render -->
<link rel="stylesheet" href="styles.css">
<script src="app.js"></script>
<!-- GOOD: non-blocking -->
<link rel="stylesheet" href="critical.css">
<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'">
<script src="app.js" defer></script>- Unoptimized hero image
<!-- BAD -->
<img src="hero.png" width="1920" height="1080">
<!-- GOOD: responsive, modern format, preloaded, sized -->
<link rel="preload" as="image" href="hero.webp" fetchpriority="high">
<img src="hero.webp" width="1920" height="1080"
srcset="hero-480.webp 480w, hero-960.webp 960w, hero-1920.webp 1920w"
sizes="100vw" alt="Hero" fetchpriority="high" decoding="async">- Slow server response (TTFB)
Fixes:
- Enable CDN (Cloudflare, Vercel Edge, AWS CloudFront)
- Server-side caching (Redis, in-memory)
- Database query optimization (indexes, connection pooling)
- Reduce redirect chains
- Use HTTP/2 or HTTP/3- Client-side rendering bottleneck
Fixes:
- SSR/SSG for above-fold content (Next.js, Nuxt, Astro)
- Stream HTML with React Suspense
- Inline critical CSS (< 14KB)
- Preconnect to required originsINP (Interaction to Next Paint)
Most common causes and fixes:
- Long tasks blocking main thread
// BAD: 200ms synchronous work
function handleClick() {
processLargeDataset(data); // blocks for 200ms
updateUI();
}
// GOOD: yield to browser between chunks
async function handleClick() {
for (const chunk of chunks(data, 100)) {
processChunk(chunk);
await scheduler.yield(); // let browser paint
}
updateUI();
}- Heavy event handlers
// BAD: re-render entire list on each keystroke
input.addEventListener('input', () => renderList(filter(items)));
// GOOD: debounce + startTransition
input.addEventListener('input', debounce(() => {
startTransition(() => renderList(filter(items)));
}, 150));- JavaScript bundle too large
Fixes:
- Code split by route (dynamic import)
- Tree-shake unused code
- Replace heavy libraries (moment→dayjs, lodash→lodash-es)
- Defer non-critical JS
- Use web workers for computationCLS (Cumulative Layout Shift)
Most common causes and fixes:
- Images without dimensions
<!-- BAD: causes shift when image loads -->
<img src="photo.jpg">
<!-- GOOD: aspect ratio reserved -->
<img src="photo.jpg" width="800" height="600">
<!-- Or with CSS aspect-ratio -->
<img src="photo.jpg" style="aspect-ratio: 4/3; width: 100%">- Dynamic content insertion
/* Reserve space for dynamic content (ads, embeds) */
.ad-slot { min-height: 250px; }
.embed-container { aspect-ratio: 16/9; }- Web fonts causing FOUT
/* Prevent layout shift from font swap */
@font-face {
font-family: 'Custom';
src: url('font.woff2') format('woff2');
font-display: swap;
size-adjust: 100.5%; /* match fallback metrics */
ascent-override: 95%;
descent-override: 22%;
}Optimization Checklist
Critical Path
- Inline critical CSS (< 14KB)
- Preload LCP image with
fetchpriority="high" - Preconnect to third-party origins
- Defer non-critical JavaScript
- Remove unused CSS (PurgeCSS / Tailwind purge)
Images
- Use WebP/AVIF format
- Responsive srcset with proper sizes
- Lazy-load below-fold images (
loading="lazy") - Set explicit width/height on all images
- Use CDN for image delivery
JavaScript
- Code-split by route
- Tree-shake (ESM imports only)
- Dynamic import for heavy components
- Web worker for CPU-intensive work
- Remove unused polyfills
Caching
- Immutable assets:
Cache-Control: max-age=31536000, immutable - HTML:
Cache-Control: no-cache(revalidate) - Service Worker for offline + cache-first static assets
- CDN cache with proper purge strategy
Fonts
- Self-host fonts (avoid Google Fonts render-blocking)
- Preload critical font files
- Use
font-display: swapwith size-adjust - Subset fonts to required characters only
Framework-Specific
Next.js
// next.config.js optimizations
module.exports = {
images: { formats: ['image/avif', 'image/webp'] },
experimental: { optimizeCss: true },
compiler: { removeConsole: { exclude: ['error'] } }
};Vite
// vite.config.js
export default {
build: {
rollupOptions: { output: { manualChunks: { vendor: ['react', 'react-dom'] } } },
cssCodeSplit: true,
minify: 'terser'
}
};Common Mistakes
- Optimizing without measuring first (you might fix the wrong thing)
- Adding
loading="lazy"to above-fold images (hurts LCP) - Excessive preloading (everything preloaded = nothing prioritized)
- Client-side rendering when SSR would eliminate the LCP problem entirely
- Focusing on bundle size when the real bottleneck is TTFB
- Using
will-changeon everything (wastes GPU memory)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

