ardurai/god-skill-suite/god-database-mastery
Claude Code and agent skill by ardurai/god-skill-suite
- community
Checking that the SKILL.md file is still in the repository.
God-level database mastery covering SQL (PostgreSQL deep dive, MySQL differences), NoSQL (MongoDB, Cassandra, DynamoDB), NewSQL (CockroachDB, Spanner), caching (Redis deep dive — data structures, persistence, clustering, pub/sub), message streaming (Apache Kafka — architecture, partitioning, consumer groups, exactly-once semantics), Elasticsearch/OpenSearch (indexing, mapping, search relevance, aggregations), time-series (InfluxDB, TimescaleDB), graph databases (Neo4j), schema design, query optimization, indexing strategies, ACID vs BASE, CAP theorem, replication, sharding, and connection pooling. A developer who does not understand their database is a developer who will eventually bring it to its knees.
Install
npx vskill@latest install ardurai/god-skill-suite/god-database-masterySKILL.md
The same SKILL.md was published earlier as ardurai/god-skill-suite/god-database-mastery.
God-Level Database Mastery
Researcher-Warrior Mindset
You do not take the ORM's word for what SQL it generates. You run EXPLAIN ANALYZE. You do not assume the index is being used — you prove it. You read the slow query log. You know that every abstraction leaks, and at some point you will be debugging a production incident with a 3-second database lock hold, and the engineer who understood the query planner will fix it in 10 minutes while the engineer who trusted the ORM sits confused. Know your database at the level of its internals.
Anti-Hallucination Rules
NEVER fabricate:
- PostgreSQL GUC parameter names — verify against
pg_settingsor official docs (e.g.,max_connectionsnotmax_db_connections) - Redis command names —
ZADD,ZRANGE,GEORADIUSexist; invented commands do not - Kafka configuration keys —
bootstrap.serversnotbootstrap_serversin producer config; verify Java vs Python client differences - MongoDB aggregation stage names —
$match,$group,$lookup,$unwind,$projectare real; invented stages are not - Cassandra consistency levels — ALL, QUORUM, LOCAL_QUORUM, ONE, LOCAL_ONE, EACH_QUORUM — verify per operation type
- CockroachDB/Spanner claimed behaviors — only state what is documented in official sources
- PgBouncer pool modes — session, transaction, statement — verify behavior of each
ALWAYS verify:
- PostgreSQL index types available in a given version — BRIN was added in 9.5, covering indexes (
INCLUDE) in 11 - Redis data type command sets — LPOS added in Redis 6.0.6; Bloom Filter requires RedisBloom module
- Kafka exactly-once semantics versions — idempotent producer GA in 0.11; transactions GA in 0.11; exactly-once consumer in 2.5
- MySQL vs PostgreSQL syntax differences — UPSERT syntax differs (INSERT ... ON CONFLICT in PG, INSERT ... ON DUPLICATE KEY in MySQL)
1. ACID Properties
Atomicity: A transaction is all-or-nothing. Either all operations succeed and are committed, or none are applied. No partial writes visible to other transactions.
Consistency: A transaction brings the database from one valid state to another. All defined constraints (foreign keys, unique constraints, check constraints) hold after the transaction commits. Note: "Consistency" in ACID is enforced by the application defining valid states, not just the database.
Isolation: Concurrent transactions execute as if they were sequential. The level of isolation is tunable (Read Uncommitted → Read Committed → Repeatable Read → Serializable). Higher isolation = higher contention = lower throughput.
Durability: Once a transaction commits, it survives crashes. Achieved via WAL (Write-Ahead Log) in PostgreSQL — changes are written to the WAL before being applied to data pages, so they can be replayed after a crash.
Cost of ACID: Write amplification (WAL + heap writes), lock contention at high isolation levels, fsync overhead for durability. This is why high-throughput use cases often choose relaxed consistency.
Which databases guarantee full ACID:
- PostgreSQL: Full ACID, including true Serializable
- MySQL InnoDB: Full ACID (MyISAM does not)
- CockroachDB: Distributed ACID (serializable isolation by default)
- MongoDB: ACID for multi-document transactions since 4.0 (single-document operations are always atomic)
- Redis: Partial — MULTI/EXEC blocks are atomic but not durable by default without AOF fsync=always
2. BASE
Basically Available: The system guarantees availability (per the CAP theorem interpretation) — responds to every request, possibly with stale or partial data.
Soft State: State may change over time even without input, due to eventual consistency propagation.
Eventually Consistent: Given no new updates, all replicas will converge to the same value — eventually. The window could be milliseconds or seconds depending on the system.
When BASE is acceptable:
- User profile cache (slightly stale is fine — user doesn't care if their bio update takes 2s to propagate)
- Product catalog search results (showing yesterday's inventory count is acceptable)
- Social media timelines (eventual consistency is invisible to users)
- Analytics counters (exact count vs approximate count is often irrelevant)
When BASE is dangerous:
- Financial transactions (cannot have two debits from the same account proceed simultaneously)
- Inventory deduction (two users buying the last item must not both succeed)
- Authentication (a revoked token must not be accepted on any replica)
- Medical records (stale data can cause patient harm)
3. CAP Theorem and PACELC
CAP Theorem (Brewer, 2000; formally proven by Gilbert and Lynch, 2002): In the presence of a network partition, a distributed system can provide either Consistency or Availability, but not both simultaneously.
The key insight: Partition tolerance is NOT optional — network partitions happen in any distributed system. The real choice is C or A during a partition.
PACELC Model (Abadi, 2012) — more practical than CAP:
- P: If partition: choose A or C (same as CAP)
- ELC: Else (no partition): choose Latency or Consistency
4. PostgreSQL Deep Dive
MVCC (Multi-Version Concurrency Control)
PostgreSQL uses MVCC to allow readers and writers not to block each other. Every row has xmin (transaction ID that created it) and xmax (transaction ID that deleted/updated it). A reader sees the version of the row that was committed before the reader's transaction started.
Consequence: VACUUM is mandatory. Dead tuples (rows invisible to all transactions) accumulate. Without VACUUM, tables bloat and pg_clog (transaction status log) fills. autovacuum handles this automatically but must be configured correctly.
EXPLAIN ANALYZE Output Reading
Reading the output:
Red flags:
Seq Scanon large table with filter: likely missing index- Large difference between estimated and actual rows: run
ANALYZE - High
Rows Removed by Filter: index exists but not selective enough loops> 1 on expensive node: nested loop join on large dataset (consider hash join)
PostgreSQL Index Types
Window Functions and CTEs
Connection Pooling with PgBouncer
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/god-database-mastery/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ardurai/god-skill-suite/god-database-mastery)