database-migrations
Skill116 starsChanged 8 months agoMITView on GitHub
Database migration patterns and schema versioning
- Deletes or force-pushes
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 41 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 59
Always include rollback (down) migrations
- Distinctive: line 60
Never modify existing migrations - create new ones
- Distinctive: line 61
Test migrations on a copy of production data
- Distinctive: line 62
Use transactions for atomic changes
- Very specific: line 63
Add indexes concurrently in production: CREATE INDEX CONCURRENTLY
“Common” is measured: kept by at least 6 in 10 of the 41 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 Patterns
Manage database schema changes safely and reliably.
Migration File Structure
migrations/
001_create_users.sql
002_add_email_index.sql
003_create_orders.sqlWriting Safe Migrations
Adding Columns
-- migrations/004_add_user_status.sql
-- Up
ALTER TABLE users ADD COLUMN status VARCHAR(20) DEFAULT 'active';
CREATE INDEX idx_users_status ON users(status);
-- Down
DROP INDEX idx_users_status;
ALTER TABLE users DROP COLUMN status;Creating Tables
-- migrations/005_create_audit_log.sql
-- Up
CREATE TABLE audit_log (
id SERIAL PRIMARY KEY,
table_name VARCHAR(100) NOT NULL,
record_id INTEGER NOT NULL,
action VARCHAR(20) NOT NULL,
changed_by INTEGER REFERENCES users(id),
changed_at TIMESTAMP DEFAULT NOW(),
old_values JSONB,
new_values JSONB
);
CREATE INDEX idx_audit_log_table ON audit_log(table_name, record_id);
CREATE INDEX idx_audit_log_time ON audit_log(changed_at);
-- Down
DROP TABLE audit_log;Best Practices
- Always include rollback (down) migrations
- Never modify existing migrations - create new ones
- Test migrations on a copy of production data
- Use transactions for atomic changes
- Add indexes concurrently in production:
CREATE INDEX CONCURRENTLY
Other versions43 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 43
- loulanyue/awesome-claude-notes★ 272same name
- Fmarzochi/EGC★ 61same name
- skateddu/claude-code-python-setup★ 28same name
- wpank/ai★ 11same name
- gongyijie85/dsh-ecc★ 8same name
- zero-click/zero-ratchet★ 8same name
- sponge-b0b/Polaris★ 4same name
- chadixearth/graphyloop★ 3same name
- kimtth/agent-skill-100-lines-or-less★ 2same name
- nafeeur/MaskShift★ 2same name
33 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.
Used alongsideProjects with it also use deployment-patterns, postgres-patterns and 10 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.
royaluniondesign-sysSkilldeployment-patterns
Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.
Also in 6 projects that use this
nek1987Skillpostgres-patterns
PostgreSQL patterns for reviewing migrations and writing efficient queries. Use when reviewing Alembic migrations, optimizing queries, or debugging database issues.
Also in 5 projects that use this
HABUBUSSSkillbackend-patterns
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Also in 7 projects that use this
junimnjwSkillagentic-engineering
Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing.
Also in 3 projects that use this
etewiahSkille2e-testing
Playwright E2E testing and Lighthouse performance auditing. Use when setting up E2E tests, running Playwright tests, performing Lighthouse audits, or debugging E2E test failures.
Also in 5 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 10 projects that use this
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- skills/CLAUDE.mdCLAUDE.md
- ecosystem-primerSkill
- framework-selectionSkill
- langchain-agentsSkill
- langchain-oss-primerSkill
- deep-agents-coreSkill
- deep-agents-memorySkill
- deep-agents-orchestrationSkill
- langchain-dependenciesSkill
- langchain-fundamentalsSkill
- langchain-middlewareSkill
- langchain-ragSkill
- langgraph-fundamentalsSkill
- langgraph-human-in-the-loopSkill
- langgraph-persistenceSkill
- langsmith-datasetSkill
- langsmith-evaluatorSkill
- langsmith-traceSkill
- api-docsSkill
- docker-patternsSkill
- react-componentsSkill
- testing-patternsSkill
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.

