# Database migrations

> Database migrations is an open-source agent skill for databases. Guides agents through safe Postgres schema changes, backfills and sqlc regeneration. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/Nabwinsaud/forgeline/tree/main/skills/database-migrations
- **Repository:** https://github.com/nabwinsaud/forgeline
- **GitHub stars:** 8
- **License:** MIT
- **Skill name:** database-migrations
- **Collection:** https://github.com/Nabwinsaud/forgeline
- **Categories:** [databases](https://ai-powered.com/categories/databases), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill gives an agent a set of Postgres-first rules for changing schema and data: one new migration per change, never editing a migration that may already be applied, and writing a reversible down for every up. It explains which DDL operations lock tables and what to do instead, such as concurrent index builds, NOT VALID constraints with separate validation, and lock_timeout settings.

It also lays out an expand/contract sequence for renames and type changes, spread across separate releases, and advice to batch large backfills so they stay idempotent and restartable. Tool-specific commands are included for golang-migrate, goose, Alembic and Prisma, with notes on reviewing autogenerated output by hand.

For Go projects using sqlc, the skill describes the loop of editing SQL queries, running sqlc generate and vet, rebuilding and testing, and never hand-editing generated files. It expects a Postgres database to test against and the relevant migration tool in the repository.

## When your agent uses it

> Postgres-first rules for schema and data changes - one new migration per change, never edit applied ones, expand/contract for renames, concurrent indexes, batched backfills, reversible downs - plus tool workflows (golang-migrate, goose, Alembic, Prisma) and the sqlc generate/vet loop. Use when a job changes schema, queries or data.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/Nabwinsaud/forgeline/tree/HEAD/skills/database-migrations)
- [License: MIT](https://github.com/Nabwinsaud/forgeline/tree/HEAD/skills/database-migrations)

## Features

- **Migration safety rules:** Ground rules for one-change migrations, never editing applied ones, and keeping old code working during deploys.
- **Lock-aware DDL guidance:** A table of Postgres operations showing which ones block writes or scan tables and safer alternatives.
- **Expand and contract steps:** A staged approach for renames and column type changes spread across separate releases.
- **Batched backfill pattern:** Keyed, per-batch UPDATE pattern that keeps large data changes restartable.
- **Multi-tool migration commands:** Create, up and down commands for golang-migrate, goose, Alembic and Prisma.
- **sqlc generate and vet loop:** Steps for editing queries, regenerating typed Go code and verifying the build and tests.

## Good for

- Add a column to a large Postgres table without locking writes
- Rename a column using expand and contract across releases
- Write a concurrent index migration for goose or golang-migrate
- Backfill a new status column in batches
- Regenerate sqlc code after changing a query

## Install

### Claude Code

This skill ships in the `forgeline` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add Nabwinsaud/forgeline
/plugin install forgeline@forgeline
```

Or copy only this skill to `~/.claude/skills/database-migrations`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/database-migrations &&
cp -R "$tmp/skills/database-migrations" ~/.claude/skills/database-migrations &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/database-migrations` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/database-migrations` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/database-migrations &&
cp -R "$tmp/skills/database-migrations" ~/.agents/skills/database-migrations &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/database-migrations` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/database-migrations` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/database-migrations &&
cp -R "$tmp/skills/database-migrations" ~/.cursor/skills/database-migrations &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/database-migrations` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/Nabwinsaud/forgeline.git --path skills/database-migrations
```

Or copy the folder to `~/.gemini/skills/database-migrations` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/database-migrations`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/database-migrations &&
cp -R "$tmp/skills/database-migrations" ~/.copilot/skills/database-migrations &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/database-migrations` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git
```

Then copy `forgeline/skills/database-migrations` into your agent's skills folder as `database-migrations`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Database migrations trigger?

Its description says it applies when a job changes schema, queries or data.

### Which migration tools does Database migrations cover?

It includes workflows for golang-migrate, goose, Alembic and Prisma, plus the sqlc generate and vet loop.

### Does Database migrations run any scripts?

No scripts are included; it provides rules and command examples only.

### Is Database migrations specific to one database?

Its guidance is Postgres-first, with concurrent indexes, NOT VALID constraints and lock_timeout advice.

### How do I install Database migrations in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/database-migrations to use it in all your projects, or to .claude/skills/database-migrations in one project. Or install the forgeline plugin, which includes it: /plugin marketplace add Nabwinsaud/forgeline, then /plugin install forgeline@forgeline.

### Does Database migrations run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Database migrations?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Database migrations?

The closest alternatives to Database migrations are Database migrations, Go database, Db change management, Alembic knowledge patch and Reviewing oracle to postgres migration.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Database migrations](https://ai-powered.com/skills/database-migrations): Database migrations is an open-source agent skill for databases.
- [Go database](https://ai-powered.com/skills/go-database): Go database is an open-source agent skill for databases.
- [Db change management](https://ai-powered.com/skills/db-change-management): Db change management is an open-source agent skill for databases.
- [Alembic knowledge patch](https://ai-powered.com/skills/alembic-knowledge-patch): Alembic knowledge patch is an open-source agent skill for databases.
- [Reviewing oracle to postgres migration](https://ai-powered.com/skills/reviewing-oracle-to-postgres-migration): Reviewing oracle to postgres migration is an open-source agent skill for databases.
- [Data layer patterns edho ferdian](https://ai-powered.com/skills/data-layer-patterns-edho-ferdian): Data layer patterns edho ferdian is an open-source agent skill for databases.
- [Migrating oracle to postgres data access code](https://ai-powered.com/skills/migrating-oracle-to-postgres-data-access-code): Migrating oracle to postgres data access code is an open-source agent skill for databases.
- [Go backend](https://ai-powered.com/skills/go-backend): Go backend is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/database-migrations-nabwinsaud
