Query Reviewer — Data & AI agent for Claude Code
Reviews Active Record queries for N+1, missing indexes, unscoped reads, aggregation done in Ruby instead of the database, and unbounded collections.
How to install Query Reviewer
Installs to ~/.claude/agents/leonidfilbert-rails-review-agents-query-reviewer.md
mkdir -p ~/.claude/agents && curl -fsSL https://raw.githubusercontent.com/LeonidFilbert/rails-review-agents/HEAD/agents/query-reviewer.md -o ~/.claude/agents/leonidfilbert-rails-review-agents-query-reviewer.md Restart Claude Code, or start a new session, for it to be picked up.
What Query Reviewer does
name: query-reviewer description: Reviews Active Record queries for N+1, missing indexes, unscoped reads, aggregation done in Ruby instead of the database, and unbounded collections. Use proactively on scopes, index actions, serializers, background jobs that query in a loop, and migrations that add a column the code then filters on. Also use when the user asks to check for N+1 or to look at why an endpoint is slow. tools: Glob, Grep, Read, Bash
Query Reviewer
You review Active Record
Alternatives in Data & AI
- Read Research For Nyquist Validation Data — cat "$phase_dir"/-RESEARCH.md 2>/dev/null node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-pha 38.5k ★
- Query Agent — Creates encapsulated, reusable query objects for complex database queries with composable scopes 652 ★
- Module Migration — Use this agent to create, review, or fix database migrations for LaraDashboard modules — handles table creatio 407 ★
Full documentation available on GitHub
View Source RepositoryRelated Agents
Efcore Perf Reviewer
Read-only Entity Framework Core performance review — N+1 query patterns, per-row database round trips inside l
DB Designer
Use when designing or changing MongoDB schemas - new collections, embedding vs referencing decisions, index st
Perf Analyzer
Detects performance issues in code changes: N+1 query patterns, missing database indexes, unnecessary re-rende
DB Check
Validate database state — pending migrations, schema consistency, missing indexes.
Rails Backend Expert
Use this agent when working on Ruby on Rails backend code, including models, controllers, services, jobs, data
Indexer Developer
Blockchain indexer expert. Use PROACTIVELY for Envio, The Graph subgraphs, event handlers, GraphQL schemas, an
Related Skills
Database Optimizer
Optimize SQL queries, design efficient indexes, and handle database migrations. Solves N+1 problems, slow quer
Analyse Queries
Analyse SQL queries and ORM code for performance issues and missing indexes
DB Health
Supabase / Postgres health audit: missing indexes, slow queries via pg_stat_statements, unused indexes, table