Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Apache Cassandra is a distributed NoSQL database designed for high availability and linear scalability. Learn CQL (Cassandra Query Language), data modeling with partition keys, replication strategies, and integration with Node.js using the DataStax driver.
.claude/skills/terminalskills-cassandra/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 25% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 103% | 0% |
| case-03 | ✓→✓ | = Same ✓ | -8% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 69% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 170% | 0% |
Apache Cassandra is a peer-to-peer distributed database that provides high availability with no single point of failure. Data is distributed across nodes using consistent hashing.
bash# Docker (recommended) docker run -d --name cassandra -p 9042:9042 cassandra:4 # Wait for startup then connect with cqlsh docker exec -it cassandra cqlsh # Node.js driver npm install cassandra-driver # Python driver pip install cassandra-driver
sql-- keyspace.cql: Create keyspace with replication strategy CREATE KEYSPACE IF NOT EXISTS myapp WITH replication = { 'class': 'NetworkTopologyStrategy', 'datacenter1': 3 } AND durable_writes = true; USE myapp;
sql-- tables.cql: Design tables around query patterns (partition key + clustering key) -- Rule: one table per query pattern -- Users by email (partition key: email) CREATE TABLE users ( email text PRIMARY KEY, name text, created_at timestamp ); -- Posts by user, ordered by time (partition: user_id, clustering: created_at DESC) CREATE TABLE posts_by_user ( user_id uuid, created_at timestamp, post_id uuid, title text, body text, PRIMARY KEY (user_id, created_at) ) WITH CLUSTERING ORDER BY (created_at DESC); -- Time-series: sensor readings bucketed by day CREATE TABLE sensor_readings ( sensor_id text, day text, reading_time timestamp, value double, PRIMARY KEY ((sensor_id, day), reading_time) ) WITH CLUSTERING ORDER BY (reading_time DESC);
sql-- crud.cql: Basic insert, select, update, delete INSERT INTO users (email, name, created_at) VALUES ('alice@example.com', 'Alice', toTimestamp(now())); SELECT * FROM users WHERE email = 'alice@example.com'; -- Query with partition and clustering key SELECT * FROM posts_by_user WHERE user_id = 550e8400-e29b-41d4-a716-446655440000 AND created_at > '2026-01-01' LIMIT 20; UPDATE users SET name = 'Alice Smith' WHERE email = 'alice@example.com'; DELETE FROM users WHERE email = 'alice@example.com'; -- Batch for atomicity within a partition BEGIN BATCH INSERT INTO posts_by_user (user_id, created_at, post_id, title) VALUES (?, ?, ?, ?); UPDATE user_stats SET post_count = post_count + 1 WHERE user_id = ?; APPLY BATCH;
javascript// db.js: Cassandra client with DataStax Node.js driver const { Client, types } = require('cassandra-driver'); const client = new Client({ contactPoints: ['localhost'], localDataCenter: 'datacenter1', keyspace: 'myapp', queryOptions: { consistency: types.consistencies.localQuorum }, }); async function main() { await client.connect(); // Insert await client.execute( 'INSERT INTO users (email, name, created_at) VALUES (?, ?, ?)', ['bob@example.com', 'Bob', new Date()], { prepare: true } ); // Query const result = await client.execute( 'SELECT * FROM users WHERE email = ?', ['bob@example.com'], { prepare: true } ); console.log(result.rows[0]); // Paginated query const query = 'SELECT * FROM posts_by_user WHERE user_id = ?'; for await (const row of client.stream(query, [userId], { prepare: true })) { console.log(row.title); } await client.shutdown(); } main().catch(console.error);
python# app.py: Cassandra with Python DataStax driver from cassandra.cluster import Cluster from cassandra.query import SimpleStatement, ConsistencyLevel cluster = Cluster(['localhost']) session = cluster.connect('myapp') # Insert session.execute( "INSERT INTO users (email, name, created_at) VALUES (%s, %s, toTimestamp(now()))", ('alice@example.com', 'Alice') ) # Query with consistency level stmt = SimpleStatement( "SELECT * FROM users WHERE email = %s", consistency_level=ConsistencyLevel.LOCAL_QUORUM ) row = session.execute(stmt, ('alice@example.com',)).one() print(row.name) cluster.shutdown()
textConsistency Levels: - ONE: Fast, low consistency. Good for logs/metrics. - QUORUM: Majority of replicas. Balanced read/write. - LOCAL_QUORUM: Majority in local datacenter. Best for multi-DC. - ALL: All replicas must respond. Slowest, strongest consistency. Rule of thumb: Write CL + Read CL > Replication Factor = strong consistency Example: RF=3, Write=QUORUM(2), Read=QUORUM(2) → 2+2 > 3 ✓
bash# nodetool.sh: Common operational commands # Check cluster status docker exec cassandra nodetool status # Check ring token distribution docker exec cassandra nodetool ring # Repair data (run regularly) docker exec cassandra nodetool repair myapp # Compact SSTables docker exec cassandra nodetool compact myapp posts_by_user # Take a snapshot backup docker exec cassandra nodetool snapshot myapp -t backup_20260219
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 9,838 | 5,586 | -43% | 1 | 1 | 0% | 2,152 | 2,885 | +34% | 0 | 0 | — |
case-02 | fail→pass | 9,995 | 6,907 | -31% | 1 | 1 | 0% | 2,403 | 2,998 | +25% | 0 | 0 | — |
case-03 | pass→pass | 16,369 | 9,024 | -45% | 1 | 1 | 0% | 3,922 | 3,610 | -8% | 0 | 0 | — |
case-04 | pass→pass | 7,142 | 5,254 | -26% | 1 | 1 | 0% | 1,439 | 2,433 | +69% | 0 | 0 | — |
case-05 | pass→pass | 4,365 | 3,381 | -23% | 1 | 1 | 0% | 759 | 2,051 | +170% | 0 | 0 | — |
case-06 | fail→pass | 5,054 | 3,135 | -38% | 1 | 1 | 0% | 960 | 1,951 | +103% | 0 | 0 | — |
case-07 | pass→pass | 2,934 | 2,685 | -8% | 1 | 1 | 0% | 583 | 1,926 | +230% | 0 | 0 | — |
case-08 | pass→pass | 8,266 | 5,990 | -28% | 1 | 1 | 0% | 1,462 | 2,416 | +65% | 0 | 0 | — |
case-09 | fail→fail | 10,080 | 8,575 | -15% | 1 | 1 | 0% | 1,976 | 3,127 | +58% | 0 | 0 | — |
case-10 | pass→pass | 6,019 | 3,329 | -45% | 1 | 1 | 0% | 1,175 | 2,108 | +79% | 0 | 0 | — |
case-11 | pass→pass | 4,390 | 3,107 | -29% | 1 | 1 | 0% | 895 | 2,041 | +128% | 0 | 0 | — |
case-12 | pass→pass | 13,247 | 6,532 | -51% | 1 | 1 | 0% | 2,344 | 2,590 | +10% | 0 | 0 | — |
case-13 | pass→pass | 4,757 | 3,186 | -33% | 1 | 1 | 0% | 791 | 1,897 | +140% | 0 | 0 | — |
case-14 | pass→pass | 5,406 | 3,637 | -33% | 1 | 1 | 0% | 958 | 2,149 | +124% | 0 | 0 | — |
case-15 | pass→pass | 3,604 | 3,168 | -12% | 1 | 1 | 0% | 683 | 1,971 | +189% | 0 | 0 | — |
case-16 | fail→fail | 3,013 | 1,764 | -41% | 1 | 1 | 0% | 518 | 1,710 | +230% | 0 | 0 | — |
case-17 | pass→pass | 9,737 | 6,788 | -30% | 1 | 1 | 0% | 1,846 | 2,795 | +51% | 0 | 0 | — |
case-18 | pass→pass | 4,907 | 2,901 | -41% | 1 | 1 | 0% | 835 | 1,926 | +131% | 0 | 0 | — |
case-19 | pass→pass | 6,224 | 5,046 | -19% | 1 | 1 | 0% | 1,234 | 2,452 | +99% | 0 | 0 | — |
case-20 | pass→pass | 9,294 | 7,413 | -20% | 1 | 1 | 0% | 1,739 | 2,804 | +61% | 0 | 0 | — |
case-21 | pass→pass | 3,150 | 2,419 | -23% | 1 | 1 | 0% | 534 | 1,838 | +244% | 0 | 0 | — |
case-22 | pass→pass | 3,404 | 2,481 | -27% | 1 | 1 | 0% | 705 | 1,844 | +162% | 0 | 0 | — |
case-23 | pass→pass | 3,659 | 1,871 | -49% | 1 | 1 | 0% | 797 | 1,735 | +118% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.