Skip to content AI News: Nano Banana 2.1 is out: better edits and text, half the API price per image →
PH-0749 · Code prompt

Database Migration Writer

A Claude Code prompt that writes a reversible migration in your repo style, split into safe steps for a large table, with the tests run.

What you get

Writes a reversible migration in your repo style, split into safe steps for a large table, with the tests run.

What you need
  • 2 blanks to fill in: describe the schema change row count
Best inClaude CodeAlso works in any coding agent
220 words
Prompt · September 19, 2026
I want you to act as an engineer writing a database migration for this repository. I will describe the schema change and tell you roughly how large the affected tables are.

Read first: the migration tool in use, the existing migration files, their naming, how they run during deployment, and the models or queries that touch the affected tables. Report what you found and which queries will break.

Then write the migration in this repository's own style, with an up step and a down step that genuinely reverses it, or a written explanation of why it cannot be reversed and what the rollback plan is instead. Where the change would lock a large table, split it into safe steps: add the new column, backfill in batches, write to both, switch the reads, then drop the old one, each as its own migration. Say which steps can ship together and which need a deploy in between.

Update the code that reads or writes the changed columns in the same change, and the tests with it. Run the migration against the local database, run the tests, and show both outputs. Never write a destructive step that runs before the code which stopped using the column has shipped.

My first request is: "[describe the schema change] The table holds about [row count] rows."
Data & Analytics Claude Code

How to use it

  1. Fill the blanks under «Make it yours» — the prompt updates as you type.
  2. Copy the prompt and paste it into Claude Code.
  3. Not quite right? Reply with what to change — the model keeps the rest.

More Claude Code prompts

PH-0894Coding

Repo Feature Planner

Explores your repository and returns a commit sized plan, the risks and a definition of done before it writes code.

You fill in describe the feature you want…

Claude Code
PH-0708Coding

Bug Reproduction Test

Writes a failing test first, explains the real cause, then makes the smallest fix and runs the whole suite.

You fill in describe the bug, how to…

Claude Code
PH-0908Coding

Safe Refactor Pass

Refactors behind passing tests, writing characterisation tests first and stopping the moment one of them fails.

You fill in file or modulethe reason

Claude Code
PH-0882Coding

Pull Request Reviewer

Reviews a branch or pull request for defects, risks and missing tests, with a verdict and no invented findings.

You fill in branch name, pull request…

Claude Code
PH-0719Coding

CI Failure Fixer

Reproduces a failing build locally, names the real cause and fixes it without skipping or deleting a single test.

You fill in paste the failing log herebranch name

Claude Code
PH-0725Coding

CLAUDE.md Writer

Reads your repository and writes its CLAUDE.md: verified commands, the layout and the conventions the code follows.

You fill in how it is deployedthe command I actually run…what an agent should know

Claude Code
Weekly

New prompts in your inbox

One email a week: the best new prompts and one short guide. Unsubscribe any time. Privacy policy