// 39 tips in Debugging
Finding and fixing issues faster with Claude Code.
When a page takes five seconds to load or an API endpoint times out under load, tell Claude which route is slow and it traces the entire code path — controller, services, queries, loops — identifying N+1 queries, redundant computations, missing indexes, and cacheable operations, then fixes each bottleneck.
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.
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.
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.
Tell Claude to trace every import and dependency across your codebase, then show you which modules depend on which — spotting circular dependencies, God modules everything imports, and tightly coupled layers that should be independent.
Tell Claude to check that related files are in sync — models match their migrations, forms match the APIs they submit to, TypeScript types match the backend responses, and config matches what the code actually references. When they drift apart, bugs hide in the gaps.
When Claude Code isn't working right — MCP servers failing, authentication errors, or unexpected behavior — run /doctor to get a diagnostic report that checks your configuration, API connection, installed tools, and settings across all scopes so you can pinpoint what's wrong.
When a specific query is slow, run EXPLAIN on it and paste the execution plan into Claude — it reads the plan, spots full table scans, bad join orders, and missing indexes, then rewrites the query and suggests schema changes to make it fast.
When your app throws an error, paste the full stack trace into Claude Code — it reads every frame, opens the source files at the exact lines referenced, traces the actual cause, and fixes the bug, not just the symptom.
Claude Code can see images — paste a screenshot of a broken layout, a design mockup, or a browser error and Claude reads the visual context alongside your code to pinpoint what's wrong and fix it.
Tell Claude to read your backend code and find performance problems — O(n²) loops hidden in simple-looking functions, N+1 database queries, redundant API calls, missing pagination, and expensive operations inside request handlers that should be queued.
When npm install, composer update, or pip install fails with version conflicts — paste the error and Claude reads your dependency tree, identifies the incompatible versions, and tells you exactly which version constraints to change to make everything resolve.