db-migrate
Skill77 starsChanged 10 months agoApache-2.0View on GitHub
Create database migrations using Drizzle Kit. Use when adding/modifying tables, columns, or indexes. Ensures schema.ts and migrations stay in sync.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- suxrobGM/jobpilottheir own version, first seen Oct 3, 2026
- mgiovani/cc-arsenaltheir own version, first seen Sep 25, 2026
- pgnzbl-ux/crucibletheir own version, first seen Aug 27, 2026
- hiromps/claude-skillstheir own version, first seen Aug 4, 2026
- lfrodrigues/packt-claude-code-course-auththeir own version, first seen Jul 15, 2026
- Pradnyeshp/Claude-Skillstheir own version, first seen Jul 6, 2026
Used with
Projects with it also use e2e, ship and 1 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.
SentrySkille2e
Run E2E tests for Sentry JavaScript SDK test applications
Also in 3 projects that use this
AWSSkillship
Finalize dev work on an issue branch — update docs, push, and open a PR.
Also in 5 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 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- alexeykrol/claude-code-starter★ 194same name
- suxrobGM/jobpilot★ 81same name
- lfrodrigues/packt-claude-code-course-auth★ 9same name
- mgiovani/cc-arsenal★ 8same name
- mean-weasel/bullhorn★ 4same name
- pgnzbl-ux/crucible★ 4same name
- amajorai/skills★ 3same name
- vndee/engineering-skills★ 3same name
- Pradnyeshp/Claude-Skills★ 2same name
- bibektimilsina00/runmycrew★ 1same name
2 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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ui-designSkill
- write-docsSkill
- write-testsSkill
- write-tipSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 6 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Create schema changes with proper migrations.
- Very specific: line 21
If you're tempted to write SQL by hand (e.g., for data migrations), create a separate script in scripts/ instead.
- Very specific: line 25
Read current schema: src/lib/schema.ts
- Very specific: line 26
Read recent migrations: drizzle/*.sql (last 2-3)
- Very specific: line 34
Add new tables with pgTable()
- Distinctive: line 35
Add columns to existing tables
- Distinctive: line 40
Run Drizzle Kit to generate migration SQL:
- Distinctive: line 49
Read the generated migration and verify:
- Very specific: line 57
WARNING: Only test migrations locally if POSTGRES_URL points to a LOCAL database.
- Distinctive: line 58
If it points to production, skip this step - migrations will run automatically on Vercel deploy.
- Distinctive: line 65
If local database is configured:
“Common” is measured: kept by at least 6 in 10 of the 9 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 Skill
Create schema changes with proper migrations.
CRITICAL: Never Write Migrations By Hand
ALWAYS use drizzle-kit generate to create migrations. NEVER write SQL migration files manually.
Why this matters:
- Drizzle tracks schema state via snapshot files in
drizzle/meta/ - Hand-written migrations don't update snapshots
- This causes
drizzle-kit generateto fail with confusing prompts about tables being "created or renamed" - It breaks the entire migration system for future changes
If you're tempted to write SQL by hand (e.g., for data migrations), create a separate script in scripts/ instead.
Before Starting
- Read current schema:
src/lib/schema.ts - Read recent migrations:
drizzle/*.sql(last 2-3) - Understand current state before making changes
Workflow
Step 1: Modify Schema First
Edit src/lib/schema.ts with your changes:
- Add new tables with
pgTable() - Add columns to existing tables
- Add/modify indexes
Step 2: Generate Migration
Run Drizzle Kit to generate migration SQL:
pnpm drizzle-kit generateThis creates a new file in drizzle/ like 0011_descriptive_name.sql.
Step 3: Review Generated Migration
Read the generated migration and verify:
- SQL looks correct
- No destructive changes (DROP without intent)
- Index names follow convention
- Column types match schema.ts
Step 4: Test Locally (Optional - Be Careful!)
WARNING: Only test migrations locally if POSTGRES_URL points to a LOCAL database.
If it points to production, skip this step - migrations will run automatically on Vercel deploy.
To check your database URL:
echo $POSTGRES_URL # Should be localhost or local containerIf local database is configured:
pnpm build # Runs migrations automatically
pnpm cli stats # Verify queries workStep 5: Verify in PR
- Migration SQL looks correct (review diff)
- schema.ts and migration are in same commit
- No
IF NOT EXISTSclauses (signals potential drift)
Common Patterns
Adding a Column
// schema.ts
export const myTable = pgTable('my_table', {
// existing columns...
newColumn: varchar('new_column', { length: 255 }),
});Adding an Index
export const myTable = pgTable('my_table', {
// columns...
}, (table) => [
index('idx_my_table_column').on(table.column),
]);Adding a Table
export const newTable = pgTable('new_table', {
id: serial('id').primaryKey(),
// columns...
}, (table) => [
// indexes...
]);Anti-Patterns (NEVER Do This)
- Writing migration SQL by hand - This breaks drizzle's snapshot tracking and causes future
generatecommands to fail. ALWAYS usedrizzle-kit generate. - Using
IF NOT EXISTSorIF EXISTS- These clauses signal you're writing SQL by hand. Generated migrations never include them. - Editing schema.ts without running
drizzle-kit generate - Modifying existing migrations after they've been applied to prod
- Adding data migrations to schema migration files (use separate scripts)
Checklist
Before committing:
- schema.ts changes match generated migration
- Migration tested locally with
pnpm build(only if local DB configured) - No
IF NOT EXISTSclauses (clean migration) - Both schema.ts and migration in same 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.

