alembic-best-practices

Enforce Alembic migration naming conventions and safe patterns for SQLAlchemy projects.

13|6|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/baekenough/second-brain --skill alembic-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: alembic-best-practices
Source: https://github.com/baekenough/second-brain/tree/main/.claude/skills/alembic-best-practices
Command: npx skills add https://github.com/baekenough/second-brain --skill alembic-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Alembic migration drift and unsafe changes are mitigated by enforcing naming conventions, credential handling, and standard migration patterns across teams.

Core Features & Use Cases

  • Enforces consistent naming conventions for constraints and indexes to prevent drift across databases.
  • Provides guidance for credential management and security in migration scripts.
  • Demonstrates autogenerate trust matrix, dangerous pattern detection, and Expand-Contract migration strategies for zero-downtime changes.

Quick Start

Implement the three-phase Expand-Contract workflow in your migrations and wire up CI checks as described.

Frequently Asked Questions about alembic-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run zero-downtime database migrations with Alembic?

Zero-downtime Alembic migrations use a three-phase Expand-Contract workflow to deploy schema changes safely. This strategy separates adding new structures, migrating data, and dropping old ones to prevent production downtime during database upgrades.

What is the best way to configure Alembic env.py for consistent autogenerate?

Configuring Alembic env.py with standard settings ensures consistent autogenerate results. Enforcing strict naming conventions for constraints and indexes prevents migration drift and ensures reliable schema synchronization across team databases.

How do I integrate Alembic migration checks into CI pipelines?

Integrating Alembic into CI pipelines involves wiring up automated checks for migration safety and naming conventions. This validates SQLAlchemy schema changes and detects dangerous patterns before they reach production environments.

How to detect dangerous patterns in SQLAlchemy Alembic migration scripts?

Dangerous patterns in SQLAlchemy Alembic migrations are detected using an autogenerate trust matrix. This mechanism identifies unsafe schema changes and enforces standard migration patterns to mitigate risks during database upgrades.

Do I need SQLAlchemy before setting up Alembic migrations?

Yes, SQLAlchemy is required because Alembic migrations are built on top of SQLAlchemy models. The Skill standardizes migrations for projects already using SQLAlchemy, covering env.py configuration and schema synchronization.

Why does Alembic autogenerate create migration drift across different databases?

Alembic autogenerate creates migration drift when naming conventions for constraints and indexes are not enforced. Standardizing these naming patterns across the team mitigates unsafe changes and prevents database schema inconsistency.