mongodb-atlas-stream-p…
Manages MongoDB Atlas Stream Processing (ASP) workflows. Handles workspace provisioning, data source/sink connections, processor lifecycle operations,…
Generate read-only MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents. Use this skill whenever the user asks to write, create, or generate MongoDB queries, wants to filter/query/aggregate data in MongoDB,
$ npx -y skills add mongodb/agent-skills --skill mongodb-natural-language-querying --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/mongodb-natural-language-queryingContext preview
The summary Claude sees to decide when to auto-load this skill.
Generate read-only MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents. Use this skill whenever the user asks to write, create, or generate MongoDB queries, wants to filter/query/aggregate data in MongoDB,
name: mongodb-natural-language-querying description: Generate read-only MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents. Use this skill whenever the user asks to write, create, or generate MongoDB queries, wants to filter/query/aggregate data in MongoDB, asks "how do I query...", needs help with query syntax, or discusses finding/filtering/grouping MongoDB documents. Also use for translating SQL-like requests to MongoDB syntax. Does NOT handle Atlas Search ($search operator), vector/semantic search ($vectorSearch operator), fuzzy matching, autocomplete indexes, or relevance scoring - use search-and-ai for those. Does NOT analyze or optimize existing queries - use mongodb-query-optimizer for that. Does NOT handle aggregation pipelines that involve write operations. Requires MongoDB MCP server. license: Apache-2.0 metadata: version: "1.0.0" allowed-tools: mcp__mongodb__*
You are an expert MongoDB read-only query and aggregation pipeline generator.
**Required Information:**
**Fetch in this order:**
1. **Indexes** (for query optimization):
mcp__mongodb__collection-indexes({ database, collection })2. **Schema** (for field validation):
mcp__mongodb__collection-schema({ database, collection, sampleSize: 50 })3. **Sample documents** (for understanding data patterns):
mcp__mongodb__find({ database, collection, limit: 4 })Before generating a query, always validate field names against the schema you fetched. MongoDB won't error on nonexistent field names - it will simply return no results or behave unexpectedly, making bugs hard to diagnose. By checking the schema first, you catch these issues before the user tries to run the query.
Also review the available indexes to understand which query patterns will perform best.
Prefer find queries over aggregation pipelines because find queries are simpler and easier for other developers to understand.
**Use Find Query when:**
**Use Aggregation Pipeline when the request requires:**
Output queries using the user-requested language or driver syntax; if no language or expected format is supplied, always use MongoDB shell syntax (with unquoted keys and single quotes) for readability and compatibility with MongoDB tools.
**Find Query Response:**
{
"query": {
"filter": "{ age: { $gte: 25 } }",
"projection": "{ name: 1, age: 1, _id: 0 }",
"sort": "{ age: -1 }",
"limit": "10"
}
}**Aggregation Pipeline Response:**
{
"aggregation": {
"pipeline": "[{ $match: { status: 'active' } }, { $group: { _id: '$category', total: { $sum: '$amount' } } }]"
}
}1. **Generate correct queries** - Build queries that match user requirements, then check index coverage:
2. **Avoid redundant operators** - Never add operators that are already implied by other conditions:
3. **Project only needed fields** - Reduce data transfer with projections
4. **Validate field names** against the schema before using them 5. **Use appropriate operators** - Choose the right MongoDB operator for the task:
6. **Optimize array field checks** - Use efficient patterns for array operations:
Collection of official MongoDB agent skills for use in agentic workflows. For more information, refer to the MongoDB Agent Skills documentation.
Repo: mongodb/agent-skills
Manages MongoDB Atlas Stream Processing (ASP) workflows. Handles workspace provisioning, data source/sink connections, processor lifecycle operations,…
Optimize MongoDB client connection configuration (pools, timeouts, patterns) for any supported driver language. Use this skill when working/updating/reviewing…
Help with MongoDB query optimization and indexing. Use only when the user asks for optimization or performance: "How do I optimize this query?", "How do I…
MongoDB schema design patterns and anti-patterns. Use when designing data models, reviewing schemas, migrating from SQL, or troubleshooting performance issues…
Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when…
Guide users through configuring key MongoDB MCP server options. Use this skill when a user has the MongoDB MCP server installed but hasn't configured the…