How I Hunted Down 23 N+1 Queries in a Rails App With Claude Code
ruby
dev.to
TL;DR Our Rails app's p95 response time had crept from 280 ms to 1.4 s over a year, and nobody could say why. I paired with Claude Code for four days, found 23 N+1 queries, fixed 19 of them, and got p95 back under 400 ms. The real win wasn't the fixes, though: it was making Claude prove every N+1 with a failing test before touching the code, because the first "fix everything with includes" pass made two endpoints slower. The Problem Here's the setup: a seven-year-old Rails