Avoid N+1 Queries
Batch or join database queries to avoid the N+1 pattern
CLAUDE.md
Avoid N+1 query patterns. If you’re querying in a loop, batch the queries or use a JOIN. Use an ORM’s eager loading feature when fetching related records.
Copy this block into your CLAUDE.md or agent config file to enforce it in your workflow.