Skip to main content
skill CX Codex

drizzle-safe-migrations — Claude Code skill for safe Drizzle migrations

drizzle-safe-migrations plans safe Drizzle migrations: data backfills, enum/check/default tightening, migration ordering, and rollback. Use it when a schema change touches existing rows.

no license 348 installs ★ 655 updated 2026-10-20

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add pedronauck/skills --skill drizzle-safe-migrations -a claude-code
Open on GitHub

What drizzle-safe-migrations does

The skill sets ground rules for Drizzle migrations. Schema files come from the project's own generate script and stay untouched by hand. Data backfills go into separate custom migrations, and normalization happens before any constraint tightening.

It walks through a fixed sequence: classify the change as schema-only or data-plus-schema, create a custom migration with bun run db:generate -- --custom --name <name> for the backfill, then run bun run db:generate for the schema. After that, check drizzle/meta/_journal.json so the backfill sits before the tightening migration. Finally, run the migration suite against existing data and a fresh install, and write down lock risks and the rollback path.

There is a pointer to references/production-playbook.md with command templates and review checklists. For PostgreSQL under strict uptime, it suggests staged validation with NOT VALID / VALIDATE CONSTRAINT, though that only covers supported constraint kinds. Anti-patterns are explicit: no hand-editing generated files, no tightening before backfill, no hiding one-off logic in app startup code.

What it helps with

  • plan a data backfill before tightening constraints
  • verify migration order in the Drizzle journal
  • write idempotent UPDATEs with narrow WHERE clauses
  • run migrations against existing data and a fresh install
  • record lock risks and rollback steps

Example prompts for the agent

  • Plan a migration that removes legacy_value from an enum on the orders table
  • Check the backfill and constraint order in drizzle/meta/_journal.json
  • Create a custom migration to normalize old rows before changing a default

How to install drizzle-safe-migrations

1Skills CLI (Vercel)

npx skills add pedronauck/skills --skill drizzle-safe-migrations -a claude-code

2Manually: put the files in place

~/.claude/skills/drizzle-safe-migrations/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/drizzle-safe-migrations/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about drizzle-safe-migrations

How do I install drizzle-safe-migrations in Claude Code?

Run npx skills add pedronauck/skills --skill drizzle-safe-migrations -a claude-code. The skill lands in ~/.claude/skills/drizzle-safe-migrations/SKILL.md.

What does drizzle-safe-migrations do?

It enforces a safe order for Drizzle migrations: backfill data with a custom migration first, then generate the schema and tighten constraints. It also checks journal ordering and requires running migrations on both existing data and a fresh install.

How is a custom migration different from a schema migration?

Schema migrations are generated by the project script and should not be edited by hand. Custom migrations are created with bun run db:generate -- --custom --name <name> and only their SQL is edited, for data backfills.

Similar skills

All skills for Data and databases →

From the same set52

The whole set →
shadcn Guides AI agents through shadcn/ui and Radix UI best practices. Prevents broken themes and keeps component accessibility intact. CX Codex +1 391installs hormozi-ad-factory hormozi-ad-factory splits an ad into hook, body and call to action, then multiplies the pieces, so a single product yields 150 to 750 variations to test. CX Codex +1 370installs zustand zustand is a Claude Code skill for shaping Zustand stores and shared client state. It activates for store creation, organization, and UI state used across components. CX Codex +1 369installs brand-storytelling brand-storytelling — a skill that helps you build a brand story: positioning, pitch, messaging. Useful when the company talks about itself and only a feature list sticks. CX Codex +1 350installs to-prompt to-prompt turns a task into a written brief under docs/prompts/, so a different model can carry out the implementation. CX Codex +1 348installs writing-skills Walks the agent through writing, refactoring and debugging skills, and through finding out why a reference file never loaded. CX Codex +1 338installs storybook-stories Writes and edits Storybook stories the way your repo already does it. Handy once a project has plenty of stories and the naming rules live only in people's heads. CX Codex +1 317installs ui-craft ui-craft — a skill for designing and building visible interfaces: pages, components, forms, loading and error states, AI chat surfaces with streaming. Works within your project's design system and validates accessibility. CX Codex +1 314installs

Project sponsors

Companies that keep this analytics open