Database migration assistant

From XSpoonAi/spoon-awesome-skill · View interactive version

Database migration assistant is an AI agent skill from the GitHub repository XSpoonAi/spoon-awesome-skill. PostgreSQL migration assistant that plans, applies, and rolls back schema changes with drift detection for safe AI-agent execution.

How to use this skill

Skill file

Database Migration Assistant with Rollback

A PostgreSQL migration assistant that makes schema changes safe and repeatable.

It provides plan/apply/rollback workflows with drift detection, and exposes stable CLI tools for AI agents to call.

Designed for production safety: preview first, confirm, then execute.

Quick Start

from spoon_ai.agents import SpoonReactSkill

agent = SpoonReactSkill(
    name="db_migration_agent",
    skill_paths=["./ai-productivity"],
    scripts_enabled=True
)

result = await agent.run("Plan database migrations for this project")
print(result)

Scripts

| Script | Purpose |

|--------|---------|

| plan_migrations.py | Build a migration plan and detect drift |

| apply_migrations.py | Apply pending up migrations (supports dry-run) |

| rollback_migrations.py | Roll back the latest migration or to a target version |

| generate_migration.py | Generate a new migration SQL template |

Environment Variables

| Variable | Required | Description |

|----------|----------|-------------|

| DB_URL | Yes | PostgreSQL connection string, e.g. postgresql://user:pass@host:5432/db |

Best Practices

  1. Always run plan and review the output before apply.
  2. In production, require explicit confirmation and a recent backup.
  3. Treat migration files as append-only; never edit applied migrations.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.