nodejs-drizzle
Use when the user asks about Drizzle ORM, drizzle-kit migrations, Drizzle schema, relational queries (db.query), prepared statements or Drizzle with…
от j4flmao★ 47 звёзд на GitHub
Установить nodejs-drizzle в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Drizzle ORM
Purpose
Design database schemas, write SQL-like queries, manage migrations, define relations, and optimize Drizzle ORM for production and edge deployment.
Agent Protocol
Trigger
User request includes: drizzle, drizzle orm, drizzle schema, drizzle migrate, drizzle query, drizzle relation, drizzle edge, drizzle neon, drizzle planetscale.
Input Context
- Database (PostgreSQL, MySQL, SQLite, Turso)
- Drizzle version (0.30+)
- Runtime (Node.js, Bun, Cloudflare Workers, Neon)
- Deployment (serverless, edge, traditional)
Output Artifact
Schema definition, query examples, migration setup, relation config, connection management.
Response Format
Produce artifact directly. No preamble, no postamble, no explanations.
Completion Criteria
- Schema defined with drizzle-orm/pg-core or mysql-core
- Relations defined with drizzle-orm relations
- Migrations generated and applied with drizzle-kit
- Queries use prepared statements for production
- Connection configured for target environment (Node, serverless, edge)
Max Response Length
4096 tokens
Architecture Decision Trees
Drizzle vs Prisma
| Criterion | Drizzle ORM | Prisma |
|---|---|---|
| Performance | Fast (thin SQL wrapper) | Moderate (mapped layer) |
| Bundle size | Tiny (tree-shakeable) | Large (generated client) |
| Type safety | Full (inferred from schema) | Full (generated types) |
| SQL control | Direct SQL with types | Prisma Client abstractions |
| Migrations | Drizzle Kit | Prisma Migrate |
| Edge support | First-class (Neon, Turso, PlanetScale) | Via adapter |
| Relations | Relations module (INSERT-friendly) | include/select |
Decision: Performance + SQL control + edge → Drizzle. Rich ORM features + auto-complete → Prisma.
Database Driver Selection
| Database | Driver | Drizzle Package | Best For |
|---|---|---|---|
| PostgreSQL | pg or @neondatabase/serverless |
drizzle-orm/pg-core |
Full-featured RDBMS |
| MySQL | mysql2 |
drizzle-orm/mysql-core |
PlanetScale, traditional MySQL |
| SQLite | better-sqlite3 or @libsql/client |
drizzle-orm/sqlite-core |
Turso, local, edge |
| PostgreSQL (serverless) | @vercel/postgres |
drizzle-orm/vercel-postgres |
Vercel edge functions |
Workflow
Step 1: Schema Definition
// src/db/schema/users.ts
import { pgTable, uuid, varchar, boolean, timestamp, uniqueIndex, index } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';
export const users = pgTable('users', {
id: uuid('id').defaultRandom().primaryKey(),
email: varchar('email', { length: 255 }).notNull(),
name: varchar('name', { length: 100 }).notNull(),
role: varchar('role', { length: 20 }).$type<'admin' | 'user'>().default('user'),
active: boolean('active').default(true),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull().$onUpdate(() => new Date()),
}, (table) => ({
emailIdx: uniqueIndex('users_email_idx').on(table.email),
activeIdx: index('users_active_idx').on(table.active),
}));
// src/db/schema/posts.ts
import { pgTable, uuid, varchar, text, boolean, timestamp, index } from 'drizzle-orm/pg-core';
import { users } from './users';
export const posts = pgTable('posts', {
id: uuid('id').defaultRandom().primaryKey(),
title: varchar('title', { length: 255 }).notNull(),
content: text('content'),
published: boolean('published').default(false),
authorId: uuid('author_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull().$onUpdate(() => new Date()),
}, (table) => ({
authorIdx: index('posts_author_idx').on(table.authorId),
publishedIdx: index('posts_published_idx').on(table.authorId, table.published),
}));
Step 2: Relations
// src/db/schema/relations.ts
import { relations } from 'drizzle-orm';
import { users } from './users';
import { posts } from './posts';
export const usersRelations = relations(users, ({ one, many }) => ({
posts: many(posts),
}));
export const postsRelations = relations(posts, ({ one }) => ({
author: one(users, {
fields: [posts.authorId],
references: [users.id],
}),
}));
Step 3: Connection and Query
// src/db/index.ts
import { drizzle } from 'drizzle-orm/node-postgres';
import { Pool } from 'pg';
import * as schema from './schema';
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
export const db = drizzle(pool, { schema });
// src/repositories/user.repository.ts
import { db } from '../db';
import { users } from '../db/schema/users';
import { eq, and, desc, count, ilike } from 'drizzle-orm';
export async function findUserById(id: string) {
const result = await db
.select({
id: users.id,
name: users.name,
email: users.em
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/drizzle-advanced.md
- references/drizzle-edge-deployment.md
- references/drizzle-relations.md
- references/migration-patterns.md
- references/query-optimization.md
- references/schema-types.md
FAQ
Что делает скилл nodejs-drizzle?
Use when the user asks about Drizzle ORM, drizzle-kit migrations, Drizzle schema, relational queries (db.query), prepared statements or Drizzle with Neon/Turso. Produces Drizzle schemas, queries and migrations. Not for Prisma (use nodejs-prisma).
Как установить скилл nodejs-drizzle?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nodejs-drizzle запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…