db-migrate
Skill by simstudioai
Writes or reviews Drizzle database migrations for zero-downtime safety. Covers expand and contract phasing, backward compatibility with the deployed app, and the -- migration-safe annotation the check:migrations lint requires. Aimed at developers changing packages/db migrations or schema.ts.
Install db-migrate
Built from the published package, never by AI.
git clone --depth 1 https://github.com/simstudioai/sim /tmp/sim && mkdir -p ~/.claude/skills && cp -r /tmp/sim/.agents/skills/db-migrate ~/.claude/skills/db-migrateRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/simstudioai/sim /tmp/sim && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/sim/.agents/skills/db-migrate ~/.gemini/antigravity-cli/skills/db-migrateAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The db-migrate skill helps an AI assistant write or review Drizzle database migrations so they stay safe during a blue/green deploy. It explains that the old app version keeps running against an already-migrated schema, so each migration must stay backward-compatible. It follows an expand and contract approach, splitting breaking changes across two deploys.
It works with the check:migrations lint, which flags risky statements. The assistant must check the dependency is gone, confirm the expand already shipped, and review backfills for batching and idempotency. Destructive statements are annotated with a specific `-- migration-safe` reason, and deferred drops are tracked with contract-pending markers in packages/db/schema.ts. It is for developers working on packages/db migrations or schema changes.
Written from the project's SKILL.md and checked against it.
What it can do
- Expand and contract planningSplits breaking schema changes into an additive expand deploy and a later contract deploy.
- Per-operation playbookGives steps for adding columns, renaming, dropping, changing types, constraints, indexes and backfills.
- Lint annotationAdds a specific -- migration-safe comment above destructive statements the check:migrations lint flags.
- Contract trackingMarks deferred drops with contract-pending comments in schema.ts so they can be found with grep.
- Concurrent index guidanceWrites CREATE INDEX CONCURRENTLY with a COMMIT breakpoint and lock_timeout settings for existing tables.
- Backfill reviewChecks that data backfills are batched, idempotent and safe under concurrent writes from the live app.
- Migration workflowLists steps from drizzle-kit generate through check:migrations to a local db:migrate run.
What you need
- Drizzle ORM and drizzle-kit
- Bun, for the bunx and bun run commands
- A repository with the check:migrations script
- A dev database to run db:migrate against
Try asking
- Review this Drizzle migration for zero-downtime safety before I merge it
- Split this column drop into an expand PR and a contract PR
- Write a concurrent index migration for an existing table in packages/db
Good to know
- The lint flags risky statement shapes but cannot judge whether a drop is safe right now.
- Hard-error lint rules must be rewritten into expand and contract, not annotated away.
- Annotations are a claim that the old code no longer depends on the statement, so they must be verified first.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/db-migrate/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md8 KB
Alternatives to db-migrate
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
db-migrate: common questions
What is zero-downtime migration with this skill?
The skill keeps each migration backward-compatible with the app version already deployed, since the old and new task sets overlap during blue/green cutover. Breaking changes are split across two deploys.
What does the -- migration-safe comment do?
It is an annotation that satisfies the check:migrations lint for destructive statements such as DROP COLUMN. The reason must name the PR or version that removed the dependency, and an empty reason fails the lint.
How does the skill track deferred column drops?
It adds a contract-pending marker on the legacy column in packages/db/schema.ts. The marker is removed in the contract PR, and grep for contract-pending lists what is still owed.
How do I install db-migrate?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is db-migrate free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is db-migrate safe to use?
It scores 88 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to db-migrate?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
