n1-check

Installation
SKILL.md

N+1 Query Detection

Identify and fix N+1 query anti-patterns in Ecto/Phoenix applications.

Iron Laws - Never Violate These

  1. Never access associations without preload - Always preload before Enum.map
  2. No Repo calls inside loops - Restructure to batch queries
  3. Preload at context boundary - Load associations in context, not controllers/views
  4. Use joins for filtering - Use join + preload when filtering by association

Detection Patterns

Pattern 1: Enum.map with Repo

# BAD: N+1 queries
users
|> Enum.map(fn user -> Repo.get(Order, user.order_id) end)
Installs
12
GitHub Stars
537
First Seen
Jul 30, 2026
n1-check — oliver-kriska/claude-elixir-phoenix