database-changes
Skill1 starsChanged 13 days agoMITView on GitHub
Use when writing a database migration, changing a schema, backfilling data, adding transactions or queries on a hot path, or deleting, archiving or purging data
3 other projects use a version of this.
Adopted by
Most recently taken up by
- getvibekits/vibe-coding-rulestheir own version, first seen Oct 25, 2026
- aprameyak/coding-skillstheir own version, first seen Oct 2, 2026
- bchox/agent-practicestheir own version, first seen Sep 17, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- aprameyak/coding-skills★ 2same name
- bchox/agent-practices★ 2same name
- getvibekits/vibe-coding-rules★ 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 repository36 other files it gives its agents.
- skills/writing-skills/references/agents.mdAGENTS.md
- templates/CLAUDE.mdCLAUDE.md
- backend-servicesSkill
- brainstormingSkill
- changing-legacy-codeSkill
- choosing-a-stackSkill
- ci-quality-gatesSkill
- desktop-developmentSkill
- dispatching-parallel-agentsSkill
- docsSkill
- executing-plansSkill
- finishSkill
- git-workflowSkill
- implementSkill
- kit-initSkill
- mobile-developmentSkill
- new-taskSkill
- observabilitySkill
- onboarding-existing-codebaseSkill
- payments-and-moneySkill
- pos-systemsSkill
- publishing-documentsSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- security-reviewSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- ui-motionSkill
- updating-dependenciesSkill
- using-skillsSkill
- verification-before-completionSkill
- verifySkill
- web-frontendSkill
- writing-documentationSkill
- writing-plansSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
expand: add the new column, table or index (nullable, or with a default).
- Distinctive: line 33
Run the migrations up, and down where they exist, on a throwaway database in CI, then compare the resulting schema with the expected one …
- Distinctive: line 38
No network calls or other side effects inside a transaction.
- Distinctive: line 39
Read-modify-write takes a row lock or uses optimistic versioning.
- Distinctive: line 44
Every connection has statement and lock timeouts from configuration (see observability).
- Distinctive: line 46
Every list has a limit or pagination.
- Distinctive: line 52
Never hard-delete what history refers to (orders, receipts, payments, audit records): archive or suspend it instead.
“Common” is measured: kept by at least 6 in 10 of the 3 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 changes
The database outlives every release. A change is safe when the running code, the new code and a rollback all keep working, and no data is lost on the way.
Migrations
- Through the project's migration tool, one purpose per migration. Never edit a migration that has run anywhere shared; add a new one.
Old and new code must both work with the schema after the migration. Deploys and rollbacks overlap them. So anything that breaks the old code goes through expand/contract, over separate releases:
- expand: add the new column, table or index (nullable, or with a default);
- migrate: code writes both shapes and reads the new one, and the backfill runs;
- contract: drop the old shape in a later release, once nothing, including a rollback, still needs it.
This applies to renames, drops, type changes,
NOT NULL, and moved tables. Recipes are inreferences/migration-patterns.md.- Transactional where the database supports it. A statement that can't run in a transaction (a concurrent index build) gets a comment with the reason.
- Reversible: a down or rollback migration restores the schema. It doesn't restore data, so a destructive step says so and names its recovery path (a backup, or a backfill from the source).
- Locks: set a short
lock_timeoutfor the migration; build indexes concurrently; avoid rewriting large tables in one statement (check how your database handles the change). - Backfills are separate, idempotent, batched jobs that can be resumed and throttled, never part of the schema migration.
Deploying
- The order is: backup, then migrations as their own step (not in the app's start command), then the rollout, then a health check. A failed migration stops the rollout, so the old code keeps serving.
- The app refuses to start, or reports not ready, when the database lacks a migration this build needs. It tolerates newer ones, so an image rollback still boots.
- Where possible, the migrator and the running app use different database roles: the app can't alter the schema.
- Running migrations against a shared or production database needs the user's explicit yes (the guard asks).
Verifying
Run the migrations up, and down where they exist, on a throwaway database in CI, then compare the resulting schema with the expected one (drift check). Test the backfill on realistic volumes and data shapes, including NULLs and legacy values.
Transactions
- Dependent writes run in one transaction. Helpers take the caller's transaction instead of opening their own.
- No network calls or other side effects inside a transaction. Record them in an outbox table in the same transaction and send them after commit (see payments-and-money).
- Read-modify-write takes a row lock or uses optimistic versioning. Don't rely on the isolation level to save you.
- Timestamps such as
created_atandupdated_atcome from the database clock.
Queries
- Every connection has statement and lock timeouts from configuration (see observability).
- Select explicit columns. Use parameters only, never string-built SQL; identifiers come from an allowlist.
- Every list has a limit or pagination. Watch for N+1 queries.
- A new query on a hot path gets an index and a look at its plan (
EXPLAIN).
Deleting data
- Choose the transition deliberately: hard delete, soft delete (archive), anonymize, or purge after a retention window.
- Never hard-delete what history refers to (orders, receipts, payments, audit records): archive or suspend it instead.
- Archived rows are filtered out by default in every query that lists them.
- A purge needs a stated retention period (and the legal basis for personal data).
- The UI says what really happened: "Archive" only if the user can restore it.
Databases on devices
Room, Core Data, SQLDelight or SQLite on mobile and POS: test the migration from every schema version that shipped, and never use a destructive fallback (fallbackToDestructiveMigration) in production. Offline queues must survive the upgrade (see pos-systems).
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.

