From coding-guidelines
Prevents N+1 query problems by enforcing eager loading (JOINs) or query batching when fetching related data. Use when writing or reviewing code that fetches a list and then queries related data per item. Do not use when the secondary queries are intentionally lazy-loaded for performance reasons and the number of items is provably small.
How this skill is triggered — by the user, by Claude, or both
Slash command
/coding-guidelines:avoid-n-1-queriesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Do not issue a database query inside a loop that iterates over the results of another query. Use **Eager Loading** (fetching relations in the main query) or **Batching** (fetching all relations in one go).
Do not issue a database query inside a loop that iterates over the results of another query. Use Eager Loading (fetching relations in the main query) or Batching (fetching all relations in one go).
JOIN to fetch related data in a single query.WHERE id IN (...).Preload in Gorm, Include in Prisma).// 1 query
users := db.GetUsers()
for _, user := range users {
// N queries
posts := db.GetPostsByUserID(user.ID) // BAD
}
// 1 or 2 queries total
users := db.GetUsers()
// Fetch all posts for these users in one go
db.Preload("Posts").Find(&users)
npx claudepluginhub mew-ton/coding-guidelines --plugin coding-guidelinesProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.