/claude-db:db-migration-safetyfrom Claude DB
Lints database migrations before execution, checking reversibility, lock levels, table rewrites, destructive ops, enum safety, NOT NULL without defaults, and schema drift. Feeds a Performance & Scale score.
Ships in Claude DB. 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.
M22 lints a candidate migration as a static artifact before execution. It is the contract the migration-safety auditor and the db-migration-writer agent both honor. Feeds Performance & Scale (Almacenamiento/operability category). A destructive irreversible migration is the sev-5 cap on the performance axis.
down/rollback exists, or the change follows expand-contract
(add-new → backfill → switch → drop-old in separate deploys). A one-shot destructive step with no
down is the highest-severity finding here.ALTER COLUMN TYPE, adding a CHECK/FK without NOT VALID,
non-CONCURRENTLY index creation all take ACCESS EXCLUSIVE / block writes. Prefer
CREATE INDEX CONCURRENTLY, ADD CONSTRAINT ... NOT VALID then VALIDATE CONSTRAINT.ALTER COLUMN TYPE, adding a
NOT NULL column with a volatile default on old engines) → slow + long lock on large tables.DROP COLUMN, DROP TABLE, TRUNCATE, DROP NOT NULL reversals, dropping a
column still read by deployed code. Destructive + irreversible = sev 5 (caps performance).ALTER TYPE ... ADD VALUE is append-only and runs in a transaction on PG12+
(only older PG forbade it mid-txn). Flag enum changes; suggest lookup tables.Parse migration SQL / ORM migration files (scripts/parse-schema.mjs, parse-orm-python.py). Scan for:
DROP TABLE|DROP COLUMN|TRUNCATE; ALTER COLUMN .* TYPE; ADD COLUMN .* NOT NULL without DEFAULT;
CREATE INDEX lacking CONCURRENTLY; ADD CONSTRAINT (FK/CHECK) lacking NOT VALID;
ALTER TYPE .* ADD VALUE / enum value removal or reorder; absence of a down/rollback block; drift between the
authoritative artifact (references/detection-signals.md precedence) and the latest migration.
SELECT pg_size_pretty(pg_total_relation_size('<t>')), reltuples FROM pg_class WHERE relname='<t>';EXPLAIN/pg_locks inspection, or a dry_run_migration against a
throwaway copy / shadow DB. Use verification.method: dry_run_migration when a shadow DB is available;
otherwise migration_lint on the static SQL. When live size is needed to decide severity but no DB is
reachable → needs_api, never a silent pass.Emit per schema/finding.schema.json. Example ids:
M22.20240115_drop_users_legacy.destructive_irreversible — DROP COLUMN with no down and column
still referenced (fail, severity 5, axis performance, fixable proposed → expand-contract plan).M22.add_index.lock_blocking — CREATE INDEX without CONCURRENTLY on a hot table (warn, severity 4,
axis performance, fixable auto → add CONCURRENTLY).M22.add_email_notnull.notnull_no_default — ADD COLUMN ... NOT NULL no default on a populated table
(fail, severity 4, axis performance, fixable proposed).M22.status_enum.enum_value_removed — enum value removed/reordered (unsupported; breaks dependents) —
suggest a lookup table (warn, severity 3, axis performance).M22.drift.column_in_artifact_not_migration — schema drift (warn, severity 2, axis performance,
confidence directional).
Each finding: evidence.observed quotes the offending migration statement verbatim (secrets redacted);
verification.reproduce is a runnable command above using $DATABASE_URL; verification.method is
migration_lint or dry_run_migration; fix_preview carries the safer rewrite (e.g. CONCURRENTLY,
NOT VALID + VALIDATE, an expand-contract sequence); expected_impact carries
{axis, confidence, magnitude, rationale} — banded, never a naked %.directional (medium), not an established sev-5. Don't claim a downtime
duration in seconds; magnitude banded only.DROP/TRUNCATE-class destructive and irreversible migrations cap performance at sev 5.
Reversible or expand-contract changes are warns. Drift is directional and never caps.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub hainrixz/claude-db --plugin claude-db36 skills in this plugin
/auditAudit a database schema, ORM model, or migrations for design and performance — produces two independent 0-100 scores (Design & Integrity + Performance & Scale) plus a prioritized, evidence-backed report. Read-only; never writes or migrates. Use when the user asks to audit, analyze, review, check, or score a database, schema, data model, migrations, indexes, keys, referential integrity, types, constraints, query patterns, partitioning, or connection pooling — for Postgres, MySQL, Mongo, DynamoDB, Cassandra, pgvector, ClickHouse, Neo4j, and friends./checklistRender a production-readiness GO/NO-GO grid for a database — runs a read-only audit, then maps the findings onto a fixed launch checklist (PITR/backups, RLS on tenant tables, FK indexes, money-as-numeric, timestamptz/UTC, connection pooling sized, migration reversibility, secrets-not-in-schema, charset/utf8mb4). Each row is PASS/WARN/FAIL/NEEDS-LIVE with the finding id, topped by a plain-language verdict. Read-only. Use when the user asks if a database is production-ready, ready to launch/ship, a go/no-go, a pre-launch or readiness checklist, or what to fix before going live./db-antipatternsUnified cross-paradigm anti-pattern catalog (M19) — relational and NoSQL smells that no single structural module owns cleanly: EAV / generic key-value tables, the "god table" with hundreds of columns, comma-separated lists in a column, polymorphic associations without FK, boolean-flag soup, Mongo unbounded array growth, deeply nested documents, the document fan-out / "join in app code" trap, Redis as a relied-on durable primary store. Each finding is re-homed to inherit the natural module's category. Feeds the Design & Integrity AND Performance & Scale scores depending on the smell.Other plugins' skills for the same job