maxcode0917/full-stack-ai-agent-template/alembic-migration
Claude Code and agent skill by maxcode0917/full-stack-ai-agent-template
- community
Checking that the SKILL.md file is still in the repository.
Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.
Install
npx vskill@latest install maxcode0917/full-stack-ai-agent-template/alembic-migrationSKILL.md
The same SKILL.md was published earlier as vstorm-co/full-stack-ai-agent-template/alembic-migration.
Alembic Migrations
This project uses async SQLAlchemy 2.0 + Alembic on PostgreSQL. Migrations live in backend/alembic/versions/ and are numbered (0001_…, 0002_…).
Workflow
- Change the model first in
backend/app/db/models/(Mapped[...]+mapped_column(),__repr__, relationships withondelete="CASCADE"). Make sure the model is imported inbackend/app/db/models/__init__.pyso autogenerate sees it.
- Autogenerate the migration:
``bash cd backend && uv run alembic revision --autogenerate -m "add <thing>" # or: make db-migrate ``
- ALWAYS review the generated file. Autogenerate is a draft, not the truth:
- Confirm
upgrade()matches your intent anddowngrade()actually reverses it. - Check the
down_revisionchains onto the current head (uv run alembic heads). - Watch for dropped columns/tables you didn't intend, server defaults, enum changes, and JSON/array types.
- Name the revision file with the next sequential prefix to match the existing convention.
- Apply and verify:
``bash cd backend && uv run alembic upgrade head # or: make db-upgrade uv run alembic current # confirm at head ` Then round-trip once to prove downgrade() works: alembic downgrade -1 && alembic upgrade head`.
Data migrations / backfills
For backfills, add explicit op.execute(...) or a small data-loop in upgrade() (see the existing *_backfill_*.py migrations for the pattern). Keep schema and data changes in separate, well-named revisions when practical.
Rules
- Never edit a migration that has already been applied in shared environments — add a new one.
make dev/make bootstraprunalembic upgrade headautomatically; you don't need a separate step in dev.- Keep models and migrations in sync — a model change without a migration will pass tests (sessions are mocked) but break on real Postgres.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtemplate/{{cookiecutter.project_slug}}/.claude/skills/alembic-migration/SKILL.md
Popularity
- Repository stars
- 93
- Repository forks
- 3
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/maxcode0917/full-stack-ai-agent-template/alembic-migration)