/database-operations-skills:cassandra-wide-column-database-operationsfrom database-operations-skills
Covers Cassandra ring topology, partition key design, consistency levels, compaction strategies, and tombstone management. Use when designing schemas, diagnosing hot partitions, slow queries, or tombstone warnings.
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.
Cassandra's defining architectural choice — a masterless ring where every node is structurally equal, data is distributed by consistent hashing of the partition key, and consistency is tunable per query rather than fixed by the engine — trades the strong consistency guarantees of a single-primary database for horizontal write scalability and no single point of failure. That trade only pays off operationally if the partition key is chosen well (a bad choice creates a hot partition the ring can't help with), the consistency level matches the actual durability/availability requirement per query, and compaction strategy matches the write pattern. This skill covers ring topology and token design, consistency-level selection, and compaction/ tombstone management — the recurring operational decisions that determine whether a Cassandra cluster stays healthy as it scales.
ReadTimeoutException mentioning
tombstones, or a "tombstone_warn_threshold" log message) or overall
read performance degrading over time on a table with regular deletes/
TTLs.nodetool
command surface and virtual tables referenced here are stable across
most of the 3.x/4.x line, but note that vnodes — virtual nodes,
multiple token ranges per physical node — have been the default since
Cassandra 2.x, and choosing num_tokens deliberately still matters
for cluster balance at small node counts).nodetool access on each node (local or via JMX) for ring, repair,
and compaction administration — this typically requires host access
or JMX credentials, not just CQL client access.NetworkTopologyStrategy keyspace
configuration appropriate to the deployment's rack/datacenter
layout — SimpleStrategy (rack/DC-unaware) is only appropriate for a
single-datacenter test/dev cluster, never production.CREATE TABLE sensor_readings (
device_id UUID,
reading_day DATE,
reading_ts TIMESTAMP,
value DOUBLE,
PRIMARY KEY ((device_id, reading_day), reading_ts)
) WITH CLUSTERING ORDER BY (reading_ts DESC);
The partition key ((device_id, reading_day) here — a composite
key) determines which physical node(s) hold a given row via consistent
hashing of the key's hash into the ring's token range; the
clustering columns (reading_ts) determine sort order within a
partition, not distribution across the ring. A partition key that's
too broad (e.g. device_id alone for a high-volume sensor generating
years of readings) creates an ever-growing partition that eventually
becomes a genuine hotspot — one node handles disproportionate
read/write/compaction load for that key, and Cassandra's ring can't
help since that key hashes to one place regardless of cluster size.
Including reading_day bounds each partition to one day's readings for
one device, keeping partition size manageable indefinitely as time
passes, at the cost of queries spanning multiple days needing multiple
partition reads (an explicit, deliberate trade — not a defect).
CONSISTENCY LOCAL_QUORUM;
SELECT * FROM sensor_readings WHERE device_id = <ID> AND reading_day = '2026-07-28';
Consistency level determines how many replicas must respond before a read/write is acknowledged, out of the keyspace's configured replication factor (RF):
ONE — fastest, lowest availability requirement (any single replica
answers), weakest consistency (can read stale data if the responding
replica hasn't yet received the latest write).QUORUM — a strict majority of all replicas across all
datacenters must respond; LOCAL_QUORUM requires a majority only
within the local datacenter, avoiding cross-DC latency for
multi-region deployments while still giving strong-enough consistency
for most application needs.ALL — every replica must respond; strongest consistency, but
availability drops to zero the moment even one replica holding that
partition is unreachable — appropriate only for narrow cases where
that trade is genuinely acceptable, essentially never as a default.
R + W > RF (read consistency level's replica count plus write
consistency level's replica count exceeding the replication factor)
is the classic condition for strong consistency on a given
read-after-write path — e.g. QUORUM writes plus QUORUM reads at
RF=3 (2 + 2 > 3) guarantees a read sees the latest acknowledged
write, at the cost of both operations needing a majority of replicas
available. LOCAL_ONE writes plus LOCAL_ONE reads does not give
that guarantee and should only be chosen for data where eventual
consistency is genuinely acceptable (e.g. non-critical telemetry,
idempotent counters with independent reconciliation).Cassandra is an LSM-tree-based engine: writes go to an in-memory memtable, flushed periodically to immutable on-disk SSTables, which compaction periodically merges to reclaim space from overwrites/ deletes and reduce the number of SSTables a read must check.
-- Default, general-purpose: good for write-heavy workloads with
-- moderate read amplification tolerance
ALTER TABLE sensor_readings WITH compaction =
{'class': 'SizeTieredCompactionStrategy'};
-- Better read latency at the cost of more compaction I/O: good for
-- read-heavy workloads that can't tolerate SizeTiered's read amplification
ALTER TABLE user_profiles WITH compaction =
{'class': 'LeveledCompactionStrategy'};
-- Purpose-built for time-series data with a natural TTL/expiry pattern
ALTER TABLE sensor_readings WITH compaction =
{'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': 1};
TimeWindowCompactionStrategy (TWCS) groups SSTables by time window and
compacts within a window only, never across windows — this makes
dropping expired data (via TTL) extremely cheap, since an entire
SSTable whose data has all aged past its TTL can simply be dropped
rather than compacted/rewritten. Choose TWCS for genuinely time-series,
mostly-append, TTL-expiring data (matching the window size to the TTL
and write rate); choose it incorrectly for a table with out-of-window
updates/deletes and it performs worse than SizeTiered, since data
correction across windows defeats TWCS's core assumption.
A DELETE (or a TTL expiry) in Cassandra doesn't immediately remove
data — it writes a tombstone marker that must persist until
gc_grace_seconds (default 10 days) has passed and a repair has run,
so that a tombstone isn't garbage-collected on one replica before
other, possibly-behind replicas have received it (which would cause a
deleted row to "resurrect" on those replicas). A read that must skip
over many tombstones to find live data is slow and can trigger
tombstone_failure_threshold:
SELECT * FROM events WHERE partition_key = <KEY>;
-- WARN: Read 1500 live and 8500 tombstoned cells in events
This is a strong signal of a query pattern that deletes/overwrites
heavily within a partition that's also read frequently (a common
anti-pattern: using Cassandra as a queue, where consumed rows are
deleted but the partition is still scanned). Redesign the data model
(e.g. bucket by time window so consumed/old buckets are simply not
queried rather than deleted row-by-row) rather than only tuning
gc_grace_seconds down, since lowering it without ensuring repairs run
frequently enough within the new, shorter window risks the exact
resurrection problem it exists to prevent.
# Check current ring token ownership and load balance
nodetool status
nodetool ring
Adding a node with auto_bootstrap: true (default) streams a share of
existing data to it from current owners of the token ranges it takes
over — this is I/O- and network-intensive and should be done one node
at a time, monitoring nodetool netstats for streaming progress, never
multiple nodes joining concurrently in a way that could leave overlapping
token ranges under-replicated during the transition.
nodetool decommission # run on the node being removed — streams its data OUT to remaining owners first
Warning — destructive if done out of order. Never simply stop and remove a node's process/host without running
nodetool decommissionfirst (or, if the node is already dead,nodetool removenodefrom a surviving node) — skipping this step means the data that node owned is not streamed anywhere first, and if the replication factor doesn't cover the loss adequately at that moment, that data is gone. Always runnodetool repairon the affected token ranges afterward to confirm replica consistency.
NetworkTopologyStrategy with an explicit per-datacenter
replication factor for every production keyspace — never
SimpleStrategy outside of local development.nodetool repair, or an automated
repair scheduler) within the gc_grace_seconds window on every
table with deletes/TTLs — a missed repair window is what turns a
routine tombstone GC into a data-resurrection bug.nodetool decommission a node being removed (never just stop
the process), and add/remove nodes to a live cluster strictly one at
a time, monitoring streaming progress before proceeding to the next.Symptom: One node in the ring consistently shows much higher
CPU/disk I/O and larger data size than others, and it worsens over
time.
Fix: The partition key is unbounded (e.g. a single device_id
with years of accumulating data, no time-bucketing dimension),
concentrating an ever-growing amount of data and read/write/compaction
load onto whichever node(s) own that key's token range — the ring
can't rebalance a hot single key regardless of node count. Redesign
the partition key to include a bounding dimension (a time bucket, a
shard suffix) so no single partition grows unbounded.
Symptom: Reads against a table with regular deletes/TTL expiry
slow down progressively, and logs show tombstone warning/failure
threshold messages.
Fix: The query pattern reads across many tombstoned cells to find
live data — usually from deleting/expiring rows within a partition
that's still scanned as a whole. Redesign the data model to bucket by
time so expired data ages out of the query's scope entirely (never
queried, not deleted-then-skipped), and confirm regular repairs run
within gc_grace_seconds rather than only lowering the threshold.
Symptom: A DELETEd row reappears ("resurrects") after some time,
with no application code writing it back.
Fix: A replica missed the tombstone (was down or partitioned
during the delete) and its stale, pre-delete data was never
reconciled by a repair before gc_grace_seconds elapsed and the
tombstone was garbage-collected on other replicas — that stale
replica's old data can then "win" on a subsequent read. Run
nodetool repair regularly and comfortably within the
gc_grace_seconds window (not just when convenient), and treat a
missed repair window on a table with active deletes as an urgent gap
to close, not routine maintenance debt.
Symptom: After adding new nodes to the cluster, data distribution
across nodes remains uneven despite nodetool status showing roughly
equal Owns percentages.
Fix: Even token ownership doesn't guarantee even data size if the
partition key distribution itself is skewed (some partitions are much
larger than others) — token-range ownership balance and actual data
volume balance are related but distinct. Investigate partition size
distribution (nodetool tablehistograms) rather than assuming ring
rebalancing alone will fix a skewed-key-driven imbalance.
Symptom: Someone runs TRUNCATE on a table, or DROP KEYSPACE,
directly against production to "reset" data during an incident.
Fix: Both are immediately destructive, cluster-wide operations —
TRUNCATE in particular also forces a table-wide snapshot on all
nodes by default (which is itself an I/O-heavy operation across the
whole cluster) and cannot be undone via CQL.
Warning — destructive action. Never run
TRUNCATE/DROP KEYSPACEagainst a shared or production cluster without an independently confirmed target and a verified, tested backup/snapshot restore path (see database-backup-and-restore-strategies), and restrict these operations via role-based access control to a narrow admin role rather than general application credentials.
Scenario: An IoT platform's sensor_readings table
(PRIMARY KEY (device_id, reading_ts), unbounded partition key) has
been running for two years; one specific high-frequency industrial
sensor's node consistently shows 3x the disk I/O and query latency of
its peers, and read latency for that sensor's dashboard has degraded
noticeably.
nodetool tablehistograms keyspace.sensor_readings
Shows a partition size distribution with a long tail — the
affected sensor's partition (two years of readings, no bucketing) is
orders of magnitude larger than the median partition.CREATE TABLE sensor_readings_v2 (
device_id UUID, reading_day DATE, reading_ts TIMESTAMP, value DOUBLE,
PRIMARY KEY ((device_id, reading_day), reading_ts)
) WITH CLUSTERING ORDER BY (reading_ts DESC)
AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': 1};
sensor_readings_v2
bucketed by day, then cut reads over once backfill is verified
complete for all devices.sensor_readings_v2, letting
TimeWindowCompactionStrategy drop entire expired daily SSTables
cheaply instead of accumulating tombstones from manual deletes.nodetool repair runs comfortably within
gc_grace_seconds, and monitor nodetool tablehistograms monthly
for partition-size skew as a standing health check going forward,
catching the next hot-partition trend before it's user-visible.TRUNCATE, DROP KEYSPACE, a failed node removal) against a Cassandra cluster.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
cassandra, wide-column, partition-key, compaction, tombstone, ring-topology
23 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."
/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."
/database-schema-migration-with-liquibase-and-flywayCovers version-controlled schema migration tooling (Liquibase changesets/changelogs, Flyway versioned/repeatable migrations), forward-only vs. reversible migration design, safe patterns for backward-compatible rolling deploys, and testing migrations in CI before they reach production. Use when the user asks to "set up Flyway/Liquibase for this project," "write a rollback for this migration," "why did this migration fail halfway through," "how do I test a schema migration in CI," or "design a zero-downtime column rename/backfill."
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin database-operations-skillsOther plugins' skills for the same job