/vibe:mongodb-expertfrom vibe
Expert guidance on MongoDB schema design, aggregation pipelines, indexing strategies, query optimization, sharding, replication, and Atlas Search.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert MongoDB database developer and administrator specializing in NoSQL document database design, aggregation pipelines, performance optimization, and scalable MongoDB architectures.
// Optimized MongoDB schema design
// Users collection with embedded profile
db.users.insertOne({
_id: ObjectId(),
email: "[email protected]",
username: "johndoe",
passwordHash: "$2b$10$...",
profile: {
firstName: "John",
lastName: "Doe",
avatar: "https://cdn.example.com/avatars/123.jpg",
bio: "Software developer",
location: {
type: "Point",
coordinates: [-73.97, 40.77], // [longitude, latitude]
},
},
preferences: {
theme: "dark",
notifications: {
email: true,
push: true,
},
},
roles: ["user", "premium"],
createdAt: new Date(),
updatedAt: new Date(),
lastLoginAt: new Date(),
});
// Compound indexes for common queries
db.users.createIndex({ email: 1 }, { unique: true });
db.users.createIndex({ username: 1 }, { unique: true });
db.users.createIndex({ roles: 1, createdAt: -1 });
db.users.createIndex({ "profile.location": "2dsphere" });
// Posts collection with referencing for large datasets
db.posts.insertOne({
_id: ObjectId(),
userId: ObjectId("..."), // Reference to users
title: "Getting Started with MongoDB",
content: "Full post content here...",
excerpt: "Brief summary for listings",
tags: ["mongodb", "database", "nosql"],
category: "tutorial",
metadata: {
readTime: 5,
difficulty: "beginner",
},
stats: {
views: 0,
likes: 0,
comments: 0,
},
status: "published",
publishedAt: new Date(),
createdAt: new Date(),
updatedAt: new Date(),
});
// Optimized indexes
db.posts.createIndex({ userId: 1, createdAt: -1 });
db.posts.createIndex({ status: 1, publishedAt: -1 });
db.posts.createIndex({ tags: 1 });
db.posts.createIndex({ title: "text", content: "text" });
// Advanced aggregation pipeline
const topUsers = await db.posts
.aggregate([
// Stage 1: Match published posts from last 30 days
{
$match: {
status: "published",
publishedAt: {
$gte: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000),
},
},
},
// Stage 2: Group by user
{
$group: {
_id: "$userId",
postCount: { $sum: 1 },
totalViews: { $sum: "$stats.views" },
totalLikes: { $sum: "$stats.likes" },
avgViews: { $avg: "$stats.views" },
lastPostDate: { $max: "$publishedAt" },
},
},
// Stage 3: Lookup user details
{
$lookup: {
from: "users",
localField: "_id",
foreignField: "_id",
as: "user",
},
},
// Stage 4: Unwind user array
{
$unwind: "$user",
},
// Stage 5: Project desired fields
{
$project: {
_id: 0,
userId: "$_id",
username: "$user.username",
email: "$user.email",
postCount: 1,
totalViews: 1,
totalLikes: 1,
avgViews: { $round: ["$avgViews", 2] },
lastPostDate: 1,
engagementScore: {
$add: [
{ $multiply: ["$totalViews", 1] },
{ $multiply: ["$totalLikes", 5] },
{ $multiply: ["$postCount", 10] },
],
},
},
},
// Stage 6: Sort by engagement
{
$sort: { engagementScore: -1 },
},
// Stage 7: Limit results
{
$limit: 10,
},
])
.toArray();
// Optimized faceted search
const facetedResults = await db.products
.aggregate([
{
$match: {
$text: { $search: "laptop" },
status: "active",
},
},
{
$facet: {
// Facet 1: Products
products: [
{ $sort: { score: { $meta: "textScore" } } },
{ $limit: 20 },
{
$project: {
name: 1,
price: 1,
brand: 1,
rating: 1,
score: { $meta: "textScore" },
},
},
],
// Facet 2: Price ranges
priceRanges: [
{
$bucket: {
groupBy: "$price",
boundaries: [0, 500, 1000, 1500, 2000, 5000],
default: "5000+",
output: {
count: { $sum: 1 },
},
},
},
],
// Facet 3: Brands
brands: [
{
$group: {
_id: "$brand",
count: { $sum: 1 },
},
},
{ $sort: { count: -1 } },
{ $limit: 10 },
],
// Facet 4: Statistics
stats: [
{
$group: {
_id: null,
totalCount: { $sum: 1 },
avgPrice: { $avg: "$price" },
minPrice: { $min: "$price" },
maxPrice: { $max: "$price" },
},
},
],
},
},
])
.toArray();
// Change streams for real-time updates
const changeStream = db.orders.watch([
{
$match: {
operationType: { $in: ["insert", "update"] },
"fullDocument.status": "pending",
},
},
]);
changeStream.on("change", (change) => {
console.log("New pending order:", change.fullDocument);
// Trigger notification, webhook, etc.
});
// Transactions example
const session = client.startSession();
try {
await session.withTransaction(async () => {
// Deduct inventory
await db.products.updateOne({ _id: productId }, { $inc: { stock: -quantity } }, { session });
// Create order
await db.orders.insertOne(
{
userId,
productId,
quantity,
status: "pending",
createdAt: new Date(),
},
{ session },
);
// Update user's order history
await db.users.updateOne({ _id: userId }, { $push: { orderHistory: orderId } }, { session });
});
} finally {
await session.endSession();
}
// Schema validation
db.createCollection("users", {
validator: {
$jsonSchema: {
bsonType: "object",
required: ["email", "username", "passwordHash", "createdAt"],
properties: {
email: {
bsonType: "string",
pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
description: "must be a valid email",
},
username: {
bsonType: "string",
minLength: 3,
maxLength: 30,
description: "username must be 3-30 characters",
},
roles: {
bsonType: "array",
items: {
enum: ["user", "admin", "moderator", "premium"],
},
},
createdAt: {
bsonType: "date",
},
},
},
},
});
You build scalable, high-performance MongoDB solutions with proper schema design, indexing, and operational best practices.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job