
from mern-ninja-cc8
Guidelines and best-practice patterns for writing efficient Mongoose/MongoDB queries and avoiding common performance pitfalls (N+1, unindexed filters, unnecessa
Provides concrete patterns and code examples to write efficient MongoDB/Mongoose queries: hoisting fetches, batching with $in, using .lean(), selective projections, bulkWrite, avoiding .populate() on lists, and indexing filter fields. Helps developers reduce round-trips and eliminate N+1 problems.
Use this skill when adding or reviewing database operations in controllers or services, when building endpoints that read/write MongoDB, or when optimizing existing queries for performance and scalability. Triggers whenever a developer is about to write a new find/findById/aggregate/populate or when code reviews flag repeated queries.
Developer-assistants and code-review agents (Claude Code, Copilot-style review bots, Codex-based assistants).
A well-structured reference skill for MongoDB/Mongoose query optimization patterns. No scripts — purely instructional SKILL.md covering N+1 avoidance, batching, projection, lean queries, and bulk writes. Examples are clear, practical, and cover real-world pitfalls. Would benefit from a references/ directory or linked resources, but stands alone well as a coding guideline.
No security concerns — no scripts, no network calls, no credentials, no destructive commands. Clean frontmatter with specific trigger description. Good use of WRONG/RIGHT pattern pairs. Checklist section is practical. Common Mistakes table is a nice addition. Architecture follows the skill spec well though lacks references/ or scripts/ directories.