mongodb avatar

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-code

Installs 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

More from mongodb/agent-skills

All 8
1leonardomso avatarrust-skillsleonardomso/rust-skillsComprehensive Rust coding guidelines with 265 rules across 26 categories. Use when writing, reviewing, or refactoring Rust code. Covers ownership, error handlin7Kskills.sh installs
2pixijs avatarpixijs-custom-renderingpixijs/pixijs-skillsUse this skill when writing custom shaders, uniforms, filters, or batchers in PixiJS v8. Covers Shader.from({gl, gpu, resources}), GlProgram/GpuProgram, Uniform6.8Kskills.sh installs
3assistant-ui avatarruntimeassistant-ui/skillsGuide to the assistant-ui runtime system, single-thread state, and the imperative aui client API in @assistant-ui/react. Use when creating a runtime (useLocalRu6.5Kskills.sh installs
4ant-design avatarantdant-design/ant-design-cliUse when the user's task involves Ant Design (antd) — writing antd components, debugging antd issues, querying antd APIs/props/tokens/demos, migrating between a6.4Kskills.sh installs
5conardli avatarweb-video-presentationconardli/garden-skills把一篇文章或口播稿,做成"看起来像视频"的点击驱动 16:9 网页演示,可选合成口播音频。流程:原始文章 → **一次产出**口播稿 + outline 开发计划 → 用户**一次对齐** 5 件事(稿子 / outline / 主题 / 素材 / 开发模式)→ 网页开发(逐章 / 顺序 / 并行)→ 可选音频合成(p6.3Kskills.sh installs
6trailofbits avatarspec-to-code-compliancetrailofbits/skillsCheck code against the documentation that specifies it - which requirements hold, which the code contradicts, which are absent, and what the code does that no d6.3Kskills.sh installs