Performance work usually fails the same way: a team spends a week chasing a 5ms backend win while three seconds of render-blocking CSS sit untouched on the frontend, or adds three layers of cache with no invalidation plan and ships a stale-data bug. These prompts force the opposite shape — measure first, name the biggest user-visible bottleneck, then apply the smallest fix that moves the metric. Includes the diff prompt that catches regressions disguised as noise, and a premature-optimization detector that scans your last 5 perf PRs for “added complexity, no measured win”. Pair with the bug audit prompts when slowness turns out to be a correctness bug.
Best for
- Web app performance audits
- Backend latency reduction
- Database query tuning
- Bundle-size reduction
- Core Web Vitals optimization
1. Bottleneck identifier
Below: my performance data ({Lighthouse / APM / DB slow log}). Identify the top 3 bottlenecks. For each: where it shows up, estimated user impact, smallest fix that helps, downside of the fix.
{paste data}
2. Largest Contentful Paint (LCP) fix
My LCP is {X} seconds; target is {Y}. Below: my HTML / critical CSS / image loading. Diagnose: (a) what is the LCP element, (b) what blocks its render, (c) the smallest set of changes that get to {Y}.
{paste}
3. Cumulative Layout Shift (CLS) fix
My CLS is {X}; target is <0.1. Below: my above-the-fold HTML and CSS. Find the shifting elements, name the cause (images without dimensions, fonts swapping, late-injected content), and propose fixes.
{paste}
4. Slow-query identifier
Below: my slow query log + EXPLAIN plans. For each top-5 query: (a) why it is slow, (b) missing index or query rewrite, (c) expected gain, (d) risk of the fix.
{paste}
5. N+1 query finder
Below: ORM query log for a single page request. Find N+1 patterns: which loop generates how many sub-queries, what to eager-load, what to batch. Output the fix in ORM syntax.
{paste}
6. JS bundle-size reducer
Below: my webpack / vite bundle analysis. Identify top 5 size offenders. For each: (a) is it tree-shakable, (b) is there a lighter alternative, (c) is it lazy-loadable, (d) estimated kB saved.
{paste}
7. Render-blocking-resource fix
My page has {N} render-blocking resources. Below: the HTML head. Propose: (a) which to inline, (b) which to defer / async, (c) which to preload, (d) which to remove. Explain the ordering rationale.
{paste}
8. Server-response-time reducer
My TTFB is {X}ms; target is <{Y}ms. Below: my server handler. Walk through: (a) what work happens before first byte, (b) what can be parallelized / moved off the critical path, (c) what to cache.
{paste handler}
9. Memory-leak finder
My {Node / browser app} has growing memory over time. Below: heap snapshots / profiler output. Identify the leak: (a) what is retained, (b) why it is retained, (c) the closure / listener / cache to fix.
{paste}
10. Cache-strategy designer
My {endpoint / page} has {N} req/s. Below: response shape + cacheability constraints. Design the cache strategy: edge / CDN / app / DB layers, invalidation triggers, hit-rate target.
{paste}
11. Image-optimization audit
Below: 10 images on my page with their current size, format, dimensions. For each: (a) target format (AVIF / WebP), (b) target width and srcset, (c) loading strategy (eager / lazy), (d) estimated bytes saved.
{paste}
12. Web Vitals diff (before / after)
Below: Web Vitals before my changes ({paste}) and after ({paste}). Tell me: (a) what actually improved, (b) what got worse, (c) what is statistically noise vs signal, (d) what to ship vs revert.
13. Premature-optimization detector
Below: my recent perf changes ({paste 5 PRs}). For each, ask: (a) was there a measured before / after, (b) was the bottleneck real, (c) what was the actual user-visible win, (d) which should be reverted as code-complexity-for-no-gain.
Common mistakes
- Optimizing without measuring first — guessing at the bottleneck wastes the sprint
- Chasing 5ms backend wins while 3 seconds of render-blocking frontend sit ignored
- Adding caches with no invalidation plan, then shipping a stale-data bug instead of a perf fix
- Lazy-loading above-the-fold images, which makes LCP worse, not better
- Micro-optimizations that hurt readability for 0.1% gain — and never get reverted
- No before/after measurement, so “performance work” lives forever as a story without proof
Related
- Bug audit prompts
- Security audit prompts
- Database schema review prompts
- React component refactor prompts
- Deployment check prompts
Tags: #Prompt #AI coding #AI coding