database

Reviews database schemas, migrations, indexes, and query plans for locking and rollback risk.

1|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/kreek/consult --skill database-kreek
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: database
Source: https://github.com/kreek/consult/tree/main/plugin/skills/database
Command: npx skills add https://github.com/kreek/consult --skill database-kreek

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Database changes are among the riskiest operations in production systems: a careless migration can lock tables, corrupt data, or be impossible to roll back. This Skill enforces disciplined review of schemas, migrations, indexes, transactions, and query plans so production data stays protected before any change ships. ## Core Features & Use Cases - Migration Safety Review: Enforces expand-contract phasing, online DDL techniques (e.g., CREATE INDEX CONCURRENTLY, lock_timeout, NOT VALID constraints), and mandatory rollback plans for every migration. - Query Plan and Isolation Guidance: Provides deep references for reading Postgres EXPLAIN output and choosing correct transaction isolation levels, including write-skew and serialization-failure handling. - Data Integrity Rules: Requires DB-level uniqueness constraints, supporting indexes for foreign keys and query predicates, and batched, resumable, reversible backfills. - Use Case: Before deploying a migration that adds a column with a default to a large Postgres table, use this Skill to verify the DDL is metadata-only or plan a batched backfill, confirm lock behavior, and document the rollback path. ## Quick Start Use the database skill to review my Postgres migration for locking, rollout, and rollback risks before I deploy it.

Frequently Asked Questions about database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a zero-downtime database migration on Postgres?▼

Use online DDL techniques: CREATE INDEX CONCURRENTLY for indexes, lock_timeout with retry loops for schema changes, and NOT VALID plus VALIDATE CONSTRAINT for foreign keys and NOT NULL checks. Destructive changes should ship as separate expand-contract phases with a tested rollback.

How do I read a Postgres EXPLAIN query plan?▼

Run EXPLAIN with ANALYZE and BUFFERS to get real timing and I/O numbers. Watch for Seq Scans on large tables, row estimate mismatches over 100x, sorts spilling to disk, and rows removed by filter, which indicate missing or wrong indexes.

What transaction isolation level should I use in Postgres?▼

Read Committed is the default for OLTP workloads. Use Repeatable Read for consistent multi-row reads within one transaction, and Serializable with a retry loop when invariants must hold across concurrent transactions, since it prevents write skew.

When should I use SQLite versus Postgres?▼

SQLite suits embedded, local-first, or operationally simple apps; enable WAL mode and busy_timeout for concurrent readers. Move to Postgres when you need multiple independent writers, background jobs, reporting workloads, or operational scaling.

Why enforce uniqueness with a database constraint instead of application checks?▼

Application-layer uniqueness checks race under concurrency, allowing duplicate rows. A DB-level UNIQUE, EXCLUDE, composite, or partial constraint enforces the invariant atomically regardless of how many clients write simultaneously.

What makes a database backfill production-safe?▼

Safe backfills are batched, resumable, observable, and reversible, with each batch holding locks briefly. Rehearse the migration against a production-sized copy and document the rollback or recovery path before shipping.