New advertisers: 50% off your first month with code FIRSTMONTHSee slots
mongodb avatar

Mongodb Query Optimizer

Targeted MongoDB query and index optimization that runs only when a user asks for performance help.

skills.sh installs
7.7K
GitHub stars
207
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers two workflows: diagnosing a specific query and reviewing cluster-wide slow queries from Atlas
  • Uses collection-indexes, explain, and find for query diagnosis, and atlas-get-performance-advisor for slow logs and index suggestions
  • Enforces an index-first strategy, preferring a compound index that fully covers the query, following the ESR rule
  • Designed for developers who have a MongoDB MCP server connection, with fallback to query-shape advice when tooling is unavailable

Install

$ npx -y skills add mongodb/agent-skills --skill mongodb-query-optimizer -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

MongoDB Query Optimizer

When this skill is invoked

Invoke only when the user wants:

  • Query/index optimization or performance help
  • Why a query is slow or how to speed it up
  • Slow queries on their cluster and/or how to optimize them

Do not invoke for routine query authoring unless the user has requested help with optimization, slow queries, or indexing.

High Level Workflow

General Performance Help

If the user wants to examine slow queries, or is looking for general performance suggestions (not regarding any particular query):

  • Use MongoDB MCP server atlas-get-performance-advisor tool to fetch slow query logs and performance advisor output
  • Make suggestions based on this information

If Atlas MCP Server for Atlas is not configured or you don’t have enough information to run atlas-get-performance-advisor against the correct cluster, tell the user that general performance analysis requires Atlas MCP Server configuration with API credentials, and suggest they configure it or ask about a specific query instead.

Help with a Specific Query

If the user is asking about a particular query:

Details

Repository
github.com/mongodb/agent-skills
Category
Databases
First seen
May 16, 2026

More from mongodb/agent-skills

All 8

Similar to Mongodb Query Optimizer

More Databases