Token导航 LogoToken导航

Agent Skill · 研究检索

mongodb-expert(MongoDB expert 搜索)

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

mongodb-expert 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 34,439。

总安装 2,228周安装 91GitHub Stars 19下载 721核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:mongodb-expert(MongoDB expert 搜索)
来源仓库:https://github.com/personamanagmentlayer/pcl
仓库路径:skills/mongodb-expert
安装命令:
npx skills add https://github.com/personamanagmentlayer/pcl --skill mongodb-expert
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/personamanagmentlayer/pcl --skill mongodb-expert

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助数据库表结构、查询语句和数据维护任务。适合分析 schema、编写查询、排查问题或生成迁移建议。使用时需明确数据库类型和连接环境,区分只读与写入操作。涉及删除、更新或批量导入时应优先 dry-run 和备份保护。可通过 npx skills add 命令从指定 GitHub 仓库安装使用。

来源仓库内路径:skills/mongodb-expert

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/personamanagmentlayer/pcl --skill mongodb-expe…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

mongodb-expert 怎么安装?

在终端执行 npx skills add https://github.com/personamanagmentlayer/pcl --skill mongodb-expert。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

mongodb-expert 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

mongodb-expert 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

mongodb-expert 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

mongodb-expert 用的人多吗?

公开数据是累计安装 2,228 次,近一周安装 91 次,下载 721 次,GitHub 19 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

mongodb-expert 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
mongodb-expert

MongoDB expert 搜索 · 本页

2,22819只读MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

MongoDB Expert

You are an expert in MongoDB with deep knowledge of document modeling, aggregation pipelines, indexing strategies, replication, sharding, and production operations. You design and manage performant, scalable MongoDB databases following best practices.

Core Expertise

CRUD Operations

Insert:

// Insert one document
db.users.insertOne({
  name: "Alice",
  email: "alice@example.com",
  age: 30,
  tags: ["admin", "developer"],
  createdAt: new Date()
});

// Insert many documents
db.users.insertMany([
  { name: "Bob", email: "bob@example.com", age: 25 },
  { name: "Charlie", email: "charlie@example.com", age: 35 }
]);

Find:

// Find all
db.users.find();

// Find with filter
db.users.find({ age: { $gt: 25 } });

// Find one
db.users.findOne({ email: "alice@example.com" });

// Projection (select fields)
db.users.find(
  { age: { $gt: 25 } },
  { name: 1, email: 1, _id: 0 }
);

// Sort, limit, skip
db.users.find()
  .sort({ age: -1 })
  .limit(10)
  .skip(20);

// Count
db.users.countDocuments({ age: { $gt: 25 } });
db.users.estimatedDocumentCount();

Update:

// Update one
db.users.updateOne(
  { email: "alice@example.com" },
  { $set: { age: 31, updatedAt: new Date() } }
);

// Update many
db.users.updateMany(
  { age: { $lt: 18 } },
  { $set: { isMinor: true } }
);

// Replace one
db.users.replaceOne(
  { email: "alice@example.com" },
  { name: "Alice Smith", email: "alice@example.com", age: 31 }
);

// Update operators
db.users.updateOne(
  { _id: ObjectId("...") },
  {
    $set: { name: "Alice" },
    $inc: { loginCount: 1 },
    $push: { tags: "moderator" },
    $pull: { tags: "guest" },
    $addToSet: { roles: "admin" },  // Add if not exists
    $currentDate: { lastModified: true }
  }
);

// Upsert
db.users.updateOne(
  { email: "dave@example.com" },
  { $set: { name: "Dave", age: 28 } },
  { upsert: true }
);

Delete:

// Delete one
db.users.deleteOne({ email: "alice@example.com" });

// Delete many
db.users.deleteMany({ age: { $lt: 18 } });

// Find and modify
db.users.findOneAndUpdate(
  { email: "alice@example.com" },
  { $inc: { age: 1 } },
  { returnDocument: "after" }
);

db.users.findOneAndDelete({ email: "alice@example.com" });

Query Operators

Comparison:

// $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin
db.users.find({ age: { $eq: 30 } });
db.users.find({ age: { $ne: 30 } });
db.users.find({ age: { $gt: 25, $lt: 35 } });
db.users.find({ role: { $in: ["admin", "moderator"] } });
db.users.find({ role: { $nin: ["guest", "banned"] } });

Logical:

// $and, $or, $not, $nor
db.users.find({
  $and: [
    { age: { $gt: 25 } },
    { role: "admin" }
  ]
});

db.users.find({
  $or: [
    { age: { $lt: 18 } },
    { age: { $gt: 65 } }
  ]
});

db.users.find({
  age: { $not: { $lt: 18 } }
});

Element:

// $exists, $type
db.users.find({ phone: { $exists: true } });
db.users.find({ age: { $type: "number" } });
db.users.find({ tags: { $type: "array" } });

Array:

// $all, $elemMatch, $size
db.users.find({ tags: { $all: ["admin", "developer"] } });

db.orders.find({
  items: {
    $elemMatch: {
      price: { $gt: 100 },
      quantity: { $gte: 2 }
    }
  }
});

db.users.find({ tags: { $size: 3 } });

Text Search:

// Create text index
db.articles.createIndex({ title: "text", content: "text" });

// Search
db.articles.find({ $text: { $search: "mongodb tutorial" } });

// Search with score
db.articles.find(
  { $text: { $search: "mongodb tutorial" } },
  { score: { $meta: "textScore" } }
).sort({ score: { $meta: "textScore" } });

Aggregation Pipeline

Basic Pipeline:

db.orders.aggregate([
  // Match documents
  { $match: { status: "completed" } },

  // Group and calculate
  { $group: {
    _id: "$userId",
    totalSpent: { $sum: "$total" },
    orderCount: { $sum: 1 },
    avgOrder: { $avg: "$total" }
  }},

  // Sort results
  { $sort: { totalSpent: -1 } },

  // Limit results
  { $limit: 10 },

  // Project (select fields)
  { $project: {
    _id: 0,
    userId: "$_id",
    totalSpent: 1,
    orderCount: 1,
    avgOrder: { $round: ["$avgOrder", 2] }
  }}
]);

Advanced Stages:

// $lookup (join)
db.orders.aggregate([
  {
    $lookup: {
      from: "users",
      localField: "userId",
      foreignField: "_id",
      as: "user"
    }
  },
  { $unwind: "$user" },
  {
    $project: {
      orderId: "$_id",
      total: 1,
      userName: "$user.name",
      userEmail: "$user.email"
    }
  }
]);

// $unwind (flatten arrays)
db.posts.aggregate([
  { $unwind: "$tags" },
  { $group: {
    _id: "$tags",
    count: { $sum: 1 }
  }}
]);

// $facet (multiple pipelines)
db.products.aggregate([
  {
    $facet: {
      byCategory: [
        { $group: { _id: "$category", count: { $sum: 1 } }},
        { $sort: { count: -1 } }
      ],
      priceRanges: [
        { $bucket: {
          groupBy: "$price",
          boundaries: [0, 50, 100, 200, 500],
          default: "500+",
          output: { count: { $sum: 1 } }
        }}
      ],
      totalStats: [
        { $group: {
          _id: null,
          total: { $sum: 1 },
          avgPrice: { $avg: "$price" },
          maxPrice: { $max: "$price" }
        }}
      ]
    }
  }
]);

// $addFields
db.users.aggregate([
  {
    $addFields: {
      fullName: { $concat: ["$firstName", " ", "$lastName"] },
      isAdult: { $gte: ["$age", 18] }
    }
  }
]);

// $replaceRoot
db.orders.aggregate([
  { $match: { status: "completed" } },
  { $replaceRoot: { newRoot: "$billing" } }
]);

Aggregation Operators:

db.orders.aggregate([
  {
    $project: {
      // Arithmetic
      totalWithTax: { $multiply: ["$total", 1.1] },
      discount: { $divide: ["$total", 10] },

      // String
      upperName: { $toUpper: "$customerName" },
      emailDomain: { $substr: ["$email", { $indexOfCP: ["$email", "@"] }, -1] },

      // Date
      year: { $year: "$createdAt" },
      month: { $month: "$createdAt" },
      dayOfWeek: { $dayOfWeek: "$createdAt" },

      // Conditional
      status: {
        $cond: {
          if: { $gte: ["$total", 100] },
          then: "high-value",
          else: "normal"
        }
      },

      // Array
      itemCount: { $size: "$items" },
      firstItem: { $arrayElemAt: ["$items", 0] },
      itemNames: { $map: {
        input: "$items",
        as: "item",
        in: "$$item.name"
      }}
    }
  }
]);

Indexing

Index Types:

// Single field index
db.users.createIndex({ email: 1 });  // Ascending
db.users.createIndex({ age: -1 });   // Descending

// Compound index
db.users.createIndex({ age: 1, name: 1 });

// Multikey index (for arrays)
db.users.createIndex({ tags: 1 });

// Text index
db.articles.createIndex({ title: "text", content: "text" });

// Geospatial index
db.locations.createIndex({ coordinates: "2dsphere" });

// Hashed index (for sharding)
db.users.createIndex({ userId: "hashed" });

// TTL index (auto-delete documents)
db.sessions.createIndex(
  { createdAt: 1 },
  { expireAfterSeconds: 3600 }
);

// Unique index
db.users.createIndex(
  { email: 1 },
  { unique: true }
);

// Partial index
db.users.createIndex(
  { email: 1 },
  { partialFilterExpression: { age: { $gte: 18 } } }
);

// Sparse index
db.users.createIndex(
  { phone: 1 },
  { sparse: true }
);

Index Management:

// List indexes
db.users.getIndexes();

// Drop index
db.users.dropIndex("email_1");
db.users.dropIndex({ email: 1 });

// Rebuild indexes
db.users.reIndex();

// Index stats
db.users.aggregate([{ $indexStats: {} }]);

// Explain query plan
db.users.find({ email: "alice@example.com" }).explain("executionStats");

Schema Design

Embedded Documents:

// One-to-Few: Embed
{
  _id: ObjectId("..."),
  name: "Alice",
  email: "alice@example.com",
  address: {
    street: "123 Main St",
    city: "New York",
    zip: "10001"
  },
  phones: [
    { type: "home", number: "555-1234" },
    { type: "work", number: "555-5678" }
  ]
}

References:

// One-to-Many: Reference
// User document
{
  _id: ObjectId("user123"),
  name: "Alice",
  email: "alice@example.com"
}

// Order documents
{
  _id: ObjectId("order1"),
  userId: ObjectId("user123"),
  total: 99.99,
  items: [...]
}

// Query with $lookup
db.users.aggregate([
  {
    $lookup: {
      from: "orders",
      localField: "_id",
      foreignField: "userId",
      as: "orders"
    }
  }
]);

Denormalization:

// Duplicate frequently accessed data
{
  _id: ObjectId("order1"),
  userId: ObjectId("user123"),
  user: {  // Denormalized
    name: "Alice",
    email: "alice@example.com"
  },
  total: 99.99,
  items: [...]
}

Transactions

Multi-Document Transactions:

const session = db.getMongo().startSession();

try {
  session.startTransaction();

  const accountsCol = session.getDatabase("mydb").getCollection("accounts");

  // Transfer money
  accountsCol.updateOne(
    { _id: "account1" },
    { $inc: { balance: -100 } },
    { session }
  );

  accountsCol.updateOne(
    { _id: "account2" },
    { $inc: { balance: 100 } },
    { session }
  );

  session.commitTransaction();
} catch (error) {
  session.abortTransaction();
  throw error;
} finally {
  session.endSession();
}

Replication

Replica Set Setup:

// Initialize replica set
rs.initiate({
  _id: "rs0",
  members: [
    { _id: 0, host: "mongo1:27017", priority: 2 },
    { _id: 1, host: "mongo2:27017", priority: 1 },
    { _id: 2, host: "mongo3:27017", priority: 1, arbiterOnly: true }
  ]
});

// Check replica set status
rs.status();

// Add member
rs.add("mongo4:27017");

// Remove member
rs.remove("mongo4:27017");

// Step down primary
rs.stepDown();

Read Preferences:

// Primary (default)
db.users.find().readPref("primary");

// Secondary
db.users.find().readPref("secondary");

// Nearest
db.users.find().readPref("nearest");

Write Concerns:

db.users.insertOne(
  { name: "Alice" },
  { writeConcern: { w: "majority", wtimeout: 5000 } }
);

Performance Optimization

Profiling:

// Enable profiling
db.setProfilingLevel(2);  // Profile all operations
db.setProfilingLevel(1, { slowms: 100 });  // Profile slow operations

// View profile data
db.system.profile.find().sort({ ts: -1 }).limit(10);

// Disable profiling
db.setProfilingLevel(0);

Explain:

db.users.find({ age: { $gt: 25 } }).explain("executionStats");

// Look for:
// - totalDocsExamined vs totalDocsReturned
// - executionTimeMillis
// - Index usage (IXSCAN vs COLLSCAN)

Hints:

// Force index usage
db.users.find({ age: 25, name: "Alice" })
  .hint({ age: 1, name: 1 });

Best Practices

1. Schema Design

// Embed when:
// - One-to-few relationship
// - Data doesn't change often
// - Need atomic updates

// Reference when:
// - One-to-many or many-to-many
// - Data changes frequently
// - Documents would exceed 16MB

2. Indexing

// Index fields used in:
// - Queries ($match, find)
// - Sorts ($sort)
// - Joins ($lookup)

// Avoid:
// - Too many indexes (slows writes)
// - Indexes on fields with low cardinality

3. Aggregation

// Put $match early in pipeline
// Use $limit after $sort
// Use indexes with $match and $sort

4. Sharding

// Choose shard key carefully
// High cardinality
// Good distribution
// Query isolation

5. Connection Pooling

// Use connection pools
// Don't create new connections for each operation
const client = new MongoClient(uri, {
  maxPoolSize: 10,
  minPoolSize: 2
});

Approach

When working with MongoDB:

  1. Design Schema: Consider access patterns first
  2. Index Strategically: Cover common queries
  3. Use Aggregation: For complex queries and transformations
  4. Monitor Performance: Enable profiling, use explain
  5. Use Replication: High availability and read scaling
  6. Shard When Needed: For horizontal scaling
  7. Backup Regularly: mongodump or filesystem snapshots
  8. Security: Authentication, encryption, network isolation

Always design MongoDB databases that are performant, scalable, and maintainable.

平台分布

Claude Code

29.82%
按下载量换算215

OpenCode

20.45%
按下载量换算147

Cursor

16.88%
按下载量换算122

Codex

12.09%
按下载量换算87

Antigravity

7.03%
按下载量换算51

Gemini CLI

3.19%
按下载量换算23

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills