$ recombobulate _
home / tips / ask-claude-to-find-and-fix-the-performance-bottleneck-in-a-slow-endpoint
161

Ask Claude to Find and Fix the Performance Bottleneck in a Slow Endpoint

recombobulate @recombobulate · Mar 30, 2026 · Debugging
ask-claude-to-find-and-fix-the-performance-bottleneck-in-a-slow-endpoint

Performance problems rarely have a single cause. A slow endpoint is usually death by a thousand cuts — a query inside a loop, a missing index, an eager load that should be lazy, a computation that runs on every request but could be cached. Claude traces the full path and finds them all.

> the /dashboard endpoint takes 4 seconds to load — read the route,
> controller, and everything it calls, then find what's making it slow

Claude follows the request from the route through the controller, into services and repositories, reads every query, and identifies performance problems at each layer — not just one fix, but every bottleneck in the chain.

Common issues Claude spots:

> # N+1 queries
> You're loading 50 users, then querying each user's orders in a loop.
> Fix: eager load with ->with('orders')

> # Missing database indexes
> This WHERE clause filters on email + status but there's no
> composite index — every query does a full table scan

> # Redundant computation
> This discount calculation runs for every item in the cart but
> the result is the same each time — compute it once outside the loop

> # Cacheable data
> This settings query hits the database on every single request
> but the data only changes when an admin updates it — cache it

You can also provide timing data for more targeted analysis:

> this endpoint is slow — here's the query log showing 147 queries
> taking 3.2 seconds total. Find the worst offenders and fix them

> the /reports/monthly endpoint times out with large datasets —
> it works fine with 100 records but fails with 10,000

Claude doesn't just identify issues — it fixes them in place. It adds eager loading, creates migration files for missing indexes, extracts repeated computations, wraps slow data in cache calls, and replaces inefficient algorithms with better ones.

Performance isn't about one silver bullet — it's about finding every bottleneck in the chain. Claude reads the whole path and fixes them all.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
149
Ask Claude to Diagnose and Fix Flaky Tests That Pass Sometimes and Fail Randomly

Flaky tests are maddening — they pass locally, fail in CI, pass again when you retry. Tell Claude to read the test, identify the source of non-determinism — timing issues, shared state, date dependencies, or order-dependent setup — and fix the root cause so the test is reliably green or reliably red.

recombobulate @recombobulate · 1 day ago
148
Paste an Error Message or Stack Trace and Let Claude Trace It to the Root Cause

When your app throws an error, don't just Google the message — paste the full stack trace into Claude Code. It reads the trace, opens the referenced files in your codebase, follows the call chain, and pinpoints the actual root cause instead of just explaining the symptom.

recombobulate @recombobulate · 1 day ago
127
Drop Screenshots into Claude Code to Debug Visual Issues and Read Error Messages

Claude Code can see images — paste a screenshot of a broken UI, a confusing error dialog, terminal output, or a design mockup and Claude reads it visually, understands the context, and helps you fix the problem or implement the design without you having to transcribe anything.

recombobulate @recombobulate · 1 day ago