
Performance Optimization
Improve measured bottlenecks and Core Web Vitals using profile-first optimization instead of premature tweaks.
Overview
performance-optimization is an agent skill most often used in Ship (also Grow, Operate) that profiles real bottlenecks and improves Core Web Vitals and load times only where measurement proves it matters.
Install
npx skills add https://github.com/addyosmani/agent-skills --skill performance-optimizationWhat is this skill?
- Explicit anti-pattern: do not optimize without measurement evidence
- Core Web Vitals threshold table for LCP, INP, and CLS (good / needs improvement / poor)
- Workflow: measure baseline → identify bottleneck → fix → measure again
- Applies when specs define SLAs, monitoring reports slowness, or large traffic/data paths
- Profiling-driven fixes rather than speculative micro-optimizations
- Core Web Vitals table covers 3 metrics: LCP, INP, CLS
- LCP good threshold ≤ 2.5s; INP ≤ 200ms; CLS ≤ 0.1
Adoption & trust: 4.3k installs on skills.sh; 49.1k GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+200% hot-view momentum).
What problem does it solve?
Users or dashboards report slow experiences but you lack a baseline and keep changing code without knowing which metric actually fails.
Who is it for?
Solo builders shipping customer-facing web apps who have SLA or Core Web Vitals gaps backed by traces or field data.
Skip if: Early prototypes with no users and no performance requirements—premature optimization is explicitly out of scope.
When should I use this skill?
Performance requirements exist, suspected regressions, Core Web Vitals or load times need improvement, or profiling reveals bottlenecks to fix.
What do I get? / Deliverables
You establish measured baselines, fix proven bottlenecks, and re-verify LCP, INP, CLS or SLA targets before shipping.
- Baseline and post-fix measurement report against Vitals or SLA
- Identified bottleneck with targeted fix (not speculative refactors)
- Verification that poor-tier metrics moved to good or needs-improvement where required
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Performance budgets and regression fixes belong in Ship before you call a release ready for real users. Perf subphase is where LCP, INP, and CLS targets and load-time SLAs are validated and improved with evidence.
Where it fits
Re-measure LCP after lazy-loading hero images before tagging a release as production-ready.
Use field Vitals reports to pick the one route that drives most poor INP scores.
Respond to an APM latency spike by profiling the hot path instead of rolling back blindly.
Set bundle and render budgets while building a data-heavy dashboard feature.
How it compares
Use as a measure-fix-verify loop instead of generic refactor advice that skips profiling and Vitals thresholds.
Common Questions / FAQ
Who is performance-optimization for?
Indie builders responsible for frontend perceived speed and interaction latency who need Vitals-aligned targets and a profiling workflow.
When should I use performance-optimization?
Use it in Ship when fixing regressions before release; in Grow when analytics show poor Vitals in production; in Operate when monitoring alerts on latency; and in Build when designing high-traffic or large-data features that need budgets up front.
Is performance-optimization safe to install?
It guides analysis and code changes; review the Security Audits panel on this Prism page and run profiling in staging before applying aggressive caching or bundle changes in production.
SKILL.md
READMESKILL.md - Performance Optimization
# 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, confirm improvement 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:** ```bash # 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:** ```bash # 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 | Investig