performance-optimization
What it does
This tool helps identify and fix slowness in applications. It measures performance, finds the bottleneck, and suggests how to fix it, ensuring the application runs faster for users.
When to use it
- βWhen the application is slow to load.
- βWhen users complain about slowness.
- βWhen performance metrics (like Core Web Vitals) are low.
Skill link
https://github.com/addyosmani/agent-skills/blob/main/skills/performance-optimization/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βMy website is taking too long to load, can you help me optimize its performance?β
5 new skills a week. 1 minute to read.
How it works
The tool first measures the application's current performance to understand where the problem lies. Then, it focuses on fixing that specific point without changing anything else, and verifies if the improvement was real.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Performance Optimization
Overview
Measure before optimizing. Performance work without measurement is guessing β and guessing leads to premature optimization that adds complexity without improving what matters. Profile first, identify the actual bottleneck, fix it, measure again. Optimize only what measurements prove matters.
When to Use
- Performance requirements exist in the spec (load time budgets, response time SLAs)
- Users or monitoring report slow behavior
- Core Web Vitals scores are below thresholds
- You suspect a change introduced a regression
- Building features that handle large datasets or high traffic
When NOT to use: Don't optimize before you have evidence of a problem. Premature optimization adds complexity that costs more than the performance it gains.
Core Web Vitals Targets
| Metric | Good | Needs Improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | β€ 2.5s | β€ 4.0s | > 4.0s |
| INP (Interaction to Next Paint) | β€ 200ms | β€ 500ms | > 500ms |
| CLS (Cumulative Layout Shift) | β€ 0.1 | β€ 0.25 | > 0.25 |
The Optimization Workflow
1. MEASURE β Establish baseline with real data
2. IDENTIFY β Find the actual bottleneck (not assumed)
3. FIX β Address the specific bottleneck
4. VERIFY β Measure again; keep or revert
5. GUARD β Add monitoring or tests to prevent regression
Step 1: Measure
Two complementary approaches β use both:
- Synthetic (Lighthouse, DevTools Performance tab): Controlled conditions, reproducible. Best for CI regression detection and isolating specific issues.
- RUM (web-vitals library, CrUX): Real user data in real conditions. Required to validate that a fix actually improved user experience.
Frontend:
// Synthetic: Lighthouse in Chrome DevTools (or CI)
// Chrome DevTools β Performance tab β Record
// Chrome DevTools MCP β Performance trace
// RUM: Web Vitals library in code
import { onLCP, onINP, onCLS } from 'web-vitals';
onLCP(console.log);
onINP(console.log);
onCLS(console.log);
Backend:
// Response time logging
// Application Performance Monitoring (APM)
// Database query logging with timing
// Simple timing
console.time('db-query');
const result = await db.query(...);
console.timeEnd('db-query');
Where to Start Measuring
Use the symptom to decide what to measure first:
What is slow?
βββ First page load
β βββ Large bundle? --> Measure bundle size, check code splitting
β βββ Slow server response? --> Measure TTFB in DevTools Network waterfall
β β βββ DNS long? --> Add dns-prefetch / preconnect for known origins
β β βββ TCP/TLS long? --> Enable HTTP/2, check edge deployment, keep-alive
β β βββ Waiting (server) long? --> Profile backend, check queries and caching
β βββ Render-blocking resources? --> Check network waterfall for CSS/JS blocking
βββ Interaction feels sluggish
β βββ UI freezes on click? --> Profile main thread, look for long tasks (>50ms)
β βββ Form input lag? --> Check re-renders, controlled component overhead
β βββ Animation jank? --> Check layout thrashing, forced reflows
βββ Page after navigation
β βββ Data loading? --> Measure API response times, check for waterfalls
β βββ Client rendering? --> Profile component render time, check for N+1 fetches
βββ Backend / API
βββ Single endpoint slow? --> Profile database queries, check indexes
βββ All endpoints slow? --> Check connection pool, memory, CPU
βββ Intermittent slowness? --> Check for lock contention, GC pauses, external deps
Step 2: Identify the Bottleneck
Common bottlenecks by category:
Frontend:
| Symptom | Likely Cause | Investigation |
|---|---|---|
| Slow LCP | Large images, render-blocking resources, slow server | Check network waterfall, image sizes |
| High CLS | Images without dimensions, late-loading content, font shifts | Check layout shift attribution |
| Poor INP | Heavy JavaScript on main thread, large DOM updates | Check long tasks in Performance trace |
| Slow initial load | Large bundle, many network requests | Check bundle size, code splitting |
Backend:
| Symptom | Likely Cause | Investigation |
|---|---|---|
| Slow API responses | N+1 queries, missing indexes, unoptimized queries | Check database query log |
| Memory growth | Leaked references, unbounded caches, large payloads | Heap snapshot analysis |
β¦
FAQ
What are Core Web Vitals?
These are metrics that measure the user experience regarding page loading speed, interactivity, and visual stability.
What is a performance bottleneck?
It's the part of the application causing the overall slowness, such as a slow database query or code that takes a long time to process.
Should I optimize before measuring?
No. It's important to measure first to know exactly where the problem is. Optimizing without measuring can make things worse or add unnecessary complexity.
Details
Original description by the author
Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.
repo: addyosmani/agent-skills
Popularity
- GitHub stars
- 107k
- Ranking position
- #778
- License
- MIT
- Updated
- 10/13/2026
Comments
- β¦
More skills from this repository
api-and-interface-design
107kHelps create well-defined APIs and interfaces. It's useful when designing how different parts of software will communicate.
browser-testing-with-devtools
107kHelps your agent test code directly in real browsers. It's useful for checking how something works in the environment where it will be used, finding errors and performance issues.
ci-cd-and-automation
107kTeaches your AI agent to automate repetitive tasks and ship projects and manage infrastructure.
code-review-and-quality
107kPerforms detailed code reviews on multiple fronts. It's useful before merging new changes to ensure quality and prevent future problems.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.