performance-optimization

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

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/authrain-cloud-abdullahformuli/agent-skills --skill performance-optimization-authrain-cloud-abdullahformuli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: performance-optimization
Source: https://github.com/authrain-cloud-abdullahformuli/agent-skills/tree/main/skills/performance-optimization
Command: npx skills add https://github.com/authrain-cloud-abdullahformuli/agent-skills --skill performance-optimization-authrain-cloud-abdullahformuli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Slow applications lose users, but optimizing without measurement wastes effort on the wrong things. This Skill enforces a measure-first workflow that identifies the actual bottleneck — whether it's Core Web Vitals, N+1 queries, connection pools, or bundle size — fixes it, and verifies the improvement with before/after numbers. ## Core Features & Use Cases - Measure-First Workflow: A five-step loop (Measure, Identify, Fix, Verify, Guard) covering synthetic tools like Lighthouse and real-user monitoring via the web-vitals library. - Anti-Pattern Fixes: Concrete before/after code for N+1 queries, unbounded fetching, missing indexes, connection pool exhaustion, unoptimized images, React re-renders, large bundles, and missing caching. - Regression Guarding: Performance budgets, CI enforcement with bundlesize and Lighthouse CI, and a decision table for keeping or reverting changes based on measured results. - Use Case: Your API's p95 latency spikes 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, and re-measure to confirm the improvement before committing. ## Quick Start Ask the agent to profile the slow page or endpoint, identify the 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 Prisma's include option. Confirm the fix by checking the database query log before and after to verify only one query executes.

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

Improve Core Web Vitals by first measuring with Lighthouse or the web-vitals library, then targeting the specific bottleneck: optimize LCP images with responsive srcset and fetchpriority, reduce INP by breaking up long main-thread tasks, and set explicit image dimensions to prevent CLS.

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

Add an index only after running EXPLAIN ANALYZE to confirm the query plan shows a sequential scan or stale statistics. Index for the query shape with equality columns first, and re-run the plan afterward since an unused index still taxes every write.

Why is my connection pool exhausted and how do I fix it?

Connection pool exhaustion happens when every endpoint slows simultaneously while the database sits idle, usually from per-request pools or connections held too long. Use one pool per process sized under the database limit, and for serverless use a proxy like pgbouncer instead of raising the pool max.

Should I keep an optimization that shows no measurable improvement?

No, neutral changes should be reverted rather than kept. Code that does not beat the baseline still costs maintenance forever, so log the attempt in a performance ledger and revert it to prevent the same failed idea from being retried.