performance-optimization

Diagnose and fix frontend, backend, and database performance bottlenecks through measurement-driven workflows.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/yourlabpt/yourlabpt_website --skill performance-optimization-yourlabpt
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: performance-optimization
Source: https://github.com/yourlabpt/yourlabpt_website/tree/main/projects/skills/performance-optimization
Command: npx skills add https://github.com/yourlabpt/yourlabpt_website --skill performance-optimization-yourlabpt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Slow applications, regressions, and wasted optimization effort happen when teams guess at bottlenecks instead of measuring. This Skill enforces a measure-identify-fix-verify-guard workflow so every performance change is justified by data and reverted when it does not beat the baseline. ## Core Features & Use Cases - Measurement-First Workflow: Establish baselines with synthetic tools (Lighthouse, DevTools) and real-user monitoring (web-vitals, CrUX) before changing any code. - Anti-Pattern Fixes: Concrete before/after code for N+1 queries, unbounded fetching, connection pool exhaustion, missing image optimization, React re-renders, large bundles, and caching mistakes. - Regression Guarding: Set performance budgets, enforce them in CI with bundlesize and Lighthouse CI, and log every attempt so failed ideas are not retried. - Use Case: Your API p95 latency spiked after a release. Use this Skill to profile the endpoint, find an N+1 query in the data fetching layer, fix it with a single joined query, re-measure against the baseline, and add a CI budget to prevent recurrence. ## Quick Start Ask the AI to profile your slow page or endpoint, identify the actual bottleneck, and apply a measured fix following the performance optimization workflow.

Frequently Asked Questions about performance-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix N+1 queries in my backend API?▼

Fix N+1 queries by replacing per-record lookups with a single query using a join or include clause, such as passing include: { owner: true } to an ORM findMany call. Confirm the fix by checking the database query log before and after the change.

How to improve Core Web Vitals scores like LCP and INP?▼

Improve Core Web Vitals by first measuring with Lighthouse and the web-vitals library, then targeting the failing metric: optimize hero images with responsive srcset and fetchpriority for LCP, break up long main-thread tasks for INP, and set explicit image dimensions for CLS.

When should I add a database index for a slow query?▼

Add an index only after running EXPLAIN ANALYZE and seeing a sequential scan where an index should apply. Index for the query shape with equality columns first, and skip indexing for low-selectivity filters, leading wildcards, or write-heavy tables.

Why is my connection pool exhausted and should I raise the pool size?▼

Pool exhaustion shows as all endpoints slowing at once while the database sits idle. Raising the pool size just moves the queue; instead find what holds connections, and for serverless or autoscaling workloads use a multiplexing proxy like pgbouncer or RDS Proxy.

When should I not optimize performance?▼

Do not optimize without measurement evidence of a problem, since premature optimization adds complexity without improving what matters. Also revert any change whose re-measured result falls within run-to-run variance, because neutral changes cost maintenance forever.

How do I prevent performance regressions in CI?▼

Prevent regressions by setting explicit budgets such as JavaScript under 200KB gzipped and API p95 under 200ms, then enforcing them with bundlesize and Lighthouse CI in your pipeline. Complement synthetic gates with RUM alerting on p75 movement in production.