Drizzle ORM schema definition, type-safe queries, relational queries, CRUD operations, transactions, migrations with drizzle-kit, and database setup for PostgreSQL, MySQL, and SQLite. Use when defining database schemas, writing queries or joins, managing migrations, setting up a new Drizzle project, or working with drizzle-kit.
75
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
drizzle(client, { schema }) — omit { schema } and the db.query.* relational API silently does not exist.relations() is ORM-level metadata only and creates no constraint. Define references(() => users.id, { onDelete: 'cascade' }) as well; you need both.typeof table.$inferSelect / $inferInsert — never hand-write them.db.select().from()) for joins and aggregates; relational API (db.query.x.findMany({ with: {...} })) for nested reads. insert/update/delete give back nothing usable without .returning().db.transaction(async (tx) => ...) every call must use tx; a stray db call runs outside the transaction.sql.placeholder('id') + .prepare('name'), then .execute({ id }).db.select({ id: users.id })) avoid loading unused columns; declare indexes in the table definition.generate → review the SQL in the out dir → migrate. push is dev-only. Never edit generated SQL; fix the schema and regenerate. check validates migration history consistency.ALTER TABLE users RENAME COLUMN old_name TO new_name; — then migrate applies it..notNull() → migrate again.postgres(url, { max: 1 }), then migrate(drizzle(client), { migrationsFolder: './drizzle' }), then close it.drizzle.config.ts must supply dialect, schema, out, and dbCredentials.url before any command runs.f297837
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.