Database Schema Refactoring Tool skill for Claude and Codex
Plans a schema refactor you can execute in stages: what to change and why, the migration sequence that keeps the application running, the risks per step, and…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when an existing production schema needs a staged refactor plan for normalising, partitioning, renaming, splitting, or merging tables without breaking the application. Do not use for writing a single migration script, designing a schema for a new system, or tuning individual queries. Related topics: coding, database.
What it will ask you for
- Current DBMS (choose one: MySQL, PostgreSQL, Oracle, SQL Server, SQLite)
- Current schema (longer free text)
- Refactor goal (choose one: Normalize, Denormalize, Add audit columns, Partition tables, Improve naming, Split a table, Merge tables)
- Critical tables (longer free text)
- Performance concerns (choose any: Query speed, Index bloat, Storage cost, Concurrency, Migration downtime)
- Target schema version (free text, e.g. "3.0")
- Preserve all data (choose one: Yes, No)
- Applications that read or write these tables (longer free text)
How it works
- State the goal, affected tables, and the single biggest risk in an overview the team can agree on first.
- Produce the change mapping table (current object, new object, change type, reason) with every row tied to a stated concern.
- Sequence the migration as expand and contract steps, each with its statement or script, the lock it takes, and the precondition for the next step.
- Assess each step's risk with likelihood, impact, and the signal that it is going wrong.
- Write a rollback action per step and mark the point after which rollback means restoring from backup.
What you get
A Markdown report with sections Overview, Recommended Changes (mapping table), Migration Steps (ordered, with preconditions and locks), Risk Assessment (table per step), and Rollback Actions (bullet list per step).
What it watches out for
- Renaming a column in one step while the application still reads the old name, which takes the service down until the deploy lands.
- Backfilling a critical table in a single UPDATE, which holds a lock for the whole run and blocks writers.
- Promising a rollback after the old structures are dropped; past that point only a backup restores data.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.