Skip to content
Back to skills

Db Migration

ASecurity

Generate a Flyway or Liquibase migration in lockstep with an entity change. Detects which migration tool the project uses and the next version number. Invoked by jpa-entity after a schema change, or directly. Trigger phrases: "create migration", "add db migration", "new flyway migration", "add liquibase changeset".

  • 10 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added August 31, 2026
developmentsqlrails

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned August 31, 2026

npx -y skills add ShipWithAI/shipwithai-plugins --skill db-migration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Db Migration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Db Migration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/shipwithai-db-migration/badge)](https://www.skillsdirectory.com/skills/shipwithai-db-migration)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: db-migration
description: >
  Generate a Flyway or Liquibase migration in lockstep with an entity change.
  Detects which migration tool the project uses and the next version number.
  Invoked by jpa-entity after a schema change, or directly.
  Trigger phrases: "create migration", "add db migration", "new flyway migration",
  "add liquibase changeset".
argument-hint: "[description]"
---

# DB Migration — Scaffold

Keeps schema and entities in lockstep: every entity/schema change ships with a
migration. Never rely on `ddl-auto: update` in shared environments.

## Step 1 — Detect the migration tool

| Tool | Signal |
|------|--------|
| **Flyway** | `flyway-core` dependency, or a `src/main/resources/db/migration/` directory |
| **Liquibase** | `liquibase-core` dependency, or a `src/main/resources/db/changelog/` directory |

If neither is present, ask which to set up (default **Flyway** — simplest for v1),
and note the dependency the project must add.

## Step 2 — Determine the next version

- **Flyway:** scan `db/migration/` for `V<n>__*.sql`, take `max(n) + 1`. Filenames:
  `V<n>__<snake_case_description>.sql`.
- **Liquibase:** find the changelog (`db.changelog-master.*`), add a new changeset
  with a unique incrementing `id` and the project's author convention.

## Step 3 — Render the migration

From `assets/`, substitute `{{VERSION}}`, `{{DESCRIPTION}}`, `{{TABLE_NAME}}`,
`{{AUTHOR}}`:

- Flyway:    `flyway_migration.sql.tmpl`     → `db/migration/V{{VERSION}}__{{DESCRIPTION}}.sql`
- Liquibase: `liquibase_changeset.xml.tmpl`  → appended/included into the master changelog

The DDL must include the columns the guardrails imply for entities: a `version`
column (optimistic lock) and audit columns (`created_at`, `updated_at`) when the
entity extends the audited base.

## Step 4 — Report

Show the migration path + the SQL/changeset. If invoked standalone, remind the user
to keep the entity and migration in the same commit.

## Failure modes — do NOT

- Do NOT reuse an existing version number (Flyway will refuse; checksums break).
- Do NOT mix Flyway and Liquibase in one project.
- Do NOT edit an already-applied migration — add a new one (immutable history).
- Do NOT forget the `version` / audit columns when the entity uses them.

Files in this skill

  • SKILL.md2.2 KB
  • assets/flyway_migration.sql.tmpl657 B
  • assets/liquibase_changeset.xml.tmpl1.2 KB
  • evals.json1.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.