new-migration
Skill0 starsChanged 8 months agoMITView on GitHub
Scaffold a new Drizzle ORM schema file and generate a migration. Use when the user asks to create a database table, add a column, change a schema, or run a migration.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- fleetdm/fleettheir own version, first seen Oct 8, 2026
- CodeWithCJ/SparkyFitnesstheir own version, first seen Oct 8, 2026
- tstephx/book-mcp-servertheir own version, first seen Aug 19, 2026
- sebastiandev/ateliertheir own version, first seen Aug 19, 2026
- TheAstrelo/Claude-Pipelinetheir own version, first seen Jul 26, 2026
- behradkhodayar/claude-code-py-ts-pgtheir own version, first seen Jul 1, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- fleetdm/fleet★ 7.2ksame name
- CodeWithCJ/SparkyFitness★ 6.7ksame name
- TheAstrelo/Claude-Pipeline★ 44same name
- sebastiandev/atelier★ 8same name
- behradkhodayar/claude-code-py-ts-pg★ 1same name
- tstephx/book-mcp-server★ 1same 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 repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- design-componentSkill
- new-componentSkill
- new-composableSkill
- new-gql-operationSkill
- new-quill-fieldSkill
- new-resolverSkill
- new-server-routeSkill
- new-settings-storeSkill
- new-storeSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 2 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
2
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
- could be automatic: a setting could enforce it
- Very specific: line 10
Always export inferred types: type X = typeof table.$inferSelect
- Very specific: line 13
Always include id (uuid), createdAt, updatedAt unless explicitly not needed
- Very specific: line 14
After editing schema: run npm run db:generate then npm run db:migrate
- Distinctive: line 15
Never edit migration files manually — regenerate instead
- Distinctive: line 86
Ask: what table/entity? What columns?
- Very specific: line 89
Run: npm run db:generate — review the generated SQL
- Very specific: line 90
Run: npm run db:migrate — apply to the database
“Common” is measured: kept by at least 6 in 10 of the 6 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
Skill: New Migration
Rules
- Schema files live in
server/db/schema/[domain].ts - Always export inferred types:
type X = typeof table.$inferSelect - Table names:
snake_caseplural — e.g.blog_posts - Column names:
snake_case— e.g.created_at - Always include
id(uuid),createdAt,updatedAtunless explicitly not needed - After editing schema: run
npm run db:generatethennpm run db:migrate - Never edit migration files manually — regenerate instead
Schema Template
// server/db/schema/[domain].ts
import {
pgTable,
uuid,
text,
timestamp,
boolean,
integer,
// jsonb,
// pgEnum,
} from 'drizzle-orm/pg-core'
import { relations } from 'drizzle-orm'
// Optional: define enums
// export const statusEnum = pgEnum('status', ['draft', 'published', 'archived'])
export const [tableName] = pgTable('[table_name]', {
id: uuid('id').defaultRandom().primaryKey(),
// --- your columns here ---
name: text('name').notNull(),
description: text('description'),
isActive: boolean('is_active').default(true).notNull(),
// --- timestamps (always include) ---
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
})
// Relations (add if this table has FK relationships)
// export const [tableName]Relations = relations([tableName], ({ one, many }) => ({
// author: one(users, { fields: [[tableName].userId], references: [users.id] }),
// }))
// Inferred TypeScript types — use these everywhere, never redefine manually
export type [Type] = typeof [tableName].$inferSelect
export type New[Type] = typeof [tableName].$inferInsertCommon Column Types
// Text
title: text('title').notNull()
slug: text('slug').notNull().unique()
content: text('content') // HTML from Quill
// Numbers
order: integer('order').default(0)
price: numeric('price', { precision: 10, scale: 2 })
// Boolean
isPublished: boolean('is_published').default(false).notNull()
// JSON
metadata: jsonb('metadata')
// Foreign key
userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' })
// Enum
status: statusEnum('status').default('draft').notNull()Steps
- Ask: what table/entity? What columns? Any foreign keys?
- Generate the schema file following the template
- Export the inferred types
- Run:
npm run db:generate— review the generated SQL - Run:
npm run db:migrate— apply to the database - Remind: if adding to an existing domain, also update
server/db/index.tsif needed
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.

