---
name: migrate-domain
argument-hint: "generate|upgrade|downgrade|status"
disable-model-invocation: true
description: |
  This skill should be used when the user asks to
  "migrate domain", "DB migration", "alembic revision",
  "schema change", "add table", "add column", "DB change",
  or wants to create, apply, or rollback database migrations.
---

# Alembic Migration Management

Target: $ARGUMENTS (generate | upgrade | downgrade | status)

## Default Flow Position
- Step: `implement` + feeds `verify` (`alembic upgrade head` against clean DB + `/test-domain {name} run`)
- `approach options` upstream conditional — required for indexed-column changes, constraint alterations, or backfills
- Recursion guard: n/a (manual user invocation only — `disable-model-invocation: true`)

## Procedure Overview
1. Pre-check — verify alembic.ini, env file, Model file existence
2. Execute command — generate/upgrade/downgrade/status with appropriate options
3. Review — always review autogenerated files before applying
4. Verify — check applied revision, run integration tests

Read `docs/ai/shared/skills/migrate-domain.md` for detailed steps and command reference.
