/database-operations-skills:mongodb-configuration-validationfrom database-operations-skills
Validates MongoDB replica set config, sharding setup, and index changes before production rollout — checking quorum math, shard key cardinality, and index build impact.
Ships in database-operations-skills. 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.
MongoDB's flexibility — reconfiguring a replica set, resharding a collection, adding an index — makes it easy to apply a change that looks fine in the shell but has a consequence that only surfaces under production load: a replica set reconfiguration that breaks voting quorum math, a shard key that seemed reasonable in a sample but has terrible real-world cardinality, or a foreground index build that stalls writes on a busy primary. This skill is the pre-production validation gate for those changes, complementing the operational depth in mongodb-operations-and-scaling.
rs.reconfig() to add/remove a replica set member,
change priorities/votes, or adjust electionTimeoutMillis.reshardCollection on an existing one.writeConcern/readConcern defaults, or introducing a
readPreference change to an application that reads from secondaries.clusterMonitor role (or higher) for read-only validation queries
(rs.conf(), rs.status(), sh.status(), db.collection.stats());
clusterAdmin/dbAdmin only needed to actually apply validated
changes.reshardCollection
requires 4.4+, replSetResizeOplog requires 3.6+).rs.reconfig()cfg = rs.conf()
cfg.members.forEach(m => print(m.host, m.votes, m.priority, m.arbiterOnly))
A replica set needs a majority of voting members reachable to elect a primary and to accept majority-acknowledged writes. Validate:
votes: 1 to an existing set with an
even total is a common mistake made "to add capacity" that actually
degrades quorum math — validate the resulting total, not just that the
new member itself looks reasonable.priority: 0 cannot become primary but still votes
(unless also configured votes: 0) — confirm this is intentional
(e.g. a reporting-only or cross-region DR replica) and not an
unintended side effect of a copy-pasted config.db.orders.aggregate([
{ $group: { _id: "$tenantId", count: { $sum: 1 } } },
{ $sort: { count: -1 } },
{ $limit: 10 }
])
Run this against the actual candidate shard key fields (or the leading field of a compound key) on production or a representative snapshot, not a synthetic test dataset. Flag as unsafe:
_id, or any
timestamp/auto-increment field) for a write-heavy collection, since
this concentrates new writes on one shard's current chunk range
regardless of overall cardinality.
Cross-check the query patterns that will run against the sharded
collection: a shard key that distributes writes well but doesn't appear
as a filter in the majority of queries forces mongos to broadcast
(scatter-gather) those queries to every shard — validate this trade-off
explicitly rather than optimizing purely for write distribution.db.orders.stats().count // collection size
db.currentOp({ "command.createIndexes": { $exists: true } }) // check for an in-progress build
Confirm the index build will run in the background/online mode
appropriate to the MongoDB version in use (default online builds since
4.2), and — critically — confirm it will be run as a rolling build
(secondaries first, each stepped out of the effective read path via
readPreference before its build starts, then the primary) for a large
collection on a busy replica set, rather than a single foreground build
against the primary. Validate the collection's current size and expected
build duration against a maintenance window if the workload cannot
tolerate any degraded secondary read capacity during the build.
writeConcern/readConcern changes against the actual durability requirementdb.orders.insertOne({...}, { writeConcern: { w: "majority", wtimeout: 5000 } })
w: 1 (default in some driver configs) acknowledges a write once the
primary applies it, with no guarantee it's replicated anywhere —
survivable data loss on primary failure. Validate that any collection
storing data where loss is unacceptable (financial, audit) uses
w: "majority" explicitly, not an inherited driver default.wtimeout is set to a sane, non-zero value — an unbounded
wait for majority acknowledgment during a replica set election or
network partition can hang application writes indefinitely otherwise.readPreference: secondary or secondaryPreferred changes,
validate the read traffic being redirected can tolerate replication
lag (i.e. it's not read-your-own-write-sensitive application logic) —
this is a common source of "the record I just wrote isn't there yet"
bugs when validation is skipped.Apply the reconfiguration/index build/shard key choice against a staging environment seeded with production-shaped data (real cardinality distributions matter far more than raw row count for shard key validation specifically) before scheduling the production change.
rs.reconfig(), rather than
reviewing each member change in isolation — quorum math is a property
of the whole set, not any single member.reshardCollection or manual
migration) than the validation effort up front.w: 1 writeConcern on any collection storing data with real
durability requirements as a finding to flag, not a silent default to
accept.Symptom: After adding a new replica set member "for read capacity,"
the set fails to elect a primary during a later single-node outage that
previously would have been survivable.
Fix: The new member's vote pushed the total voting member count to
an even number, so a single-node loss can produce a tie with no
majority achievable. Recompute total voters after every membership
change and keep the total odd — consider votes: 0 for a member
that's meant to be read-capacity-only, not a failover participant.
Symptom: A shard key validated against a small staging dataset looked evenly distributed, but in production one shard receives a wildly disproportionate share of both storage and query load. Fix: The staging dataset's cardinality/skew didn't represent production reality (e.g. synthetic data with uniform random tenant IDs, vs. production's actual heavy-tailed tenant size distribution). Re-validate shard key candidates against a production data snapshot or a statistically representative sample, specifically checking for skew, not just raw cardinality count.
Symptom: A createIndex() run directly against the primary of a
busy replica set causes a multi-minute write stall and elevated
application error rates during the build.
Fix: The build wasn' t run as a rolling, secondary-first operation,
or the collection was large enough that even a background/online build
contended heavily for I/O and CPU on the primary. Validate collection
size and current load before deciding foreground vs. rolling build
approach, and prefer rolling builds by default on any
production-traffic-bearing replica set.
Symptom: An application intermittently fails to read a document it
just wrote, only under moderate load.
Fix: A readPreference: secondaryPreferred change was applied to
a code path with read-your-own-write requirements, and replication lag
under load exceeds the assumption. Validate read-preference changes
against each call site's actual consistency requirement, and use
causal consistency sessions or readPreference: primary for
read-your-own-write-sensitive paths.
Symptom: A reviewer approves a reshardCollection run against a
large production collection with no verification that the new shard
key was validated, and it triggers a multi-hour, cluster-wide
resource-intensive resharding operation during business hours.
Fix: This is a high-blast-radius, hard-to-reverse operation once
started — always validate the target shard key against real
cardinality/skew data first (step 2 above), and schedule
reshardCollection for a low-traffic maintenance window with
monitoring on cluster resource usage throughout, since it competes
for I/O and CPU with live traffic for its full duration.
Scenario: A team proposes two changes together: adding a 4th replica
set member (a new cross-region DR replica with priority: 0) and
creating a new compound index on a 200M-document orders collection to
support a new reporting query.
votes: 1, which would bring the
total to 4 (even) — flagged as a quorum regression. Corrected
proposal: set the new member's votes: 0 in addition to
priority: 0, since it's explicitly DR-only and shouldn't
participate in elections or count toward write majority overhead
across a high-latency cross-region link.
cfg = rs.conf()
cfg.members.push({ _id: 3, host: "<DR_HOST>:27017", priority: 0, votes: 0 })
rs.reconfig(cfg)
db.orders.stats().count shows ~200M
documents, and current traffic shows continuous write load with no
natural low-traffic window (24/7 global user base). Recommend a
rolling build: build on each secondary first (temporarily removing it
from readPreference: secondaryPreferred rotation via
hidden: true during the build), verify build completion via
db.currentOp() clearing, restore it to rotation, then repeat for the
primary last using a brief step-down if a fully non-blocking build
isn't available in the deployed version.db.orders.createIndex({ region: 1, createdAt: -1 }, { background: true })
votes: 0/priority: 0, index built as a rolling,
secondary-first operation scheduled outside the collection's daily
peak window despite no true 24/7 lull, to minimize contention.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin database-operations-skills23 skills in this plugin
/arangodb-multi-model-database-operationsCovers operating ArangoDB, a multi-model database combining document, graph, and key-value collections in a single engine with a unified query language (AQL): collection type selection, graph traversal via AQL, and cluster configuration (coordinators, DB-servers, agency). Use when the user asks to "write an AQL query," "should I use a document or edge collection in ArangoDB," "set up an ArangoDB cluster," "why is this AQL graph traversal slow," or "choose between ArangoDB and a single-purpose database for a mixed graph/document workload."
/cassandra-wide-column-database-operationsCovers Apache Cassandra ring topology and token/partition design, tunable consistency levels (ONE, QUORUM, ALL, LOCAL_QUORUM), compaction strategy selection (SizeTiered, Leveled, TimeWindow), and tombstone/GC-grace management. Use when the user asks to "design a Cassandra partition key," "choose a Cassandra consistency level," "why is this Cassandra query slow," "pick a compaction strategy," "Cassandra tombstone warnings in logs," or "add/remove a node from a Cassandra ring."
/clickhouse-analytical-database-operationsCovers operating ClickHouse, the leading open-source OLAP columnar database: MergeTree engine family selection (MergeTree, ReplacingMergeTree, AggregatingMergeTree, SummingMergeTree), sharding and replication topology via ReplicatedMergeTree and Distributed tables, and materialized views for streaming aggregation. Use when the user asks to "set up a ClickHouse cluster," "pick a MergeTree engine," "why are my ClickHouse queries slow," "shard and replicate ClickHouse tables," "deduplicate rows in ClickHouse," or "build a ClickHouse materialized view for rollups."
/cloud-data-warehouse-operations-snowflake-bigquery-redshiftComparative operations guide for the three dominant managed cloud data warehouses: Snowflake virtual warehouse sizing and multi-cluster scaling, BigQuery slot allocation and on-demand vs. capacity pricing, and Redshift cluster/RA3 node sizing and workload management (WLM) — plus cost-control and query-performance practices common to all three. Use when the user asks to "size a Snowflake warehouse," "control BigQuery query costs," "tune Redshift WLM queues," "why is this warehouse query slow," "reduce our data warehouse bill," or "choose between Snowflake, BigQuery, and Redshift."
/database-backup-and-restore-strategiesCross-database backup tooling and restore-testing discipline: pg_dump/pg_basebackup for PostgreSQL, mysqldump/Percona XtraBackup for MySQL/MariaDB, and mongodump/mongorestore for MongoDB — logical vs. physical backup trade-offs, point-in-time recovery, and why an untested restore is not a real backup. Use when the user asks to "set up database backups," "restore from a pg_basebackup," "why did our mysqldump restore fail," "test our backup/restore process," "set up point-in-time recovery," or "design a backup retention policy."
/database-connection-pooling-strategiesCross-database connection pooling patterns and tooling: PgBouncer for PostgreSQL, ProxySQL for MySQL/MariaDB, and the shared design questions (transaction vs. session vs. statement pooling modes, backend pool sizing, failover-aware routing) that apply regardless of the underlying database engine. Use when the user asks to "size a connection pool," "choose between transaction and session pooling," "set up ProxySQL for MySQL," "why do prepared statements break under pooling," or "route reads/writes through a proxy during failover."
Other plugins' skills for the same job