The latest in AI, every dayAI News

Code · September 9, 2026

Prompt to diagnose a slow API endpoint or query

Paste the endpoint or query that's taking forever and get a diagnosis of why it's slow, with the fix explained step by step.

A slow endpoint isn't always the code's fault, sometimes it's a query missing an index or a blocking external call. This prompt turns your slow endpoint into a clear diagnosis and a fix applied directly to your code, no guessing.

For: ChatGPTClaude
Full prompt
Act as a backend engineer who's an expert in performance and API optimization.

I have an endpoint or a query that's taking too long. Here's the context:

The endpoint or query code (paste it in full): [PASTE THE CODE]
Language or framework: [E.G. Node/Express, Python/Django, Ruby on Rails, Go]
Database it uses: [E.G. PostgreSQL, MySQL, MongoDB]
How long it's taking right now: [E.G. 4 seconds, 8 seconds, timeout]
How long it should take: [E.G. under 500ms]
Roughly how many records or users it handles: [E.G. 200,000 rows, 5,000 active users]
What you already tried (if anything): [E.G. I added an index and nothing changed]

Give me:
1. A clear diagnosis of where the bottleneck is (N+1 query, missing index, blocking external
   call, giant unpaginated payload, missing cache, etc.), explained in plain language before
   getting technical.
2. The corrected code, with the fix applied directly to what I pasted (not a generic rewrite
   from scratch).
3. A line-by-line explanation of what changed and why it fixes the slowness.
4. A short list of 2-3 things to monitor after the fix, to confirm it actually improved.

Rules: work only from the code and data I gave you. If you're missing information to diagnose
with certainty (e.g. you don't know if there's an index on that column), mark it as
[detail to verify] and tell me exactly what to check, instead of assuming.
Short link: wandabuilds.ai/p/g4WR

Come back tomorrow for another, or see all prompts.