mongodb

A MongoDB specialist skill for designing document schemas, writing queries and aggregation pipelines, creating indexes, and managing deployments. MongoDB is a database that stores data as flexible documents.

In plain words
What is it for?
It supports schema design, query writing, data aggregation, index planning, performance analysis with execution statistics, and deployment work.
Why use it?
It helps match database structure and indexes to real access patterns, while checking whether production queries use efficient execution plans.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/librefang/librefang-registry/mongodb
Any agent
npx skills add librefang/librefang-registry --skill mongodb
Clone the repo
git clone --depth 1 https://github.com/librefang/librefang-registry

Made for: Claude Code, Codex.

Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 689 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 97% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00017 $0.00689
Opus 5 $0.00009 $0.00345
Sonnet 5 $0.00003 $0.00138
Haiku 4.5 $0.00002 $0.00069

Measured 3d ago against content hash bd544928a78b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mongodb scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

97% identical to mongodb — 3 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/mongodb/SKILL.md · 57 lines

How it starts

The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MongoDB Operations Expert

You are a MongoDB specialist. You help users design schemas, write queries, build aggregation pipelines, optimize performance with indexes, and manage MongoDB deployments.

Key Principles

  • Design schemas based on access patterns, not relational normalization. Embed data that is read together; reference data that changes independently.
  • Always create indexes to support your query patterns. Every query that runs in production should use an index.
  • Use the aggregation framework instead of client-side data processing for complex transformations.
  • Use explain("executionStats") to verify query performance before deploying to production.

Schema Design

  • Embed when: data is read together, the embedded array is bounded, and updates are infrequent.
  • Reference when: data is shared across documents, the related collection is large, or you need independent updates.
  • Use the Subset Pattern: store frequently accessed fields in the main document, move rarely-used details to a separate collection.
  • Use the Bucket Pattern for time-series data: group events into time-bucketed documents to reduce document count.
  • Include a schemaVersion field to support future migrations.

Query Patterns

  • Use projections ({ field: 1 }) to return only needed fields — reduces network transfer and memory usage.
  • Use $elemMatch for querying and projecting specific array elements.
  • Use $in for matching against a list of values. Use $exists and $type for schema variations.
  • Use $text indexes for full-text search or Atlas Search for advanced search capabilities.
  • Avoid $where and JavaScript-based operators — they are slow and cannot use indexes.

Aggregation Framework

  • Build pipelines in stages: $match (filter early), $project (shape), $group (aggregate), $sort, $limit.
  • Always place $match as early as possible in the pipeline to reduce the working set.
  • Use $lookup for left outer joins between collections, but prefer embedding for frequently joined data.
  • Use $facet for running multiple aggregation pipelines in parallel on the same input.
  • Use $merge or $out to write aggregation results to a collection for materialized views.

Read the full file on GitHub · 57 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 57 lines · 17 tokens per session scan A bd544928a78b

Subscribe to this mod's changes

mongodb is a skill published in the GitHub repository librefang/librefang-registry (11 stars, last pushed 9d ago), licensed MIT. It adds 17 tokens to every session and 689 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 97% identical to mongodb, differing in 3 lines, and is treated as a copy.

Related

Other skills, from other repositories

mongodb-expert

Expert-level MongoDB database design, aggregation pipelines, indexing, replication, and production operations.

personamanagmentlayer/pcl · 21 tokens

mongodb-natural-language-querying

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…

mongodb/agent-skills · 162 tokens

mongodb-connection

Optimize MongoDB client connection configuration (pools, timeouts, patterns) for any supported driver language. Use this skill when working/updating/reviewing on functions that instantiate or configure a MongoDB client (eg, when calling connect()), configuring connection pools, troubleshooting connection errors…

mongodb/agent-skills · 122 tokens

mongodb-schema-design

MongoDB schema design patterns and anti-patterns. Use when designing data models, reviewing schemas, migrating from SQL, or troubleshooting performance issues caused by schema problems. Triggers on "design schema", "embed vs reference", "MongoDB data model", "schema review", "unbounded arrays", "one-to-many", "tree…

mongodb/agent-skills · 127 tokens

mongodb-query-optimizer

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 index this?", "Why is this query slow?", "Can you fix my slow queries?", "What are the slow queries on my cluster?", etc. Do not invoke for general MongoDB query…

mongodb/agent-skills · 98 tokens

mongodb-search-and-ai

Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when users need to build search functionality for text-based queries (autocomplete, fuzzy matching, faceted search), semantic similarity (embeddings, RAG…

mongodb/agent-skills · 132 tokens