Install any skill in seconds. Free to start, no credit card required.
Get Started Free →oliver-kriska/n1-check
Compatibility alias for the Elixir/Phoenix plugin's N+1 query checker. Invoke explicitly with /ecto:n1-check.
Passed 11 of 21 test cases with the skill, and 11 of 21 without it.
2 fixed19 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
A test case the skill fixed. Same model, same prompt, with and without the skill.
Is it permissible in Ecto applications to invoke `Repo.insert` inside `Enum.each` when processing a collection of 5 elements, or should batching be enforced?
| Checked | Without skill | With skill |
|---|---|---|
| States that Repo calls inside loops are prohibited regardless of collection size | Missed | Passed |
The instructions your model reads when the skill loads.
Identify and fix N+1 query anti-patterns in Ecto/Phoenix applications.
Enum.mapjoin + preload when filtering by association# BAD: N+1 queries
users
|> Enum.map(fn user -> Repo.get(Order, user.order_id) end)
# GOOD: Single query with preload
users
|> Repo.preload(:orders)
# BAD: Lazy loading triggers N queries
for user <- users do
user.posts # Triggers query for each user!
end
# GOOD: Eager load first
users = Repo.all(User) |> Repo.preload(:posts)
for user <- users do
user.posts # Already loaded
end
test cases passed, vs 11 / 21 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.