Use this skill to help a user diagnose, repair, and prevent Drizzle Kit migration conflicts in a
multi-developer repository. Drizzle migrations encode both SQL and migration snapshots, so the safe
answer depends on the current migration directory shape, the Drizzle Kit version, and the git state.
_journal.json, or snapshot.json conflict after a pull, merge, rebase, or PR update.drizzle-kit check reports non-commutative migrations or migration folder conflicts.drizzle-kit migrate, drizzle-kit push, database seed scripts, or any command thatconnects to a live database unless the user explicitly requests it and the target is clear.
drizzle-kit check, project typechecks, and tests as command execution that may load projectconfig, environment variables, or scripts. Inspect scripts/config first, and require an explicit
non-production or disposable target before any DB-backed validation.
_journal.json, or run git checkout --ours,git checkout --theirs, git restore, or rm unless the user has confirmed the exact side and
files to change.
drizzle-kit push as the production solution for migration conflicts; it skipsthe auditable migration history that teams need.
--ignore-conflicts as an exception for a known false positive, not as the normal fix.repair normally discards generated migrations and regenerates them from the merged schema.
ours and theirs could mean different branches depending on merge direction, ask the user toidentify the parent branch before suggesting checkout commands.
references/sources.md when the answer depends on current Drizzle behavior, officialguidance, or one of the preserved external links.
references/conflict-resolution.md before recommending a repair flow.references/ci-policy.md before proposing CI, merge queue, or team workflow changes.references/report-template.md before writing a diagnostic report.The full list of official docs, Drizzle GitHub discussions, community scripts, and merge-queue
references lives in references/sources.md with trust levels and caveats. Read that file whenever
the answer depends on current Drizzle behavior. Re-verify the official docs and the most relevant
discussion when the project's drizzle-kit major version changes, since migration internals
(snapshot format, journal shape, drizzle-kit check semantics) have shifted between releases.
Classify the task first:
drizzle-kit check and wants to understand it.When the mode is not explicit, choose Diagnose.
Each mode unlocks a specific set of actions. Do not cross these boundaries without an explicit upgrade:
git status, git ls-files -u, the helper script, and fileinspection. Do not run drizzle-kit check, typechecks, tests, or any write command. Report
findings and the proposed repair path, but do not execute it.
drizzle-kit generate/check execution, each gated by theSafety rules and explicit confirmation of the exact files and side (ours/theirs) to change.
against the user's database to validate the workflow; validate the workflow syntax and logic only.
Collect repo facts before giving commands:
git status --short
git rev-parse --show-toplevel
git rev-parse --abbrev-ref HEAD
git ls-files -u
rg --files -g 'drizzle.config.*' -g 'package.json' -g 'pnpm-lock.yaml' -g 'yarn.lock' -g 'package-lock.json'
Then inspect the relevant files:
drizzle.config.* for out, schema, dialect, and config shape.package.json scripts for the project-approved generate, check, and migrate commands.package.json dependencies or lockfile snippets for drizzle-kit and drizzle-orm versions.drizzle/, migrations/,or src/db/migrations/.
If this skill's helper script is available, run it in read-only mode:
python3 <skill-dir>/scripts/check_drizzle_migrations.py --root .
Resolve <skill-dir> to the installed skill directory before running. Check these locations in order
and use the first that contains scripts/check_drizzle_migrations.py:
<repo-root>/skills/drizzle-migration-conflict.~/.claude/skills/drizzle-migration-conflict.If none of these resolve, fall back to the manual git/rg inspection commands above and tell the
user the helper script was not found. Use --config <file> and --migrations-dir <dir> when the
project has multiple Drizzle configs or outputs. The script never connects to a database and never
writes files; it only reads migration directories and reports structural issues.
The structural helper is not a sandbox: config out extraction is regex-based, relative out paths can depend on actual CLI cwd, symlinked descendants can escape the requested tree, and snapshot checks do not prove an acyclic single chain or SQL commutativity. Inspect/reject linked paths and use an isolated fixture copy before invoking it on untrusted repositories. The --allow-outside-root option does not override its separate current-working-directory containment check. Preserve already-applied migration history; only regenerate artifacts proven never applied/shared, otherwise design a forward corrective migration.
Identify the structure before proposing a fix:
<out>/meta/_journal.json, <out>/meta/*_snapshot.json, and root-levelmigration SQL files such as <out>/0003_name.sql.
migration.sql andsnapshot.json.
not one side's stale snapshot.
branch after updating from that branch.
snapshot files.
check` only after confirming its config/env cannot point at production; then project tests only
after inspecting the scripts and any database targets.
write.
drizzle.config.*, .env, or environment variables, do notinclude database URLs, passwords, tokens, or connection strings in the report. Reference them as<redacted> or describe only whether they point at a production-like target.
references/report-template.md for diagnostic reports:NO_CONFLICT_FOUND, SAFE_TO_REGENERATE, NEEDS_USER_CONFIRMATION, or BLOCKED_BY_AMBIGUITY.
Use these prompts to validate the skill behavior:
_journal.json and 0003_snapshot.json conflict during merge. Tell me what to do."drizzle-kit check reports a non-commutative conflict."drizzle-kit push?"drizzle.config.ts sets out from process.env.MIGRATIONS_DIR, and the helper says no out directory was found. What now?"drizzle-kit check keeps failing on a migration we know commutes. Can we just always pass --ignore-conflicts?"