Skip to content
Skill

Alembic migrations

Guides an agent through Alembic migrations for async SQLAlchemy and PostgreSQL projects

Alembic migrations is an open-source agent skill for databases. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
13
Last commit
License
MIT
Listing updated

Similar skills

About Alembic migrations

This skill gives an agent a set of conventions for setting up and running Alembic with async SQLAlchemy on asyncpg. It covers wiring an async engine into env.py through run_sync, configuring autogenerate with type comparison and filtering of internal tables, and writing upgrade and downgrade functions for schema changes and data migrations.

The guidance also includes a pattern for enabling Row-Level Security and tenant isolation policies in migrations, with matching downgrade steps. It lists common migration errors such as missing revisions and multiple heads, along with a command reference for init, revision, upgrade, downgrade, history and stamp.

The skill expects a Python project using SQLAlchemy and PostgreSQL through asyncpg. It ships no scripts; the agent works directly with the project's alembic.ini, env.py and version files.

When your agent uses it

Alembic migration setup and patterns for async SQLAlchemy — async engine + run_sync in env.py, autogenerate, RLS/multi-tenant migrations. Use for alembic init, writing migrations, or debugging migration errors.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 6 files (54 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

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

/plugin marketplace add ajyadav013/claude-kit
/plugin install claude-kit@claude-kit

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/alembic-migrations &&
cp -R "$tmp/providers/codex/claude-kit/skills/alembic-migrations" ~/.claude/skills/alembic-migrations &&
rm -rf "$tmp"

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

Claude Code docs on skills

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/alembic-migrations &&
cp -R "$tmp/providers/codex/claude-kit/skills/alembic-migrations" ~/.agents/skills/alembic-migrations &&
rm -rf "$tmp"

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

Codex docs on skills

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/alembic-migrations &&
cp -R "$tmp/providers/codex/claude-kit/skills/alembic-migrations" ~/.cursor/skills/alembic-migrations &&
rm -rf "$tmp"

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

Cursor docs on skills

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

gemini skills install https://github.com/ajyadav013/claude-kit.git --path providers/codex/claude-kit/skills/alembic-migrations

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

Gemini CLI docs on skills

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

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/alembic-migrations &&
cp -R "$tmp/providers/codex/claude-kit/skills/alembic-migrations" ~/.copilot/skills/alembic-migrations &&
rm -rf "$tmp"

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

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/ajyadav013/claude-kit.git

Then copy claude-kit/providers/codex/claude-kit/skills/alembic-migrations into your agent's skills folder as alembic-migrations. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Async env.py setup
Shows how to wire an async engine into Alembic's env.py using run_sync and a NullPool.
Autogenerate configuration
Covers autogenerate workflow, type comparison and excluding internal tables with an include_object callback.
Row-level security migrations
Provides a pattern for enabling tenant-scoped RLS policies and reversing them on downgrade.
Revision naming and structure
Describes sequential, timestamp-hash and generated revision naming and the standard migration file layout.
Migration troubleshooting
Lists frequent errors such as multiple heads and revisions that cannot be located, with fix guidance.
Command reference
Summarizes the Alembic CLI commands for initializing, revising, upgrading, downgrading and inspecting history.

Good for

  • Set up Alembic for a new async FastAPI and SQLAlchemy project
  • Generate an autogenerated migration after changing SQLAlchemy models
  • Add tenant isolation with row-level security policies to existing tables
  • Debug a 'multiple heads' or 'can't locate revision' Alembic error
  • Write a data backfill migration with a working downgrade

Alembic migrations FAQ

What does Alembic migrations need to run?

It targets Python projects using async SQLAlchemy with asyncpg on PostgreSQL. It includes no scripts, so the agent works with the project's own Alembic files.

Does Alembic migrations work with non-async SQLAlchemy projects?

The patterns are built around async engines and run_sync. Sync projects are not the focus, and the skill warns against using a sync engine in async projects.

When does the skill trigger?

It is meant for tasks such as running alembic init, writing migrations, or debugging migration errors in an async SQLAlchemy codebase.

How do I install Alembic migrations in Claude Code?

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

Does Alembic 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 Alembic 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 Alembic migrations?

The closest alternatives to Alembic migrations are Alembic knowledge patch, Database migrations, Database migrations, Postgres database migration and Postgres.

Where this comes from

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

More from ajyadav013/claude-kit

  1. Guides an agent through pytest, async fixtures and security-regression tests for FastAPI

    • Open source
    • 13 GitHub stars
    • Developer tools
  2. Lets your agent inspect and debug live browser pages via Chrome DevTools MCP

    • Open source
    • 13 GitHub stars
    • Browser automation
  3. Runs concurrent load and stress tests against API endpoints to find latency and throughput

    • Open source
    • 13 GitHub stars
    • Developer tools
  4. Lets an agent click through a feature in a real browser and check how it behaves

    • Open source
    • 13 GitHub stars
    • Developer tools
  5. Runs quick health checks on backend, frontend and login to catch obvious breakage

    • Open source
    • 13 GitHub stars
    • Developer tools
  6. Guides an agent through red-green-refactor, bug reproduction tests and test pyramid

    • Open source
    • 13 GitHub stars
    • Developer tools