db-migrate
Skill0 starsChanged 3 months agoMITView on GitHub
Design and execute safe database migrations. Covers schema evolution, zero-downtime patterns, rollback strategies, and data backfills for SQL and NoSQL databases.
- Deletes or force-pushes
18 other projects use a version of this.
Adopted by
Most recently taken up by
- suxrobGM/jobpilottheir own version, first seen Nov 7, 2026
- lablup/backend.aitheir own version, first seen Oct 8, 2026
- linuxfoundation/insightstheir own version, first seen Oct 8, 2026
- Ame-Al/ametheir own version, first seen Oct 8, 2026
- simstudioai/simtheir own version, first seen Oct 8, 2026
- mgiovani/cc-arsenaltheir own version, first seen Sep 25, 2026
Used with
Projects with it also use react-query-best-practices, you-might-not-need-a-callback and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
bibektimilsina00Skillreact-query-best-practices
Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.
Also in 3 projects that use this
bibektimilsina00Skillyou-might-not-need-a-callback
Analyze and fix useCallback anti-patterns in your code
Also in 3 projects that use this
MicrosoftSkillcleanup
Also in 3 projects that use this
AWSSkillship
Finalize dev work on an issue branch — update docs, push, and open a PR.
Also in 7 projects that use this
VercelSkilldeploy
Deploy applications to Vercel. Use when the user says "deploy", "deploy to Vercel", "push to production", "deploy my app", or "go live".
Also in 4 projects that use this
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 3 projects that use this
- +3 more from bibektimilsina00
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- simstudioai/sim★ 30ksame name
- lablup/backend.ai★ 679same name
- linuxfoundation/insights★ 288same name
- alexeykrol/claude-code-starter★ 194same name
- suxrobGM/jobpilot★ 110same name
- getsentry/abacus★ 77same name
- lfrodrigues/packt-claude-code-course-auth★ 9same name
- mgiovani/cc-arsenal★ 8same name
- mean-weasel/bullhorn★ 4same name
- pgnzbl-ux/crucible★ 4same name
8 more not listed
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 repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- a11y-auditSkill
- ai-engineerSkill
- api-clientSkill
- changelog-enforcerSkill
- code-cleanup-guardianSkill
- code-reviewerSkill
- contract-testSkill
- dep-auditSkill
- devops-automatorSkill
- env-configSkill
- error-observabilitySkill
- frontend-designSkill
- git-commit-helperSkill
- github-issues-managerSkill
- git-issue-syncSkill
- git-protocolSkill
- handoffSkill
- incident-responseSkill
- init-projectSkill
- karpathy-guidelinesSkill
- market-researcherSkill
- parallel-agent-git-isolationSkill
- product-strategistSkill
- pr-workflowSkill
- rapid-builderSkill
- release-managerSkill
- resumeSkill
- scrutinizeSkill
- shadcn-uiSkill
- skill-builderSkill
- sprint-plannerSkill
- state-machine-diagramsSkill
- state-managementSkill
- surveySkill
- system-architectSkill
- tech-docsSkill
- unstuckSkill
- ux-design-systemSkill
- ux-researchSkill
- webapp-testingSkill
- web-dev-fundamentalsSkill
- workflow-optimizerSkill
The file
Files
Database Migration Manager
Migration Safety Protocol
Before Writing the Migration
- Classify the change — additive (safe), destructive (dangerous), or transformative (requires expand-contract)
- Check table size — large tables need batched operations to avoid locks
- Identify dependencies — foreign keys, views, triggers, stored procedures that reference the target
- Plan rollback — every migration must have a reverse migration
Migration Classification
| Type | Risk | Pattern |
| Add column (nullable) | Low | Direct ALTER |
| Add column (NOT NULL + constant default) | Low | Direct ALTER on Postgres 11+ / MySQL 8.0+ (metadata-only); on older engines or volatile defaults: add nullable → backfill → set NOT NULL |
| Remove column | High | Expand-contract (stop reading → deploy → drop) |
| Rename column | High | Add new → copy data → update code → drop old |
| Change column type | High | Add new column → backfill with cast → swap |
| Add index | Medium | CREATE INDEX CONCURRENTLY (Postgres) or equivalent |
| Drop table | Critical | Verify zero references → soft-delete first → drop after grace period |
Zero-Downtime Pattern: Expand-Contract
For any breaking schema change:
Phase 1 — Expand (backward compatible)
-- Add new column, keep old one
ALTER TABLE users ADD COLUMN full_name VARCHAR(255);Phase 2 — Migrate (backfill data)
-- Batch update to avoid long locks (Postgres has no UPDATE ... LIMIT; select the batch by key)
UPDATE users SET full_name = first_name || ' ' || last_name
WHERE id IN (
SELECT id FROM users WHERE full_name IS NULL ORDER BY id LIMIT 1000
);Phase 3 — Transition (code reads new, writes both)
- Deploy application code that writes to both columns
- Reads from new column with fallback to old
Phase 4 — Contract (remove old)
-- Only after all code uses new column
ALTER TABLE users DROP COLUMN first_name, DROP COLUMN last_name;Migration File Template
-- Migration: [description]
-- Author: [name]
-- Date: [date]
-- Reversible: Yes/No
-- Estimated duration: [time on production data size]
-- Lock level: [none/row/table]
-- UP
[migration SQL]
-- DOWN (rollback)
[reverse SQL]
-- VERIFY (post-migration check)
[validation query that confirms success]Pre-Flight Checklist
- Migration runs in a transaction (or is idempotent if it cannot)
- Rollback migration tested
- No full table locks on tables with >100K rows
- Indexes created CONCURRENTLY where supported
- Constant defaults use the engine's metadata-only ADD COLUMN path; volatile defaults (e.g.
now(),random()) on large tables are backfilled in batches - Verified on staging with production-sized dataset
- Backup confirmed before execution
Anti-Patterns
- Adding NOT NULL without a default on a large table (locks entire table)
- Running data migration in the same transaction as schema migration
- Dropping columns before all code paths stop referencing them
- Using ORM auto-migration in production without reviewing generated SQL
- Assuming migration duration from dev dataset size
Data Migration Patterns
- Backfill: Batch updates keyed on the primary key (keyset, not OFFSET), sleep between batches
- Transform: ETL pipeline with progress tracking and resumability
- Seed: Idempotent INSERT ... ON CONFLICT DO NOTHING
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.

