Production MongoDB replica-set operation: topology, durability, host tuning, and the container-specific gotchas Claude gets wrong.

MITAuto-check passedDatabases

Install Mongodb Replica Sets

skills CLI
$ npx skills add TheDecipherist/claude-code-mastery-project-starter-kit --skill mongodb-replica-sets -a claude-code

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

GitHub CLI
$ gh skill install TheDecipherist/claude-code-mastery-project-starter-kit mongodb-replica-sets --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/TheDecipherist/claude-code-mastery-project-starter-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/mongodb-replica-sets .claude/skills/mongodb-replica-sets && 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-replica-sets
GitHub stars
338
Token cost
~1.6k tokens
SKILL.md length
801 words
Files
1
Skills in repo
24
Repo updated
First seen
Licence
MIT

At a glance

Production MongoDB replica-set operation: topology, durability, host tuning, and the container-specific gotchas Claude gets wrong.

  • Configuring a replica set
  • SKILL.md covers Topology: odd voting members,…, Connect to the set, not to one…, Durability and reads and Authentication between members, plus 4 more sections
  • Calls openssl and docker
  • Writing its connection string

What it does

Mongodb Replica Sets is an agent skill from TheDecipherist/claude-code-mastery-project-starter-kit. Production MongoDB replica-set operation: topology, durability, host tuning, and the container-specific gotchas Claude gets wrong. Use when setting up or configuring a replica set, writing its connection string, choosing read preference or write concern, running MongoDB in Docker or Swarm, or planning failover and upgrades. Covers odd-member quorum, connecting via the set rather than one node, WiredTiger cache sizing, the OS tuning MongoDB requires, why ingress-mode ports break a replica set, and oplog/failover…

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 and Backup and disaster recovery. It works with MongoDB and Docker. The repository describes itself as: The definitive starting point for Claude Code projects. Based on Claude Code Mastery Guides V1-V5. The licence is MIT.

When your agent uses it

  • Configuring a replica set
  • Writing its connection string
  • Choosing read preference
  • Running MongoDB in Docker

Example prompts

  • “/mongodb-replica-sets”

Requirements

  • Docker

What it can do on your machine

Read from SKILL.md and the folder at commit 61fbb99. 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

    Shell commands in SKILL.md call:

    • openssl
    • docker

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

  • Network

    No URLs in SKILL.md. Its commands use docker, which can reach the network depending on how they are called.

    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 Replica Sets loads about 1.6k tokens when it runs. Until then it costs about 159 tokens; SKILL.md has 801 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~159
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 TheDecipherist/claude-code-mastery-project-starter-kit at commit 61fbb99, republished under its MIT licence (© TheDecipherist). 801 words, ~1,641 tokens.

Download SKILL.mdSave it as .claude/skills/mongodb-replica-sets/SKILL.md (or your agent's skills folder).
name
mongodb-replica-sets
description
Production MongoDB replica-set operation: topology, durability, host tuning, and the container-specific gotchas Claude gets wrong. Use when setting up or configuring a replica set, writing its connection string, choosing read preference or write concern, running MongoDB in Docker or Swarm, or planning failover and upgrades. Covers odd-member quorum, connecting via the set rather than one node, WiredTiger cache sizing, the OS tuning MongoDB requires, why ingress-mode ports break a replica set, and oplog/failover discipline. Defers query and index shape to mongodb-rules and backup pipelines to mongodb-backups.
when_to_use
- Setting up, configuring, or initializing a replica set, or writing its connection string - Choosing read preference or write concern, or reasoning about…

MongoDB Replica Sets in Production

How to run a replica set, not how to query it (that's mongodb-rules). These are the operational decisions Claude tends to get wrong.

Topology: odd voting members, real hostnames, never localhost

Use an odd number of voting members, three, so a majority can still elect a primary when one is lost. A two-member set has no majority if either dies, it goes read-only. Avoid arbiters unless you truly must: an arbiter holds no data, so a three-node primary-secondary-arbiter set that loses its one data secondary can no longer satisfy w:"majority". Address every member by a hostname that all other members and all clients can resolve and reach; localhost in the config is a classic break, the other members can't reach it. Initialize once, from a single member, after all members are up, and wait for the election before creating users.

javascript
rs.initiate({ _id: "rs0", members: [
  { _id: 0, host: "mongo1.internal:27017", priority: 2 },
  { _id: 1, host: "mongo2.internal:27017", priority: 1 },
  { _id: 2, host: "mongo3.internal:27017", priority: 1 }
]})

Connect to the set, not to one node

The connection string must list the seed members and name the set, so the driver can find the current primary and follow failover. Pointing the app at a single host throws away the high availability the replica set exists to provide.

mongodb://mongo1,mongo2,mongo3/db?replicaSet=rs0

Durability and reads

Writes always go to the primary. w:"majority" means a majority of members acknowledged before the app gets the OK, that is durability, use it for data you can't lose; w:1 (primary only) is fine for the regenerable. Add wtimeoutMS so a degraded set doesn't block writes forever. Reads default to the primary and are strongly consistent. Secondaries are eventually consistent, they lag, so only route reads to them (secondaryPreferred, secondary, or nearest) when stale data is acceptable, analytics and reporting, not a read-after-write the user just made.

Authentication between members

A replica set needs internal auth or any host can join. Generate a keyfile (openssl rand -base64 756), share it across members, and enable security.authorization: enabled with the keyfile. Never expose 27017 to the internet, bind to the private network and firewall it. Use TLS for client and inter-node traffic when the network isn't fully trusted.

OS tuning MongoDB actually requires (self-hosted)

These aren't optional polish, MongoDB warns about them and they cause real instability if skipped:

  • Disable Transparent Huge Pages (THP). THP hurts database memory access patterns badly; set enabled and defrag to never at boot.
  • vm.swappiness=1. Keep the working set in RAM instead of swapping out the cache.
  • Raise ulimits. nofile and nproc to 64000/32000, the defaults are too low for a busy mongod's connections and threads.
  • XFS for the data volume. MongoDB recommends XFS over ext4 for WiredTiger. Never put data on NFS or network storage, the latency wrecks it.
Show full SKILL.md (361 more words)Show less

WiredTiger cache, especially in a container

Set --wiredTigerCacheSizeGB explicitly from the container's memory limit, roughly half of it minus 1GB, and cap the container's memory in the deploy block. Don't rely on the default: it targets about half of system RAM, and the cache is only part of mongod's footprint (connections, aggregation, and sort buffers live outside it). An unset cache sized against the host plus those buffers will exceed a container limit and get the container OOM-killed. Leave headroom on purpose.

Running it in Docker or Swarm

The replica-set-specific traps on top of the general docker and docker-swarm skills:

  • Publish the port in mode: host, never ingress. The routing mesh load-balances 27017 across all three members, which breaks the replica set, clients and members must reach a specific member. Use ports: [{ target: 27017, published: 27017, mode: host }].
  • Pin each member to its own node. Without placement constraints all three can land on one host and you have zero fault tolerance. Label nodes and constrain each service (node.labels.mongo.replica == 1), one member per host.
  • Bind-mount the data directory to a host path. Anonymous or named-without-bind volumes risk data loss on recreation and are hard to back up. Pre-create the dir and chown 999:999 (the image runs as UID 999). XFS host filesystem.
  • Real healthcheck, with a start period. test: ["CMD","mongosh","--eval","db.adminCommand('ping')"] and start_period: 60s, so a slow first start isn't read as unhealthy.
  • Keyfile and root password via Docker secrets, not plaintext env (which shows in docker inspect and image history).

Oplog and failover discipline

The oplog is your recovery window: a secondary that falls further behind than the oplog covers needs a full resync, and point-in-time recovery can only reach back as far as the oplog. Size it for your write volume (24h minimum, 48 to 72h is a safer target; db.getReplicationInfo() shows the current window). Test failover on a schedule with rs.stepDown(), don't discover at an outage that the app doesn't reconnect. Roll upgrades secondaries-first, one at a time, step the primary down last, and let each node resync before moving on.


This skill is built to grow. Add a rule when a real replica-set operation has a stable, defensible fix.

© TheDecipherist, 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 .claude/skills/mongodb-replica-sets of TheDecipherist/claude-code-mastery-project-starter-kit.

Open the folder on GitHubat commit 61fbb99

Compare with similar skills

Mongodb Replica Sets 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 Replica Sets compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mongodb Replica Sets this skillTheDecipherist/claude-code-mastery-project-starter-kit338—~1.6kAutomated safety check: PassMIT
Monstermq Broker Configvogler75/monster-mq143—~2.2kAutomated safety check: PassGPL-3.0
Mongodbsickn33/agentic-awesome-skills47k2 repos~2.7kAutomated safety check: NotesMIT
Rhctlsaidake/rhctl106—~4kAutomated safety check: NotesApache-2.0
Mongodb MCP Setupmongodb/agent-skills1901 repos~3.3kAutomated safety check: PassApache-2.0
Automating Database Backupsjeremylongshore/tons-of-skills-marketplace2.8k—~1.5kAutomated safety check: PassMIT

Similar skills

  • Monstermq Broker Config

    vogler75/monster-mq

    Guide for configuring, deploying, and operating the MonsterMQ broker.

    143 GitHub stars~2.2k tokensUpdated 2 days ago
    DevOps & CloudAuto-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
  • Rhctl

    saidake/rhctl

    Run and author rhctl CLI workflows and remote environment scripts under scripts/ (PostgreSQL, JetStream, Docker, Redis, MongoDB, AWS LocalStack, execute/upload/patch).

    106 GitHub stars~4k tokensUpdated 2 days ago
    DatabasesAuto-check: notes
  • Mongodb MCP Setup

    mongodb/agent-skills

    Official

    Guide users through configuring key MongoDB MCP server options.

    190 GitHub starsUsed in 1 repo~3.3k tokens
    DatabasesAuto-check passed
  • Automating Database Backups

    jeremylongshore/tons-of-skills-marketplace

    Automate database backup processes with scheduling, compression, and encryption.

    2.8k GitHub stars~1.5k tokensUpdated today
    DatabasesAuto-check passed
  • Use Sealos

    hashgraph-online/awesome-codex-plugins

    Deploy and operate apps on Sealos Cloud: sign in to a Sealos account, deploy any project or self-hosted app (from the template store, an official Docker image, or project source code), provision…

    1.2k GitHub stars~2.2k tokensUpdated today
    DatabasesAuto-check passed

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

All 24 skills in this repo
  • Create Service

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

    Scaffold a new microservice that follows the project's server/handlers/adapters architecture.

    338 GitHub stars~1.8k tokensUpdated 3 mo ago
    Auto-check: notes
  • CSS Structure

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

    Where CSS should live. An agent skill from TheDecipherist/claude-code-mastery-project-starter-kit.

    338 GitHub stars~1k tokensUpdated 3 mo ago
    Auto-check passed
  • Docker

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

    Production Docker best practices for writing Dockerfiles, Compose files, and Swarm stacks.

    338 GitHub stars~1.6k tokensUpdated 3 mo ago
    Auto-check: notes
  • Docker Swarm

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

    Production Docker Swarm deployment rules: what changes when a compose file goes from a single node to a multi-node Swarm.

    338 GitHub stars~1.8k tokensUpdated 3 mo ago
    Auto-check passed
  • 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
    Auto-check passed
  • Nginx

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

    Production NGINX configuration best practices, especially as a reverse proxy in front of containerized backends.

    338 GitHub stars~1.9k tokensUpdated 3 mo ago
    Auto-check passed

Works with

Questions about Mongodb Replica Sets

What does Mongodb Replica Sets do?

Production MongoDB replica-set operation: topology, durability, host tuning, and the container-specific gotchas Claude gets wrong. Mongodb Replica Sets is an agent skill from TheDecipherist/claude-code-mastery-project-starter-kit. Production MongoDB replica-set operation: topology, durability, host tuning, and the container-specific gotchas Claude gets wrong.

When should I use Mongodb Replica Sets?

Mongodb Replica Sets fits situations like: configuring a replica set; writing its connection string; choosing read preference; running MongoDB in Docker.

How do I install Mongodb Replica Sets in Claude Code?

Run `npx skills add TheDecipherist/claude-code-mastery-project-starter-kit --skill mongodb-replica-sets -a claude-code`. Or copy the skill folder (.claude/skills/mongodb-replica-sets in TheDecipherist/claude-code-mastery-project-starter-kit) into .claude/skills/mongodb-replica-sets in your project. Claude Code loads it when a task matches its description.

How do I install Mongodb Replica Sets in Codex?

Run `npx skills add TheDecipherist/claude-code-mastery-project-starter-kit --skill mongodb-replica-sets -a codex`. Or copy the skill folder (.claude/skills/mongodb-replica-sets in TheDecipherist/claude-code-mastery-project-starter-kit) into .agents/skills/mongodb-replica-sets in your project. Codex loads it when a task matches its description.

Can I use Mongodb Replica Sets 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 TheDecipherist/claude-code-mastery-project-starter-kit --skill mongodb-replica-sets -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-replica-sets, .gemini/skills/mongodb-replica-sets, .github/skills/mongodb-replica-sets and .opencode/skills/mongodb-replica-sets in your project.

What does Mongodb Replica Sets need to run?

Going by SKILL.md and its folder, Mongodb Replica Sets needs the command-line tools its instructions call (openssl and docker). Our summary lists: Docker.

Does Mongodb Replica Sets access the network?

SKILL.md contains no URLs. Its commands use docker, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Mongodb Replica Sets 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 Replica Sets use?

Mongodb Replica Sets 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 Replica Sets use?

About 1.6k tokens (SKILL.md is roughly 6.6k 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 Replica Sets?

Skills that share tags, products or a category with Mongodb Replica Sets: Monstermq Broker Config (vogler75/monster-mq, 143 stars), Mongodb (sickn33/agentic-awesome-skills, 47k stars), Rhctl (saidake/rhctl, 106 stars) and Mongodb MCP Setup (mongodb/agent-skills, 190 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mongodb Replica Sets?

TheDecipherist (a GitHub user) maintains it in TheDecipherist/claude-code-mastery-project-starter-kit, which has 338 GitHub stars. The repository holds 24 skills in this directory. The repository was last updated on June 29, 2026.

Source: TheDecipherist/claude-code-mastery-project-starter-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.