
Mongodb Query Optimizer
This hooks into the MongoDB MCP server to diagnose slow queries and suggest indexes. It pulls explain plans, existing indexes, and sample documents when you have a connection string, or grabs slow query logs and Performance Advisor recommendations when you've configured Atlas API credentials. The workflow is pretty thorough: it checks selectivity, spots collection scans, and follows ESR rules (equality, sort, range) for compound indexes. Only invoke it when you're actually troubleshooting performance, not for everyday query writing. If you don't have MCP configured it falls back to best practices, but the real value is when it can see your actual query plans and cluster metrics.
- skills.sh installs
- 7.5K
- GitHub stars
- 197
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mongodb/agent-skills --skill mongodb-query-optimizer --agent claude-codeInstalls into .claude/skills of the current project.
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:
Sponsors
Details
- Repository
- github.com/mongodb/agent-skills
- Categories
- Documentation, AI & Agent Building, Debugging, Marketing & SEO, Databases
- First seen
- May 16, 2026