.claude/skills/ts-drizzle-orm/SKILL.md
You are an expert in Drizzle ORM, the lightweight TypeScript ORM that maps directly to SQL. You help developers write type-safe database queries that look like SQL (not a new query language), generate migrations from schema changes, and deploy to serverless environments with zero overhead — supporting Postgres, MySQL, SQLite, Turso, Neon, PlanetScale, and Cloudflare D1.
npx skillsauth add eliferjunior/Claude drizzle-ormInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in Drizzle ORM, the lightweight TypeScript ORM that maps directly to SQL. You help developers write type-safe database queries that look like SQL (not a new query language), generate migrations from schema changes, and deploy to serverless environments with zero overhead — supporting Postgres, MySQL, SQLite, Turso, Neon, PlanetScale, and Cloudflare D1.
// db/schema.ts
import { pgTable, text, integer, boolean, timestamp, serial, uuid, varchar, jsonb, index, uniqueIndex } from "drizzle-orm/pg-core";
import { relations } from "drizzle-orm";
export const users = pgTable("users", {
id: uuid("id").primaryKey().defaultRandom(),
name: varchar("name", { length: 255 }).notNull(),
email: varchar("email", { length: 255 }).notNull(),
role: varchar("role", { length: 20 }).notNull().default("user"),
metadata: jsonb("metadata").$type<{ plan: string; seats: number }>(),
createdAt: timestamp("created_at").defaultNow().notNull(),
}, (table) => ({
emailIdx: uniqueIndex("email_idx").on(table.email),
}));
export const posts = pgTable("posts", {
id: serial("id").primaryKey(),
title: varchar("title", { length: 500 }).notNull(),
content: text("content"),
published: boolean("published").default(false).notNull(),
authorId: uuid("author_id").references(() => users.id).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
}, (table) => ({
authorIdx: index("author_idx").on(table.authorId),
publishedIdx: index("published_idx").on(table.published, table.createdAt),
}));
// Relations (for query builder)
export const usersRelations = relations(users, ({ many }) => ({
posts: many(posts),
}));
export const postsRelations = relations(posts, ({ one }) => ({
author: one(users, { fields: [posts.authorId], references: [users.id] }),
}));
import { drizzle } from "drizzle-orm/node-postgres";
import { eq, and, gte, desc, sql, like, count } from "drizzle-orm";
import * as schema from "./schema";
const db = drizzle(pool, { schema });
// Select — reads like SQL
const publishedPosts = await db.select()
.from(posts)
.where(and(
eq(posts.published, true),
gte(posts.createdAt, new Date("2026-01-01")),
))
.orderBy(desc(posts.createdAt))
.limit(20);
// Join
const postsWithAuthors = await db.select({
title: posts.title,
authorName: users.name,
authorEmail: users.email,
})
.from(posts)
.innerJoin(users, eq(posts.authorId, users.id))
.where(eq(posts.published, true));
// Relational queries (Prisma-like)
const usersWithPosts = await db.query.users.findMany({
with: { posts: { where: eq(posts.published, true), limit: 5 } },
where: eq(users.role, "admin"),
});
// Insert
const [newUser] = await db.insert(users)
.values({ name: "Alice", email: "[email protected]" })
.returning();
// Upsert
await db.insert(users)
.values({ id: userId, name: "Alice", email: "[email protected]" })
.onConflictDoUpdate({ target: users.email, set: { name: "Alice Updated" } });
// Aggregate
const [stats] = await db.select({
total: count(),
published: count(sql`CASE WHEN ${posts.published} THEN 1 END`),
}).from(posts);
// Transaction
await db.transaction(async (tx) => {
const [post] = await tx.insert(posts).values({ title: "New", authorId: userId }).returning();
await tx.insert(notifications).values({ userId, message: `Post ${post.id} created` });
});
npx drizzle-kit generate # Generate migration from schema diff
npx drizzle-kit push # Push schema directly (prototyping)
npx drizzle-kit migrate # Apply migrations
npx drizzle-kit studio # Visual data browser
npm install drizzle-orm
npm install -D drizzle-kit
# + driver: pg | mysql2 | better-sqlite3 | @libsql/client | @neondatabase/serverless
drizzle-kit generate diffs and creates SQLdb.query for Prisma-like nested includes; db.select for raw SQL control@neondatabase/serverless, @libsql/client, D1 for edge/serverlesstypeof users.$inferSelect and $inferInsert for row types; no manual type definitions.prepare() for repeated queries; avoids re-parsing on every calldevelopment
Expert guidance for Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
development
Convert any website into clean, structured data with Firecrawl — API-first web scraping service. Use when someone asks to "turn a website into markdown", "scrape website for LLM", "Firecrawl", "extract website content as clean text", "crawl and convert to structured data", or "scrape website for RAG". Covers single-page scraping, full-site crawling, structured extraction, and LLM-ready output.
tools
Expert guidance for Firebase, Google's platform for building and scaling web and mobile applications. Helps developers set up authentication, Firestore/Realtime Database, Cloud Functions, hosting, storage, and analytics using Firebase's SDK and CLI.
development
When the user needs to build file upload functionality for a web application. Use when the user mentions "file upload," "image upload," "upload endpoint," "multipart upload," "presigned URL," "S3 upload," "file validation," "upload to cloud storage," or "accept user files." Handles upload endpoints, file validation (type, size, magic bytes), cloud storage integration, and upload status tracking. For image/video processing after upload, see media-transcoder.