db-migration
Skill2 starsChanged 4 months agoMITView on GitHub
Change this product's database schema safely via Alembic. Use when asked to add or alter a table or column, add an index or constraint, backfill data, or drop something from the database.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- TienDat-Vna/BackSpectheir own version, first seen Sep 28, 2026
- aiqadam/qadam-flowtheir own version, first seen Sep 20, 2026
- nikandr-surkov/ai-saas-startertheir own version, first seen Jul 12, 2026
- PiloTracer/pilo.ai.logicbisontheir own version, first seen Jul 6, 2026
- viknesh20-20/claude-code-tool-kittheir own version, first seen May 2, 2026
- justnau1020/claude-ostheir own version, first seen Mar 30, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- nikandr-surkov/ai-saas-starter★ 23same name
- viknesh20-20/claude-code-tool-kit★ 7same name
- aiqadam/qadam-flow★ 4same name
- justnau1020/claude-os★ 3same name
- TienDat-Vna/BackSpec★ 1same name
- PiloTracer/pilo.ai.logicbison★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-endpointSkill
- deploySkill
- featureSkill
- frontend-craftSkill
- frontend-pageSkill
- product-shapingSkill
- reviewSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 4 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Check docs/DECISIONS.md. If it says Google Sheets, this skill does not apply — there is no Alembic and no app/models/.
- Distinctive: line 22
Alembic is the only path: Never run DDL against a database by hand, and never against production regardless of who asks.
- Distinctive: line 44
Add or update the affected tests.
- Distinctive: line 51
Expand/contract for any table with real data: Add the column, backfill, switch reads — then drop in a *later* migration.
- Distinctive: line 56
Every query stays bounded: If this migration enables a new read path, check it paginates.
- Very specific: line 64
Add an entry to the destructive migration log in docs/OPERATIONS.md: what data is lost, whether it is recoverable, and the rollback …
- Very specific: line 71
Test against a branch, not production.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database migration
First: which persistence profile is this repo on?
Check docs/DECISIONS.md. If it says Google Sheets, this skill does not apply — there is
no Alembic and no app/models/. A schema change is: add the column to the sheet, update the
header resolver in app/store/sheets.py, update the Pydantic schema, regenerate the client.
Record any rename in docs/OPERATIONS.md — it is a breaking change even without a
migration, and the header resolver is what makes it survivable. Then stop; the rest of this
file is Postgres-only.
Postgres
Alembic is the only path. Never run DDL against a database by hand, and never against production regardless of who asks.
Steps
- Change the SQLAlchemy model in
backend/app/models/. Generate:
cd backend && alembic revision --autogenerate -m "describe the change"- Read the generated file before committing it. Autogenerate reliably gets enum changes, server defaults, and index names wrong. This step is not a formality.
Apply locally and confirm:
alembic upgrade head- Add or update the affected tests. A migration with no test touching the new column is a column nobody has proven works.
./scripts/verify.sh
Safety rules
- Expand/contract for any table with real data. Add the column, backfill, switch reads — then drop in a later migration. Two safe deploys beat one clever one.
- Multi-step invariants go in one transaction, inside a service function. If two writes must both land or neither, they are one unit of work.
- Indexes ship with the migration that creates the query pattern, not later.
- Every query stays bounded. If this migration enables a new read path, check it paginates.
Destructive changes
Dropping a column or table is a data deletion, even if the code stopped reading it last week. Before writing one:
- Confirm nothing reads it — search the whole repo, not just the obvious module.
- Add an entry to the destructive migration log in
docs/OPERATIONS.md: what data is lost, whether it is recoverable, and the rollback procedure. - Confirm the Neon restore window covers the mistake you might be about to make.
- Say plainly in your summary that the change is destructive and irreversible. Don't bury it.
Neon branches
Test against a branch, not production. Branches are instant and cheap — that is what they are
for. If the Neon plugin is installed, create the branch through it and point your local
DATABASE_URL at it.
Deploying
Migrations run as a deliberate step before the revision that needs them — never at container start, where concurrent Cloud Run instances race each other.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

