database-change
Skill2 starsChanged 20 days agoMITView on GitHub
Change the Postgres schema of this repo with Drizzle. Use when adding or changing a table, column, index or constraint in src/server/db/schema, or when writing or reviewing a migration in drizzle/.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- add-featureSkill
- add-pageSkill
- api-changeSkill
- auth-changeSkill
- shadcnSkill
- upgrade-prerelease-depsSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Run pnpm db:generate --name <slug>.
- Very specific: line 20
Run pnpm check:drift migrations and pnpm check:migrations (squawk: no statement that blocks a busy table).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database change
Steps
- Edit
src/server/db/schema/*.ts.src/server/db/schema/auth.tsis application code: edit it by hand and keep timestampstimestamptz(theauth-changeskill says how to find what Better Auth needs). An id column carries its brand fromsrc/contract/ids.ts:uuidv7Id().$type<PostId>()for the table's own id, andauthorId()is already aUserId. A foreign key to another table gets.$type<ThatId>()too. - Run
pnpm db:generate --name <slug>. It writes a new SQL file and updatesdrizzle/meta/. - Review the new SQL in
drizzle/. Only this new file may be adjusted by hand, and only before it is committed. A type change that must convert data gets itsUSINGclause there, as in0004_auth_timestamptz.sql. An index on a large table is built by handCONCURRENTLY(docs/operations.md). - Apply it:
pnpm db:up, thenpnpm db:migrate. - Run
pnpm check:drift migrationsandpnpm check:migrations(squawk: no statement that blocks a busy table). Waive one statement only with-- squawk-ignore <rule>under a comment line giving the reason. - A new or changed repository query gets a query budget in
tests/db/<feature>-query-budget.test.ts, thenpnpm test:db(readtests/db/AGENTS.md).
Rules
- Migrations already in the journal at
HEADare frozen: databases may have applied them, sotests/unit/repo-policy.test.tsrejects an edit. Change the schema and generate a new migration instead. drizzle/meta/**is written bypnpm db:generateonly.
Done when
pnpm check:drift migrations, pnpm check:migrations, pnpm check:drift database (needs Postgres) and
pnpm check pass, and the schema, the SQL file and drizzle/meta/ are in one commit.
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.

