Drizzle Migration Conflict
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.
When to Use This Skill
- Use when Drizzle migration files,
_journal.json, or snapshot.json conflict after a pull, merge, rebase, or PR update.
- Use when
drizzle-kit check reports non-commutative migrations or migration folder conflicts.
- Use when a team wants a safe repair flow for generated Drizzle migrations after schema changes converge.
- Use when designing CI or merge-queue policy to prevent repeated Drizzle migration conflicts.
Safety rules
- Start in read-only diagnosis mode unless the user explicitly asks to fix files.
- Do not run
drizzle-kit migrate, drizzle-kit push, database seed scripts, or any command that
connects to a live database unless the user explicitly requests it and the target is clear.
- Treat
drizzle-kit check, project typechecks, and tests as command execution that may load project
config, environment variables, or scripts. Inspect scripts/config first, and require an explicit
non-production or disposable target before any DB-backed validation.
- Do not delete migration files, rewrite
_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.
- Do not recommend
drizzle-kit push as the production solution for migration conflicts; it skips
the auditable migration history that teams need.
- Treat
--ignore-conflicts as an exception for a known false positive, not as the normal fix.
- Preserve schema source code changes unless the user explicitly asks to discard them. Conflict
repair normally discards generated migrations and regenerates them from the merged schema.
- If
ours and theirs could mean different branches depending on merge direction, ask the user to
identify the parent branch before suggesting checkout commands.
Required references
- Read
references/sources.md when the answer depends on current Drizzle behavior, official
guidance, or one of the preserved external links.
- Read
references/conflict-resolution.md before recommending a repair flow.
- Read
references/ci-policy.md before proposing CI, merge queue, or team workflow changes.
- Read
references/report-template.md before writing a diagnostic report.
Source references
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.
Mode selection
Classify the task first:
- Diagnose - The user has a conflict or failed
drizzle-kit check and wants to understand it.
- Repair - The user explicitly asks to fix or regenerate migration files.
- CI hardening - The user wants to prevent future conflicts in PRs or merge queues.
- Explain - The user wants a conceptual answer or a team playbook.
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:
- Diagnose - read-only only. Run
git status, git ls-files -u, the helper script, and file
inspection. Do not run drizzle-kit check, typechecks, tests, or any write command. Report
findings and the proposed repair path, but do not execute it.
- Repair - adds file writes and
drizzle-kit generate/check execution, each gated by the
Safety rules and explicit confirmation of the exact files and side (ours/theirs) to change.
- CI hardening - adds proposing or editing CI/workflow files. Do not run migration commands
against the user's database to validate the workflow; validate the workflow syntax and logic only.
- Explain - conceptual only. No commands against the repo beyond optional read-only inspection.
Repository discovery
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.
- The migration output directory, either from config or common names like
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:
- The target repository's vendored copy:
<repo-root>/skills/drizzle-migration-conflict.
- The Claude Code skills directory:
~/.claude/skills/drizzle-migration-conflict.
- Any other install location reported by the user's environment.
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.
Migration structure decision
Identify the structure before proposing a fix:
- Legacy structure:
<out>/meta/_journal.json, <out>/meta/*_snapshot.json, and root-level
migration SQL files such as <out>/0003_name.sql.
- Folder-based structure: each migration is a directory containing
migration.sql and
snapshot.json.
- Unknown or mixed structure: stop and report ambiguity. Do not guess a destructive repair.
Recommended repair principles
- Resolve schema source conflicts first. The regenerated migration must reflect the merged schema,
not one side's stale snapshot.
- Treat the parent or target branch migration history as the source of truth when repairing a feature
branch after updating from that branch.
- Prefer discarding and regenerating generated migration artifacts over hand-editing journal or
snapshot files.
- After regeneration, validate in tiers: database-free structural checks first; then
drizzle-kit check only after confirming its config/env cannot point at production; then project tests only
after inspecting the scripts and any database targets.
- If the user asks to apply changes, state exactly which files will be changed before performing the
write.
Output rules
- Use the user's language when practical, but keep command snippets and file paths literal.
- State the detected migration structure and selected mode.
- Separate confirmed conflicts from assumptions and missing evidence.
- Give a safe default path first, then optional automation or CI hardening.
- For destructive steps, label them as "requires confirmation" and explain what will be lost.
- Never echo secrets. When inspecting
drizzle.config.*, .env, or environment variables, do not
include 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.
- Use the conclusion values from
references/report-template.md for diagnostic reports:
NO_CONFLICT_FOUND, SAFE_TO_REGENERATE, NEEDS_USER_CONFIRMATION, or BLOCKED_BY_AMBIGUITY.
Limitations
- This skill cannot guarantee that a regenerated migration is production-safe without review against the target database state and deployment process.
- It does not run DB-backed migration commands unless the user explicitly confirms the target and the command.
- It is focused on Drizzle Kit migration conflicts, not general schema design or application-query optimization.
Test prompts
Use these prompts to validate the skill behavior:
- "My Drizzle
_journal.json and 0003_snapshot.json conflict during merge. Tell me what to do."
- "We upgraded to the migration folder layout and
drizzle-kit check reports a non-commutative conflict."
- "Design CI so our team stops merging broken Drizzle migrations."
- "Can I solve this production Drizzle migration conflict with
drizzle-kit push?"
- "Use the links in the skill to re-check the current official Drizzle migration conflict guidance."
- "We're halfway through moving from the legacy flat layout to folder-based migrations. How do we handle a conflict during the transition?"
- "Our
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?"
Source: sickn33/agentic-awesome-skills → skills/drizzle-migration-conflict/SKILL.md
Also appears in: sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/drizzle-migration-conflict/SKILL.md
1---2name: drizzle-migration-conflict3description: Diagnose, repair, and prevent Drizzle Kit migration conflicts involving generated SQL, snapshots, journals, merge queues, and team workflows.4---567# Drizzle Migration Conflict89Use this skill to help a user diagnose, repair, and prevent Drizzle Kit migration conflicts in a10multi-developer repository. Drizzle migrations encode both SQL and migration snapshots, so the safe11answer depends on the current migration directory shape, the Drizzle Kit version, and the git state.1213## When to Use This Skill1415- Use when Drizzle migration files, `_journal.json`, or `snapshot.json` conflict after a pull, merge, rebase, or PR update.16- Use when `drizzle-kit check` reports non-commutative migrations or migration folder conflicts.17- Use when a team wants a safe repair flow for generated Drizzle migrations after schema changes converge.18- Use when designing CI or merge-queue policy to prevent repeated Drizzle migration conflicts.1920## Safety rules2122- Start in read-only diagnosis mode unless the user explicitly asks to fix files.23- Do not run `drizzle-kit migrate`, `drizzle-kit push`, database seed scripts, or any command that24 connects to a live database unless the user explicitly requests it and the target is clear.25- Treat `drizzle-kit check`, project typechecks, and tests as command execution that may load project26 config, environment variables, or scripts. Inspect scripts/config first, and require an explicit27 non-production or disposable target before any DB-backed validation.28- Do not delete migration files, rewrite `_journal.json`, or run `git checkout --ours`,29 `git checkout --theirs`, `git restore`, or `rm` unless the user has confirmed the exact side and30 files to change.31- Do not recommend `drizzle-kit push` as the production solution for migration conflicts; it skips32 the auditable migration history that teams need.33- Treat `--ignore-conflicts` as an exception for a known false positive, not as the normal fix.34- Preserve schema source code changes unless the user explicitly asks to discard them. Conflict35 repair normally discards generated migrations and regenerates them from the merged schema.36- If `ours` and `theirs` could mean different branches depending on merge direction, ask the user to37 identify the parent branch before suggesting checkout commands.3839## Required references4041- Read `references/sources.md` when the answer depends on current Drizzle behavior, official42 guidance, or one of the preserved external links.43- Read `references/conflict-resolution.md` before recommending a repair flow.44- Read `references/ci-policy.md` before proposing CI, merge queue, or team workflow changes.45- Read `references/report-template.md` before writing a diagnostic report.4647## Source references4849The full list of official docs, Drizzle GitHub discussions, community scripts, and merge-queue50references lives in `references/sources.md` with trust levels and caveats. Read that file whenever51the answer depends on current Drizzle behavior. Re-verify the official docs and the most relevant52discussion when the project's `drizzle-kit` major version changes, since migration internals53(snapshot format, journal shape, `drizzle-kit check` semantics) have shifted between releases.5455## Mode selection5657Classify the task first:58591. **Diagnose** - The user has a conflict or failed `drizzle-kit check` and wants to understand it.602. **Repair** - The user explicitly asks to fix or regenerate migration files.613. **CI hardening** - The user wants to prevent future conflicts in PRs or merge queues.624. **Explain** - The user wants a conceptual answer or a team playbook.6364When the mode is not explicit, choose Diagnose.6566Each mode unlocks a specific set of actions. Do not cross these boundaries without an explicit upgrade:6768- **Diagnose** - read-only only. Run `git status`, `git ls-files -u`, the helper script, and file69 inspection. Do not run `drizzle-kit check`, typechecks, tests, or any write command. Report70 findings and the proposed repair path, but do not execute it.71- **Repair** - adds file writes and `drizzle-kit generate`/`check` execution, each gated by the72 Safety rules and explicit confirmation of the exact files and side (`ours`/`theirs`) to change.73- **CI hardening** - adds proposing or editing CI/workflow files. Do not run migration commands74 against the user's database to validate the workflow; validate the workflow syntax and logic only.75- **Explain** - conceptual only. No commands against the repo beyond optional read-only inspection.7677## Repository discovery7879Collect repo facts before giving commands:8081```bash82git status --short83git rev-parse --show-toplevel84git rev-parse --abbrev-ref HEAD85git ls-files -u86rg --files -g 'drizzle.config.*' -g 'package.json' -g 'pnpm-lock.yaml' -g 'yarn.lock' -g 'package-lock.json'87```8889Then inspect the relevant files:9091- `drizzle.config.*` for `out`, `schema`, dialect, and config shape.92- `package.json` scripts for the project-approved `generate`, `check`, and `migrate` commands.93- `package.json` dependencies or lockfile snippets for `drizzle-kit` and `drizzle-orm` versions.94- The migration output directory, either from config or common names like `drizzle/`, `migrations/`,95 or `src/db/migrations/`.9697If this skill's helper script is available, run it in read-only mode:9899```bash100python3 <skill-dir>/scripts/check_drizzle_migrations.py --root .101```102103Resolve `<skill-dir>` to the installed skill directory before running. Check these locations in order104and use the first that contains `scripts/check_drizzle_migrations.py`:1051061. The target repository's vendored copy: `<repo-root>/skills/drizzle-migration-conflict`.1072. The Claude Code skills directory: `~/.claude/skills/drizzle-migration-conflict`.1083. Any other install location reported by the user's environment.109110If none of these resolve, fall back to the manual `git`/`rg` inspection commands above and tell the111user the helper script was not found. Use `--config <file>` and `--migrations-dir <dir>` when the112project has multiple Drizzle configs or outputs. The script never connects to a database and never113writes files; it only reads migration directories and reports structural issues.114115## Migration structure decision116117Identify the structure before proposing a fix:118119- **Legacy structure**: `<out>/meta/_journal.json`, `<out>/meta/*_snapshot.json`, and root-level120 migration SQL files such as `<out>/0003_name.sql`.121- **Folder-based structure**: each migration is a directory containing `migration.sql` and122 `snapshot.json`.123- **Unknown or mixed structure**: stop and report ambiguity. Do not guess a destructive repair.124125## Recommended repair principles126127- Resolve schema source conflicts first. The regenerated migration must reflect the merged schema,128 not one side's stale snapshot.129- Treat the parent or target branch migration history as the source of truth when repairing a feature130 branch after updating from that branch.131- Prefer discarding and regenerating generated migration artifacts over hand-editing journal or132 snapshot files.133- After regeneration, validate in tiers: database-free structural checks first; then `drizzle-kit134 check` only after confirming its config/env cannot point at production; then project tests only135 after inspecting the scripts and any database targets.136- If the user asks to apply changes, state exactly which files will be changed before performing the137 write.138139## Output rules140141- Use the user's language when practical, but keep command snippets and file paths literal.142- State the detected migration structure and selected mode.143- Separate confirmed conflicts from assumptions and missing evidence.144- Give a safe default path first, then optional automation or CI hardening.145- For destructive steps, label them as "requires confirmation" and explain what will be lost.146- Never echo secrets. When inspecting `drizzle.config.*`, `.env`, or environment variables, do not147 include database URLs, passwords, tokens, or connection strings in the report. Reference them as148 `<redacted>` or describe only whether they point at a production-like target.149- Use the conclusion values from `references/report-template.md` for diagnostic reports:150 `NO_CONFLICT_FOUND`, `SAFE_TO_REGENERATE`, `NEEDS_USER_CONFIRMATION`, or `BLOCKED_BY_AMBIGUITY`.151152## Limitations153154- This skill cannot guarantee that a regenerated migration is production-safe without review against the target database state and deployment process.155- It does not run DB-backed migration commands unless the user explicitly confirms the target and the command.156- It is focused on Drizzle Kit migration conflicts, not general schema design or application-query optimization.157158## Test prompts159160Use these prompts to validate the skill behavior:161162- "My Drizzle `_journal.json` and `0003_snapshot.json` conflict during merge. Tell me what to do."163- "We upgraded to the migration folder layout and `drizzle-kit check` reports a non-commutative conflict."164- "Design CI so our team stops merging broken Drizzle migrations."165- "Can I solve this production Drizzle migration conflict with `drizzle-kit push`?"166- "Use the links in the skill to re-check the current official Drizzle migration conflict guidance."167- "We're halfway through moving from the legacy flat layout to folder-based migrations. How do we handle a conflict during the transition?"168- "Our `drizzle.config.ts` sets `out` from `process.env.MIGRATIONS_DIR`, and the helper says no out directory was found. What now?"169- "`drizzle-kit check` keeps failing on a migration we know commutes. Can we just always pass `--ignore-conflicts`?"170171---172173**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/drizzle-migration-conflict/SKILL.md`174175**Also appears in:** `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/drizzle-migration-conflict/SKILL.md`