Agent skill

Mongodb Patterns

by vibeeval in vibeeval/vibecosystem

Document modeling, aggregation pipeline, indexing strategy, change streams, and multi-document transactions.

MITAuto-check passedDatabases

Install Mongodb Patterns

skills CLI
$ npx skills add vibeeval/vibecosystem --skill mongodb-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install vibeeval/vibecosystem mongodb-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/vibeeval/vibecosystem.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/mongodb-patterns .claude/skills/mongodb-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mongodb-patterns
GitHub stars
531
Token cost
~1.6k tokens
SKILL.md length
149 words
Files
1
Skills in repo
144
Repo updated
First seen
Licence
MIT

At a glance

Document modeling, aggregation pipeline, indexing strategy, change streams, and multi-document transactions.

  • Tasks that involve NoSQL databases
  • SKILL.md covers Document Modeling Strategies, Indexing Strategy, Aggregation Pipeline and Change Streams (Real-time…, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Mongodb Patterns is an agent skill from vibeeval/vibecosystem. Document modeling, aggregation pipeline, indexing strategy, change streams, and multi-document transactions.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering NoSQL databases. It works with MongoDB. The repository describes itself as: AI software team for Claude Code - 138 agents, 295 skills, 73 hooks. Self-learning, multi-agent swarm, autonomous skill evolution. The licence is MIT.

When your agent uses it

  • Tasks that involve NoSQL databases

Example prompts

  • “/mongodb-patterns”

What it can do on your machine

Read from SKILL.md and the folder at commit 3b763b1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mongodb Patterns loads about 1.6k tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 149 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from vibeeval/vibecosystem at commit 3b763b1, republished under its MIT licence (© vibeeval). 149 words, ~1,574 tokens.

Download SKILL.mdSave it as .claude/skills/mongodb-patterns/SKILL.md (or your agent's skills folder).
name
mongodb-patterns
description
Document modeling, aggregation pipeline, indexing strategy, change streams, and multi-document transactions.

MongoDB Patterns

Document database design and query optimization for MongoDB.

Document Modeling Strategies

typescript
// EMBED when: 1:1 or 1:few, data read together, child has no independent lifecycle
interface Order {
  _id: ObjectId
  customerId: ObjectId
  status: 'pending' | 'paid' | 'shipped'
  items: OrderItem[]        // Embedded - always read with order
  shippingAddress: Address  // Embedded - 1:1
  createdAt: Date
}

interface OrderItem {
  productId: ObjectId
  name: string              // Denormalized - avoid join at read time
  price: number             // Snapshot at purchase time
  quantity: number
}

// REFERENCE when: 1:many (unbounded), independent queries, shared across documents
interface Product {
  _id: ObjectId
  name: string
  price: number
  categoryId: ObjectId     // Reference - category queried independently
  reviews: never           // DON'T embed - unbounded array
}

// Bucket pattern: group time-series data into fixed-size documents
interface SensorBucket {
  _id: ObjectId
  sensorId: string
  startTime: Date
  endTime: Date
  count: number            // Track bucket fullness
  measurements: {          // Embed up to 200 per bucket
    timestamp: Date
    value: number
  }[]
}

Indexing Strategy

typescript
// Compound index: field order matters (ESR rule)
// Equality → Sort → Range
db.orders.createIndex({
  status: 1,       // Equality: exact match filter
  createdAt: -1,   // Sort: avoid in-memory sort
  total: 1         // Range: price > 100
})

// Partial index: only index documents matching filter (smaller index)
db.orders.createIndex(
  { customerId: 1, createdAt: -1 },
  { partialFilterExpression: { status: 'pending' } }
)

// Text index for search
db.products.createIndex({ name: 'text', description: 'text' })

// TTL index for auto-expiration
db.sessions.createIndex(
  { createdAt: 1 },
  { expireAfterSeconds: 86400 }  // Auto-delete after 24h
)

// Wildcard index for dynamic schemas
db.events.createIndex({ 'metadata.$**': 1 })

Aggregation Pipeline

typescript
// Sales analytics: top products by revenue per category
const pipeline = [
  // Stage 1: Filter date range
  { $match: {
    createdAt: { $gte: new Date('2025-01-01'), $lt: new Date('2025-02-01') },
    status: 'paid'
  }},

  // Stage 2: Unwind embedded items array
  { $unwind: '$items' },

  // Stage 3: Group by product
  { $group: {
    _id: '$items.productId',
    productName: { $first: '$items.name' },
    totalRevenue: { $sum: { $multiply: ['$items.price', '$items.quantity'] } },
    totalSold: { $sum: '$items.quantity' },
    orderCount: { $addToSet: '$_id' }
  }},

  // Stage 4: Add computed fields
  { $addFields: {
    orderCount: { $size: '$orderCount' },
    avgOrderValue: { $divide: ['$totalRevenue', { $size: '$orderCount' }] }
  }},

  // Stage 5: Sort by revenue descending
  { $sort: { totalRevenue: -1 } },

  // Stage 6: Limit to top 20
  { $limit: 20 },

  // Stage 7: Lookup category details
  { $lookup: {
    from: 'products',
    localField: '_id',
    foreignField: '_id',
    pipeline: [{ $project: { categoryId: 1 } }],
    as: 'product'
  }}
]

const results = await db.orders.aggregate(pipeline).toArray()

Change Streams (Real-time Reactivity)

typescript
async function watchOrderChanges(): Promise<void> {
  const pipeline = [
    { $match: {
      operationType: { $in: ['insert', 'update'] },
      'fullDocument.status': 'paid'
    }}
  ]

  // resumeAfter enables resuming from last processed change (crash recovery)
  const changeStream = db.orders.watch(pipeline, {
    fullDocument: 'updateLookup',  // Include full document on updates
    resumeAfter: await getLastResumeToken()
  })

  changeStream.on('change', async (event) => {
    try {
      await processOrderPayment(event.fullDocument!)
      await saveResumeToken(event._id)  // Persist for crash recovery
    } catch (err) {
      console.error('Change stream processing failed:', err)
    }
  })

  changeStream.on('error', (err) => {
    console.error('Change stream error:', err)
    // Reconnect with resume token
    setTimeout(() => watchOrderChanges(), 5000)
  })
}

Multi-Document Transactions

typescript
async function transferFunds(
  fromAccountId: string,
  toAccountId: string,
  amount: number
): Promise<void> {
  const session = client.startSession()

  try {
    await session.withTransaction(async () => {
      const from = await db.accounts.findOne(
        { _id: new ObjectId(fromAccountId) },
        { session }
      )
      if (!from || from.balance < amount) {
        throw new Error('Insufficient funds')
      }

      await db.accounts.updateOne(
        { _id: new ObjectId(fromAccountId) },
        { $inc: { balance: -amount } },
        { session }
      )

      await db.accounts.updateOne(
        { _id: new ObjectId(toAccountId) },
        { $inc: { balance: amount } },
        { session }
      )

      await db.transactions.insertOne({
        from: fromAccountId,
        to: toAccountId,
        amount,
        createdAt: new Date()
      }, { session })
    })
  } finally {
    await session.endSession()
  }
}

Checklist

  • Embed for 1:1 and 1:few; reference for 1:many and many:many
  • Follow ESR (Equality-Sort-Range) for compound index field order
  • Use partial indexes to reduce index size on filtered queries
  • Set TTL indexes for session/temp data auto-cleanup
  • Use aggregation pipeline for analytics (not client-side loops)
  • Change streams with resume tokens for crash-safe event processing
  • Keep documents under 16MB (MongoDB limit)
  • Use explain() to verify queries use indexes

Anti-Patterns

  • Unbounded arrays: reviews/comments embedded in parent (grows forever, hits 16MB)
  • Missing indexes: full collection scans on frequently queried fields
  • $lookup in hot paths: use denormalization, not joins, for read-heavy queries
  • Storing related data in separate collections when always read together
  • Using MongoDB as a relational database (normalize everything)
  • Not using write concern majority for critical writes (data loss risk)

© vibeeval, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/mongodb-patterns of vibeeval/vibecosystem.

Open the folder on GitHubat commit 3b763b1

Compare with similar skills

Mongodb Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mongodb Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mongodb Patterns this skillvibeeval/vibecosystem531—~1.6kAutomated safety check: PassMIT
Mongodb BackupsTheDecipherist/claude-code-mastery-project-starter-kit338—~1.3kAutomated safety check: PassMIT
Mongodbsickn33/agentic-awesome-skills47k2 repos~2.7kAutomated safety check: NotesMIT
Mongodb Qe Size Estimationmongodb/agent-skills190—~4.2kAutomated safety check: PassApache-2.0
MongodbRightNow-AI/openfang18k—~821Automated safety check: PassApache-2.0
Mongodb RulesTheDecipherist/claude-code-mastery-project-starter-kit338—~1.7kAutomated safety check: PassMIT

Similar skills

  • Mongodb Backups

    TheDecipherist/claude-code-mastery-project-starter-kit

    Production MongoDB backup and restore practices that the documentation gets wrong.

    338 GitHub stars~1.3k tokensUpdated 3 mo ago
    DatabasesAuto-check passed
  • Mongodb

    sickn33/agentic-awesome-skills

    Administer MongoDB databases. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~2.7k tokens
    DatabasesAuto-check: notes
  • Mongodb Qe Size Estimation

    mongodb/agent-skills

    Official

    Estimates the storage and memory impact of encrypting fields in collections with Queryable Encryption (QE) enabled.

    190 GitHub stars~4.2k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Mongodb

    RightNow-AI/openfang

    MongoDB operations expert for queries, aggregation pipelines, indexes, and schema design

    18k GitHub stars~821 tokensUpdated 3 mo ago
    DatabasesAuto-check passed
  • Mongodb Rules

    TheDecipherist/claude-code-mastery-project-starter-kit

    Native-driver, StrictDB, and data-modeling rules for MongoDB.

    338 GitHub stars~1.7k tokensUpdated 3 mo ago
    DatabasesAuto-check passed
  • A skill your agent uses when you need MongoDB persistence in Quarkus — including Panache Mongo entities/repositories, document design, indexes, transactions where applicable, and error handling.

    445 GitHub stars~528 tokensUpdated today
    DatabasesAuto-check passed

More from vibeeval/vibecosystem

All 144 skills in this repo
  • Agent Benchmark

    vibeeval/vibecosystem

    Framework for measuring and tracking agent response quality over time.

    531 GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Differential Review

    vibeeval/vibecosystem

    Security-focused differential code review with blast radius analysis, risk-adaptive depth (DEEP/FOCUSED/SURGICAL), git history correlation, and structured finding format.

    531 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Factcheck Guard

    vibeeval/vibecosystem

    A skill your agent uses when making any factual claim about the codebase — existence, absence, or behavior.

    531 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Fp Check

    vibeeval/vibecosystem

    Systematic false positive verification for security findings.

    531 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • N8n Workflows

    vibeeval/vibecosystem

    n8n otomasyon workflow'lari. An agent skill from vibeeval/vibecosystem.

    531 GitHub stars~3.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Notepad System

    vibeeval/vibecosystem

    A skill your agent uses when context compression is imminent, when resuming a session, or when preserving critical decisions across long tasks.

    531 GitHub stars~1.7k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Mongodb Patterns

What does Mongodb Patterns do?

Document modeling, aggregation pipeline, indexing strategy, change streams, and multi-document transactions. Mongodb Patterns is an agent skill from vibeeval/vibecosystem. Document modeling, aggregation pipeline, indexing strategy, change streams, and multi-document transactions.

When should I use Mongodb Patterns?

Mongodb Patterns fits situations like: tasks that involve NoSQL databases.

How do I install Mongodb Patterns in Claude Code?

Run `npx skills add vibeeval/vibecosystem --skill mongodb-patterns -a claude-code`. Or copy the skill folder (skills/mongodb-patterns in vibeeval/vibecosystem) into .claude/skills/mongodb-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Mongodb Patterns in Codex?

Run `npx skills add vibeeval/vibecosystem --skill mongodb-patterns -a codex`. Or copy the skill folder (skills/mongodb-patterns in vibeeval/vibecosystem) into .agents/skills/mongodb-patterns in your project. Codex loads it when a task matches its description.

Can I use Mongodb Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add vibeeval/vibecosystem --skill mongodb-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mongodb-patterns, .gemini/skills/mongodb-patterns, .github/skills/mongodb-patterns and .opencode/skills/mongodb-patterns in your project.

What does Mongodb Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Mongodb Patterns is instructions for the agent only.

Does Mongodb Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mongodb Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mongodb Patterns use?

Mongodb Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mongodb Patterns use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mongodb Patterns?

Skills that share tags, products or a category with Mongodb Patterns: Mongodb Backups (TheDecipherist/claude-code-mastery-project-starter-kit, 338 stars), Mongodb (sickn33/agentic-awesome-skills, 47k stars), Mongodb Qe Size Estimation (mongodb/agent-skills, 190 stars) and Mongodb (RightNow-AI/openfang, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mongodb Patterns?

vibeeval (a GitHub user) maintains it in vibeeval/vibecosystem, which has 531 GitHub stars. The repository holds 144 skills in this directory. The repository was last updated on August 8, 2026.

Source: vibeeval/vibecosystem on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.