maksimzayats/specx/specx-sqlalchemy-migrations

Claude Code and agent skill by maksimzayats/specx

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Add or repair Alembic migrations for specx SQLAlchemy services. Use when adding SQLAlchemy models or repositories, replacing metadata.create_all schema bootstraps, creating async Alembic env.py, adding migration Makefile targets, generating initial revisions, or testing migration drift.

Install

npx vskill@latest install maksimzayats/specx/specx-sqlalchemy-migrations

SKILL.md

specx SQLAlchemy Migrations

Use this skill whenever a specx project has SQLAlchemy models or persistence adapters. Read references/alembic.md before editing migration files.

Workflow

  1. Add alembic>=1.18.5 as a runtime dependency when SQLAlchemy adapters

exist, together with SQLAlchemy's asyncio extra and the selected driver.

  1. Add alembic.ini, migrations/env.py, migrations/script.py.mako, and

migrations/versions/.

  1. Use Alembic's async pattern for async SQLAlchemy engines.
  2. Put app-wide SQLAlchemy settings/session factory under top-level

infrastructure/sqlalchemy/.

  1. Keep scope-owned ORM models and repositories under

core/<scope>/infrastructure/sqlalchemy/.

  1. Add a project-local SQLAlchemy declarative base under

src/<package>/foundation/sqlalchemy_model.py; do not use shared packaged metadata for generated services.

  1. Put reusable model discovery under top-level

infrastructure/sqlalchemy/model_discovery.py. Use that same function from migrations/env.py and its guardrail test before assigning target_metadata; do not duplicate discovery or maintain hard-coded model module names.

  1. Set target_metadata to the project-local BaseSQLAlchemyModel.metadata.
  2. Generate or hand-review an initial migration for current models.
  3. Add make migrate and make makemigrations.
  4. Add tests that run alembic upgrade head against an isolated database,

check for pending autogenerate changes, and prove every core SQLAlchemy model file is included by the exact discovery function Alembic uses. Use the production database family when dialect behavior matters.

Guardrails

  • Do not call Base.metadata.create_all, metadata.create_all, or

drop_all from src/.

  • Do not run migrations from FastAPI startup by default. Run migrations as an

operational command before app startup.

  • Do not put app-wide engine/session factory code inside one core scope.
  • Do not let delivery controllers import ORM models, repositories, sessions, or

migration helpers.

  • Do not let Alembic drift checks depend on incomplete metadata. Model discovery

must include every core/*/infrastructure/sqlalchemy/models/*.py file.

  • Do not trust autogenerated migrations without review.
  • Do not edit, delete, or reorder a revision that may already have been applied;

add a new corrective revision.

  • Do not pass SQLite's autocommit connect argument on Python 3.11. For a

savepoint-based SQLite test harness spanning Python versions, use SQLAlchemy's connect and begin event-hook recipe.

Code Style

Use blank lines as logical separators in all code. Keep related statements together, but separate independent setup, action, assertion, response, branch, and transformation groups so long blocks stay readable.

References

  • references/alembic.md - async Alembic layout, env.py, Makefile targets,

initial migration, and migration tests.

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

Popularity

7-day trend score
0

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/maksimzayats/specx/specx-sqlalchemy-migrations/badge)](https://verified-skill.com/skills/maksimzayats/specx/specx-sqlalchemy-migrations)

Something wrong with this skill or its page? Tell us.