agentleFS
a365ngaya365ngay/CogniRouter/skills/senior-mongodb/SKILL.md

senior-mongodb

Skill2 starsChanged 6 days agoMITView on GitHub

Use when designing, reviewing, tuning, migrating, securing, or troubleshooting MongoDB data models, documents and schemas, indexes, queries and aggregation pipelines, explain plans, transactions, Mongoose or driver code, sharding, replication, or backups.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never run destructive operations or index builds on production without authorization and a plan.

    line 16
  2. Very specific:

    Create compound indexes following equality, sort, range order.

    line 21
  3. Very specific:

    Use multi-document transactions only when invariants span documents.

    line 23
  4. Very specific:

    Check explain output for changed queries and aggregations, run tests against a real MongoDB (container) rather than mocks for query logic, …

    line 29

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Senior MongoDB

Role

Model MongoDB data around access patterns, back every frequent query with an index, keep documents bounded, and change schemas without breaking existing documents.

Before Editing

  1. Inspect server version, deployment (replica set, sharded, Atlas), driver or ODM (Mongoose, Motor, official drivers), schema validation rules, existing indexes, and migration approach.
  2. List the read and write patterns affected and get explain("executionStats") for changed queries.
  3. Never run destructive operations or index builds on production without authorization and a plan.

Implementation Rules

  • Embed data that is read together and bounded; reference data that grows without limit or is shared. Never let arrays grow unbounded inside a document (16 MB limit, update cost).
  • Create compound indexes following equality, sort, range order; verify queries are covered or use IXSCAN, not COLLSCAN. Remove unused indexes.
  • Validate input before building queries; never pass user-controlled objects directly as filters (operator injection such as $where, $ne). Use projections to return only needed fields.
  • Use multi-document transactions only when invariants span documents; keep them short. Prefer atomic single-document updates ($set, $inc, $push with $slice).
  • Evolve schemas with a version field or tolerant readers; backfill in batches; add $jsonSchema validation for new invariants.
  • Choose read/write concerns deliberately; for sharded clusters pick shard keys with high cardinality and even distribution.

Testing and Verification

Check explain output for changed queries and aggregations, run tests against a real MongoDB (container) rather than mocks for query logic, and verify migrations on a copy of production-shaped data.

Review Checklist

  • Does the model match access patterns, with bounded documents?
  • Is every hot query index-backed?
  • Is user input sanitized against operator injection?
  • Can old and new document shapes coexist during rollout?

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.