Optimize Application Performance
Finds and fixes performance bottlenecks - database, API, frontend, algorithm, memory - via measure-optimize-verify.
Why it matters
Identify and resolve performance bottlenecks across your application stack, from database queries to frontend rendering, ensuring a faster and more responsive user experience.
Outcomes
What it gets done
Analyze and optimize slow database queries.
Improve API response times through caching and parallelization.
Reduce frontend load times by optimizing code bundles and rendering.
Identify and fix algorithmic inefficiencies and memory leaks.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-performance-optimizer | bash Overview
Performance Optimizer
A skill that diagnoses and fixes performance bottlenecks across database queries, API endpoints, frontend rendering, algorithms, and memory usage, with a measure-optimize-verify discipline. Use it when something is actually measured as slow - a laggy app, slow page load, or slow query; avoid it for premature or micro-optimizations that trade away code readability for negligible gains.
What it does
This skill finds and fixes performance bottlenecks by measuring first, optimizing the biggest bottleneck, then verifying improvement. It covers common problems across five areas with concrete before/after fixes: database queries (N+1 queries, missing indexes, SELECT *, no pagination), API performance (no caching, sequential operations that should run in parallel via Promise.all, oversized payloads), frontend performance (unnecessary re-renders, large bundles, missing code splitting, unoptimized images), algorithm optimization (O(n squared) loops replaced with Set-based O(n) passes, repeated calculations replaced with memoization), and memory optimization (event listener leaks, loading huge files into memory instead of streaming). It also provides profiling commands for the browser (DevTools Performance tab, Lighthouse), Node.js (node --prof, clinic, autocannon), and databases (EXPLAIN ANALYZE, slow query logs), plus example performance budgets (page load under 2s, API response under 200ms, database query under 50ms, bundle under 200KB).
When to use - and when NOT to
Use it when an app is slow or laggy, a user complains about performance, page load times are high, API responses are slow, database queries take too long, or someone mentions "slow", "lag", "performance", or "optimize".
Do not use it for premature optimization - optimize when something is actually measured as slow, not preemptively. Avoid micro-optimizations that save 1ms on a page that takes 5 seconds, and don't sacrifice code readability for tiny speed gains or optimize something that's already fast enough. The skill's own checklist requires measuring current performance, identifying the bottleneck, applying the fix, measuring the improvement, and verifying no new bugs were introduced before calling an optimization done - treat its output as a substitute for that verification loop, not a replacement for it.
Inputs and outputs
Input: a description of the slow operation, page, query, or API endpoint. Output: a measured bottleneck diagnosis and a targeted before/after code fix.
// Bad: N+1 queries
const users = await db.users.find();
for (const user of users) {
user.posts = await db.posts.find({ userId: user.id }); // N queries
}
// Good: Single query with JOIN
const users = await db.users.find().populate('posts'); // 1 query
Integrations
References Chrome DevTools, Lighthouse, Node.js --prof/clinic/autocannon, SQL EXPLAIN ANALYZE, and monitoring tools like New Relic, Datadog, and Sentry Performance. Chains with @database-design for deeper query optimization, @codebase-audit-pre-push for code review, and @bug-hunter for debugging.
Who it's for
Developers diagnosing and fixing real, measured performance problems across the database, API, frontend, algorithm, or memory layers, who want a measure-first discipline rather than guessing at optimizations.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.