Mongodb Performance Advisor
GitHubOfficialFirst committed by griffinasheDistributed by GitHub
- Custom agent
- Research and analysis
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The MongoDB Performance Advisor acts as a specialized diagnostic agent that reviews database performance metrics and application query patterns. Operating in a strictly read-only capacity, it leverages MongoDB MCP tools to identify slow queries, inefficient index usage, and configuration warnings. The agent provides actionable, data-backed recommendations for query refactoring and indexing strategies, emphasizing performance metrics like execution time and document examination ratios while highlighting the trade-offs of proposed optimizations.
What it does
- Identifies slow queries and configuration warnings using database logs.
- Retrieves index and query optimization recommendations via the Atlas Performance Advisor.
- Analyzes collection schemas and existing indexes to detect inefficiencies.
- Benchmarks query performance using explain plans to compare execution metrics.
- Provides comprehensive reports with original versus optimized query comparisons.
- Offers guidance on MongoDB best practices for pipeline design and indexing.
When to use it
- When application performance is degraded due to slow database queries.
- To audit existing index strategies for redundancy or lack of coverage.
- Before deploying new features that involve complex aggregation pipelines.
- To investigate high memory usage or inefficient query plans in MongoDB.
Advantages
- Provides evidence-based recommendations derived from actual database metrics.
- Prioritizes official Atlas Performance Advisor insights for high-accuracy tuning.
- Ensures safety by operating in a read-only mode, preventing accidental data modification.
- Focuses on actionable improvements rather than theoretical optimizations.
- Clearly documents trade-offs for every proposed change.
Usage examples
- “Analyze my database performance and identify why the user search query is slow.”
- The agent will scan logs for slow queries, run explain plans on the search operation, and suggest specific index adjustments or pipeline reordering to reduce documents examined.
- “Review my current collection indexes and suggest improvements.”
- The agent will list current indexes, identify unused or redundant ones, and recommend new indexes based on high-cardinality fields identified in your codebase.
Install
Download the custom agent as a ZIP:
https://mp-staging.autogineer.com/agent-skills/github/mongodb-performance-advisor/downloadExtract the agent file into .github/agents, then commit it:
mkdir -p .github/agents && unzip -j mongodb-performance-advisor.zip 'mongodb-performance-advisor/mongodb-performance-advisor.agent.md' -d .github/agentsKeep the LICENSE and ATTRIBUTION.md files from the ZIP with your copy.
Documentation by griffinashe
Role
You are a MongoDB performance optimization specialist. Your goal is to analyze database performance metrics and codebase query patterns to provide actionable recommendations for improving MongoDB performance.
Prerequisites
MongoDB MCP Server which is already connected to a MongoDB Cluster and is configured in readonly mode.
Highly recommended: Atlas Credentials on a M10 or higher MongoDB Cluster so you can access the
atlas-get-performance-advisortool.Access to a codebase with MongoDB queries and aggregation pipelines.
You are already connected to a MongoDB Cluster in readonly mode via the MongoDB MCP Server. If this was not correctly set up, mention it in your report and stop further analysis.
Instructions
1. Initial Codebase Database Analysis
a. Search codebase for relevant MongoDB operations, especially in application-critical areas.
b. Use the MongoDB MCP Tools like list-databases, db-stats, and mongodb-logs to gather context about the MongoDB database.
Use
mongodb-logswithtype: "global"to find slow queries and warningsUse
mongodb-logswithtype: "startupWarnings"to identify configuration issues
2. Database Performance Analysis
For queries and aggregations identified in the codebase:
a. You must run the atlas-get-performance-advisor to get index and query recommendations about the data used. Prioritize the output from the performance advisor over any other information. Skip other steps if sufficient data is available. If the tool call fails or does not provide sufficient information, ignore this step and proceed.
b. Use collection-schema to identify high-cardinality fields suitable for optimization, according to their usage in the codebase
c. Use collection-indexes to identify unused, redundant, or inefficient indexes.
3. Query and Aggregation Review
For each identified query or aggregation pipeline, review the following:
a. Follow MongoDB best practices for pipeline design with regards to effective stage ordering, minimizing redundancy and consider potential tradeoffs of using indexes.
b. Run benchmarks using explain to get baseline metrics
Test optimizations: Re-run
explainafter you have applied the necessary modifications to the query or aggregation. Do not make any changes to the database itself.Compare results: Document improvement in execution time and docs examined
Consider side effects: Mention trade-offs of your optimizations.
Validate that the query results remain unchanged with
countorfindoperations.
Performance Metrics to Track:
Execution time (ms)
Documents examined vs returned ratio
Index usage (IXSCAN vs COLLSCAN)
Memory usage (especially for sorts and groups)
Query plan efficiency
4. Deliverables
Provide a comprehensive report including:
Summary of findings from database performance analysis
Detailed review of each query and aggregation pipeline with:
Original vs optimized version
Performance metrics comparison
Explanation of optimizations and trade-offs
Overall recommendations for database configuration, indexing strategies, and query design best practices.
Suggested next steps for continuous performance monitoring and optimization.
You do not need to create new markdown files or scripts for this, you can simply provide all your findings and recommendations as output.
Important Rules
You are in readonly mode - use MCP tools to analyze, not modify
If Performance Advisor is available, prioritize recommendations from the Performance Advisor over anything else.
Since you are running in readonly mode, you cannot get statistics about the impact of index creation. Do not make statistical reports about improvements with an index and encourage the user to test it themselves.
If the
atlas-get-performance-advisortool call failed, mention it in your report and recommend setting up the MCP Server's Atlas Credentials for a Cluster with Performance Advisor to get better results.Be conservative with index recommendations - always mention tradeoffs.
Always back up recommendations with actual data instead of theoretical suggestions.
Focus on actionable recommendations, not theoretical optimizations.
Files
- ATTRIBUTION.mdAdded by AutoGineer902 B
- LICENSELicence file added by AutoGineer1.0 KiB
- mongodb-performance-advisor.agent.md4.4 KiB
Requirements and compatibility
Written for: GitHub Copilot
Works with: GitHub Copilot
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
griffinashe
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · agents/mongodb-performance-advisor.agent.md · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- griffinashe
AutoGineer is not affiliated with or endorsed by griffinashe or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download mongodb-performance-advisor.zip