Agent skill · software engineering · aiskillstore

db-migration

Use when setting up Alembic migrations or making database schema changes. Triggers for: initializing Alembic, generating migrations, applying upgrades, rolling back changes, or creating data migrations. NOT for: raw SQL execution outside migration context or non-database schema updates.

Why this skill is useful

Provides specific Alembic commands and configurations for managing database migrations that the AI wouldn't reliably generate on its own.

What it needs

Requires alembic, sqlalchemy installed locally. About 4k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Database Migration Skill Expert Alembic migration management for SQLModel/FastAPI projects with safe schema evolution and rollback capabilities. Quick Reference Command Purpose --------- --------- alembic init alembic Initialize Alembic in project alembic revision --autogenerate -m "message" Generate migration from model changes alembic revision -m "message" Create empty migration manually alembic upgrade head Apply all pending migrations alembic upgrade +1 Apply one migration at a time alembic downgrade -1 Rollback last migration alembic downgrade base Rollback all migrations alembic current Show current revision alembic history Show migration history Initial Setup 1. Initialize Alembic 2. Configure alembic.ini 3. Configure env.py for SQLModel Generating Migrations Auto-Generate from Model Changes Manual Migration Example: Adding a New Table Example: Adding a Column Applying Migrations Standard Upgrade Dry Run (Check What Would Happen) Rollback (Downgrade) Safe Downgrade Pattern Data Migrations Example: Data Migration with Batch Update Example: Enum Migration Quality Checklist [ ] Data migrations: Handle existing data when modifying columns/tables [ ] Test migrations: Run alembic upgrade then alembic downgrade in test [ ] Idempotent operations: up() and down() can run multiple times safely [ ] No data loss: Use DROP TABLE IF EXISTS, DROP COLUMN IF EXISTS [ ] Indexes created: Include index creation in upgrade, drop in downgrade [ ] Foreign keys: Handle constraint ordering (create before, drop after) [ ] Backwards compatible: Don't break existing application during migration Integration with Other Skills Skill Integration Point ------- ------------------- @sqlmodel-crud Model changes trigger migrations @fastapi-app Migrations run at startup or via CLI @jwt-auth May need to handle auth during migrations Migration Best Practices 1. Always Generate Before Manual Edit 2. Review Generated Migrations 3. Test Migration Cycle 4. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/db-migration

View the source on GitHub

Browse the @skills marketplace