Help us improve
Share bugs, ideas, or general feedback.
Provides Drizzle ORM patterns for schema definition, CRUD operations, relations, queries, transactions, and migrations. Supports PostgreSQL, MySQL, SQLite, MSSQL, CockroachDB.
npx claudepluginhub giuseppe-trisciuoglio/developer-kit --plugin developer-kit-typescriptHow this skill is triggered — by the user, by Claude, or both
Slash command
/developer-kit-typescript:drizzle-orm-patternsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Expert guide for building type-safe database applications with Drizzle ORM. Covers schema definition, relations, queries, transactions, and migrations for all supported databases.
Provides expertise in Drizzle ORM for TypeScript: schema design, relational queries, Drizzle Kit migrations, and serverless integrations with Neon, Supabase, PlanetScale.
Provides type-safe SQL with Drizzle ORM for defining schemas, writing queries, setting relations, and running migrations across PostgreSQL, MySQL, SQLite, Cloudflare D1, and Durable Objects.
Guides Drizzle ORM type-safe schema design, relational queries, prepared statements, migrations, and transactions. Use for database schema, queries, migrations, and performance optimization in TypeScript.
Share bugs, ideas, or general feedback.
Expert guide for building type-safe database applications with Drizzle ORM. Covers schema definition, relations, queries, transactions, and migrations for all supported databases.
| Database | Table Function | Import |
|---|---|---|
| PostgreSQL | pgTable() | drizzle-orm/pg-core |
| MySQL | mysqlTable() | drizzle-orm/mysql-core |
| SQLite | sqliteTable() | drizzle-orm/sqlite-core |
| MSSQL | mssqlTable() | drizzle-orm/mssql-core |
| Operation | Method | Example |
|---|---|---|
| Insert | db.insert() | db.insert(users).values({...}) |
| Select | db.select() | db.select().from(users).where(eq(...)) |
| Update | db.update() | db.update(users).set({...}).where(...) |
| Delete | db.delete() | db.delete(users).where(...) |
| Transaction | db.transaction() | db.transaction(async (tx) => {...}) |
relations() or defineRelations()import { pgTable, serial, text } from 'drizzle-orm/pg-core';
import { drizzle } from 'drizzle-orm/node-postgres';
import { eq } from 'drizzle-orm';
export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
});
const db = drizzle(process.env.DATABASE_URL);
const [user] = await db.select().from(users).where(eq(users.id, 1));
import { eq } from 'drizzle-orm';
// Insert
const [newUser] = await db.insert(users).values({
name: 'John',
email: 'john@example.com',
}).returning();
// Update
await db.update(users)
.set({ name: 'John Updated' })
.where(eq(users.id, 1));
// Delete
await db.delete(users).where(eq(users.id, 1));
await db.transaction(async (tx) => {
const [from] = await tx.select().from(accounts)
.where(eq(accounts.userId, fromId));
if (from.balance < amount) {
tx.rollback();
}
await tx.update(accounts)
.set({ balance: sql`${accounts.balance} - ${amount}` })
.where(eq(accounts.userId, fromId));
});
See references/transactions.md for advanced transaction patterns.
$inferInsert / $inferSelectgenerate + migrate in production, push for developmentdeletedAt timestamp instead of hard deletes when possible.limit() and .where() to fetch only needed data() => table.column to avoid circular dependency issuestx.rollback() throws an exception - use try/catch if needed.returning() - check your dialect compatibility