Skip to content
Agentmart
Submit a tool

db-migrate

Design and execute safe database migrations.

Skill by roborracle

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/roborracle-db-migrate

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Design and execute safe database migrations. Covers schema evolution, zero-downtime patterns, rollback strategies, and data backfills for SQL and NoSQL databases.

Use cases: design, backend, data

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/db-migrate

Tools it pre-approves 6

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read,
  • Write,
  • Edit,
  • Bash,
  • Grep,
  • Glob

What's inside

Skill name
db-migrate
Description
Design and execute safe database migrations. Covers schema evolution, zero-downtime patterns, rollback strategies, and data backfills for SQL and NoSQL databases.
License
MIT
Allowed tools
Read,, Write,, Edit,, Bash,, Grep,, Glob
Instructions
92 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Database Migration Manager

## Migration Safety Protocol

### Before Writing the Migration
1. **Classify the change** — additive (safe), destructive (dangerous), or transformative (requires expand-contract)
2. **Check table size** — large tables need batched operations to avoid locks
3. **Identify dependencies** — foreign keys, views, triggers, stored procedures that reference the target
4. **Plan rollback** — every migration must have a reverse migration

### Migration Classification

| Type | Risk | Pattern |
|------|------|---------|
| Add column (nullable) | Low | Direct ALTER |
| Add column (NOT NULL + constant default) | Low | Direct ALTER on Postgres 11+ / MySQL 8.0+ (metadata-only); on older engines or volatile defaults: add nullable → backfill → set NOT NULL |
| Remove column | High | Expand-contract (stop reading → deploy → drop) |
| Rename column | High | Add new → copy data → update code → drop old |
| Change column type | High | Add new column → backfill with cast → swap |
| Add index | Medium | CREATE INDEX CONCURRENTLY (Postgres) or equivalent |
| Drop table | Critical | Verify zero references → soft-delete first → drop after grace period |

### Zero-Downtime Pattern: Expand-Contract

For any breaking schema change:

**Phase 1 — Expand** (backward compatible)
```sql
-- Add new column, keep old one
ALTER TABLE users ADD COLUMN full_name VARCHAR(255);
```

**Phase 2 — Migrate** (backfill data)
```sql
-- Batch update to avoid long locks (Postgres has no UPDATE ... LIMIT; select the batch by key)
UPDATE users SET full_name = first_name || ' ' || last_name
WHERE id IN (
  SELECT id FROM users WHERE full_name IS NULL ORDER BY id LIMIT 1000
);
```

**Phase 3 — Transition** (code reads new, writes both)
- Deploy application code that writes to both columns
- Reads from new column with fallback to old

**Phase 4 — Contract** (remove old)
```sql
-- Only after all code uses new column
ALTER TABLE users DROP COLUMN first_name, DROP COLUMN last_name;
```

### Migration File Template
```sql
-- Migration: [description]
-- Author: [name]
-- Date: [date]
-- Reversible: Yes/No
-- Estimated duration: [time on production data size]
-- Lock level: [none/row/table]

-- UP
[migration SQL]

-- DOWN (rollback)
[reverse SQL]

-- VERIFY (post-migration check)
[validation query that confirms success]
```

### Pre-Flight Checklist
- [ ] Migration runs in a transaction (or is idempotent if it cannot)
- [ ] Rollback migration tested
- [ ] No full table locks on tables with >100K rows
- [ ] Indexes created CONCURRENTLY where supported
- [ ] Constant defaults use the engine's metadata-only ADD COLUMN path; volatile defaults (e.g. `now()`, `random()`) on large tables are backfilled in batches
- [ ] Verified on staging with production-sized dataset
- [ ] Backup confirmed before execution

### Anti-Patterns
- Adding NOT NULL without a default on a large table (locks entire table)
- Running data migration in the same transaction as schema migration
- Dropping columns before all code paths stop referencing them
- Using ORM auto-migration in production without reviewing generated SQL
- Assuming migration duration from dev dataset size

### Data Migration Patterns
- **Backfill**: Batch updates keyed on the primary key (keyset, not OFFSET), sleep between batches
- **Transform**: ETL pipeline with progress tracking and resumability
- **Seed**: Idempotent INSERT ... ON CONFLICT DO NOTHING

From roborracle/agent-workflow-kit, MIT.

More from roborracle/agent-workflow-kit

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Sep 24, 2026 (1 month ago)
Last release
Aug 11, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from roborracle

Cite this page

db-migrate skill. Agent Mart. https://agentmart.dev/skills/roborracle-db-migrate (last updated 2026-10-24)