Debug a Performance Issue
Workflow for identifying and fixing performance bottlenecks
CLAUDE.md
When debugging a performance issue:
- Define the problem clearly: what’s slow, how slow, and what’s the acceptable target?
- Profile the code. Use browser devtools, server profilers, or database query analyzers to find the bottleneck.
- Identify the single biggest contributor. Focus there — don’t scatter-optimize.
- Check common causes: N+1 queries, missing indexes, uncompressed assets, synchronous I/O, large payloads, unnecessary re-renders.
- Apply a targeted fix to the bottleneck.
- Measure again with the same profiling approach. Verify the improvement meets the target.
- If it doesn’t meet the target, profile again and address the next bottleneck.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.