D1 Migration

Reviews Drizzle-generated Cloudflare D1 migrations before you apply them

Tested · Works

Test report

Verdict
Tested · Works
Score
8.4/10
Tested
Jul 21, 2026
Environment
Claude Code 2.x (agent harness)
Upstream re-checked
Aug 10, 2026 · e5b88b4

Installed into a throwaway HOME (export HOME=$(mktemp -d)) and confirmed SKILL.md lands at ~/.claude/skills/d1-migration/SKILL.md; frontmatter parses with name+description (plus a non-standard compatibility: claude-code-only key), the body references no external files or scripts, and a scan found no curl|sh, base64, credential exfiltration or injection text. Task: review a drizzle-kit-generated 0013_add_priority.sql that rebuilds a `cases` table, plus a 412-row seed insert. The baseline artifact called the migration "destructive but expected", told the user to back up and apply it, and suggested chunking the seed at 100 rows; the skill-followed artifact refused to apply it, pinpointed that the INSERT...SELECT reads `priority` from the old table, replaced the file with one ALTER TABLE ADD COLUMN, and set BATCH_SIZE=10. I then ran both quoting variants through sqlite3 3.43.2: with backticks it hard-errors "no such column: priority", with double quotes (what drizzle emits) it silently writes the literal string 'priority' into every row (observed `1|C-1|first|new|priority|1`) — so the baseline's advice would have corrupted the table, and its 100x6=600-parameter batch still exceeds D1's ~100-150 limit. Deductions: the skill's own "will likely fail" wording understates the silent-corruption case, and its ALTER TABLE fix does not carry over the changed `status` default (I had to add the UPDATE myself). Trigger phrasings judged — SHOULD fire: "wrangler d1 migrations apply keeps failing on 0013, says duplicate column" (yes), "I changed a default in my Drizzle schema and generated a migration, is it safe to apply to D1?" (yes), "set up migrations for a brand new Cloudflare D1 database" (yes); SHOULD NOT fire: "add a priority column to my Drizzle schema for Neon Postgres" (correctly declined, description is D1-specific), "design the Drizzle table schema for my D1 app" (missed — the description's "setting up D1 schemas" clause overlaps the sibling d1-drizzle-schema skill and would pull this one in), 4/5.

Scored on four weighted criteria — install, triggering, output vs. baseline, docs. How scoring works

  • Installs cleanly 5/5
  • Triggers reliably 4/5
  • Output vs. baseline 8/10
  • Docs & honesty 4/5

What D1 Migration does

A Cloudflare D1 migration workflow for Drizzle ORM projects: inspect generated SQL for the table-recreation pattern that copies a not-yet-existing column, rewrite it as ALTER TABLE ADD COLUMN, apply to both local and remote, and verify with PRAGMA table_info. Also covers recovering a half-applied migration by inserting the row into the d1_migrations table manually, and batching bulk inserts under D1's parameter limit. Triggers on running or generating D1 migrations, wrangler d1 migrations apply errors, duplicate-column failures, and new D1 database setup.

How to install D1 Migration

git clone --depth 1 https://github.com/jezweb/claude-skills.git /tmp/d1-migration-src
mkdir -p ~/.claude/skills
cp -R /tmp/d1-migration-src/plugins/cloudflare/skills/d1-migration ~/.claude/skills/d1-migration
# Single self-contained SKILL.md, no scripts/assets/references, no dependencies to install.
# Actually running the workflow needs a Drizzle + Cloudflare D1 project and wrangler
# (npx wrangler) authenticated to a Cloudflare account; the review/rewrite half works
# on the SQL file alone with no account.
# Alternative: the repo ships this as part of a plugin marketplace ("cloudflare" plugin,
# 8 skills incl. d1-drizzle-schema and db-seed) if you prefer installing the whole plugin.

Skills live in ~/.claude/skills/ (global) or .claude/skills/ (per-project). Restart Claude Code after installing.

Commands — how to trigger D1 Migration

  • /d1-migration Reviews Drizzle-generated Cloudflare D1 migrations before you apply them

It also activates on plain-language prompts like these:

  • Generate a D1 migration for the new users table
  • Fix this stuck D1 migration on remote
  • Apply pending Drizzle migrations to local D1

Frequently asked questions

Is the D1 Migration skill free?
Yes. The skill itself is free from jezweb/claude-skills. SkillProof publishes the install command and an independent test verdict at no cost.
Does D1 Migration work with Claude Code?
We tested it with Claude Code 2.x (agent harness) on Jul 21, 2026. Verdict: Tested · Works. Installed into a throwaway HOME (export HOME=$(mktemp -d)) and confirmed SKILL.md lands at ~/.claude/skills/d1-migration/SKILL.md; frontmatter parses with name+description (plus a non-standard compatibility: claude-code-only key), the body references no external files or scripts, and a scan found no curl|sh, base64, credential exfiltration or injection text. Task: review a drizzle-kit-generated 0013_add_priority.sql that rebuilds a `cases` table, plus a 412-row seed insert. The baseline artifact called the migration "destructive but expected", told the user to back up and apply it, and suggested chunking the seed at 100 rows; the skill-followed artifact refused to apply it, pinpointed that the INSERT...SELECT reads `priority` from the old table, replaced the file with one ALTER TABLE ADD COLUMN, and set BATCH_SIZE=10. I then ran both quoting variants through sqlite3 3.43.2: with backticks it hard-errors "no such column: priority", with double quotes (what drizzle emits) it silently writes the literal string 'priority' into every row (observed `1|C-1|first|new|priority|1`) — so the baseline's advice would have corrupted the table, and its 100x6=600-parameter batch still exceeds D1's ~100-150 limit. Deductions: the skill's own "will likely fail" wording understates the silent-corruption case, and its ALTER TABLE fix does not carry over the changed `status` default (I had to add the UPDATE myself). Trigger phrasings judged — SHOULD fire: "wrangler d1 migrations apply keeps failing on 0013, says duplicate column" (yes), "I changed a default in my Drizzle schema and generated a migration, is it safe to apply to D1?" (yes), "set up migrations for a brand new Cloudflare D1 database" (yes); SHOULD NOT fire: "add a priority column to my Drizzle schema for Neon Postgres" (correctly declined, description is D1-specific), "design the Drizzle table schema for my D1 app" (missed — the description's "setting up D1 schemas" clause overlaps the sibling d1-drizzle-schema skill and would pull this one in), 4/5.
What is the D1 Migration SkillProof Score?
8.4/10 — installs cleanly 5/5, triggers reliably 4/5, output vs. baseline 8/10, docs & honesty 4/5.
How do I install D1 Migration?
Copy the install command from this page, run it in your terminal, and restart Claude Code. Skills live in ~/.claude/skills/ (global) or .claude/skills/ inside a project.
Can I use D1 Migration with Cursor, Copilot, Gemini CLI, Codex or other AI tools?
The SKILL.md format is native to Claude (Claude Code, Desktop, claude.ai). The instructions inside adapt to other assistants: Cursor rules, GitHub Copilot instructions, Windsurf rules, Custom GPTs, AGENTS.md for OpenAI Codex, and GEMINI.md for Google Gemini CLI — our conversion guides cover each, and the free converter on the tools page does the wrapping for you.