Creates versioned Alembic migration scripts with tables, columns, primary keys, foreign keys, unique and functional constraints (e.g. case-insensitive uniqueness), and reference-data seeds, all derived from the entity model. Use when the user asks to "create a migration", "add a database migration", "write an Alembic migration", "add a column", "add a foreign key", "seed reference data", or mentions Alembic, schema migration, or database schema changes.
80
100%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
Create an Alembic migration for $ARGUMENTS (an entity, or a specific schema change to an existing entity) based on
docs/guidelines/entity_model.md. Don't implement application code in this skill — that's /implement-backend.
entity_model.md — the migration must match the ER diagram's attribute
tables exactly, including the Length/Precision and Validation Rules columns.UNIQUE constraint where entity_model.md specifies case-insensitive uniqueness (e.g. PET's
(owner_id, name) constraint) — use a functional unique index (LOWER(...)) or the citext extension, per
architecture.md §2.4. A plain UNIQUE is case-sensitive and will silently violate the business rule.PET_TYPE and SPECIALTY are lookup tables the use cases assume are pre-populated
(e.g. UC-007's precondition) — seed them via a data migration in the same chain, not a separate ad hoc script.**Constraints:** note from docs/guidelines/entity_model.md.backend/alembic/versions/ for naming and style conventions, and find the
current migration head.alembic revision --autogenerate -m "<description>", or write it by hand where
autogenerate can't express the constraint (functional indexes, citext).entity_model.md's columns into SQLAlchemy/Alembic definitions:
Long / 19 → BigInteger, primary key with Sequence → server-generated identity/sequence.String / N → String(N).Date → Date; DateTime → DateTime.Not Null → nullable=False; Optional → nullable=True.Foreign Key (TABLE.id) → ForeignKey("table.id").Not Null, Unique → unique=True, or a named UniqueConstraint for composite keys (e.g. VET_SPECIALTY).**Constraints:** note (e.g. PET's case-insensitive (owner_id, name) uniqueness, VET_SPECIALTY's
composite primary key), implement it as an explicit functional index or table-level constraint — not a comment.PET_TYPE, SPECIALTY), add a data migration (op.bulk_insert or
op.execute) in the same migration or immediately after it in the chain.alembic upgrade head) and verify it applies
cleanly; run alembic downgrade -1 to confirm the downgrade path works too.entity_model.md column-by-column to confirm nothing was missed or invented.docs/guidelines/entity_model.md — source of truth for schema.docs/guidelines/architecture.md §2.4 — connection management, case sensitivity/collation, and how migrations run
in the deployed pipeline (a dedicated migration Lambda, since Aurora has no public access).../../rules/mcp-servers.md).dee4c03
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.