Communitygithub.com

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

Qu'est-ce que skills ?

skills is a Claude Code agent skill that drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/drizzle-orm

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

Drizzle ORM

Rules

  • Schema definition: pgTable() / mysqlTable() / sqliteTable() in src/db/schema.ts
  • Development: drizzle-kit push for fast iteration — no migration files needed
  • Production: drizzle-kit generate + drizzle-kit migrate for trackable migration history
  • Type-safe queries: db.select().from(users).where(eq(users.email, email)) — full TypeScript inference
  • Relations: define with relations() helper — one() and many() for relational queries with db.query
  • Prepared statements: db.select().from(users).where(eq(users.id, sql.placeholder("id"))).prepare() — reuse for hot paths
  • Transactions: db.transaction(async (tx) => { ... }) — use tx not db inside the callback
  • Indexes: define inline with .index() or in table config — add on columns used in where and orderBy
  • Drizzle Studio: npx drizzle-kit studio for visual database browser during development

Patterns

// schema.ts
import { pgTable, text, timestamp, uuid, integer } from "drizzle-orm/pg-core";
import { relations } from "drizzle-orm";

export const users = pgTable("users", {
  id: uuid("id").primaryKey().defaultRandom(),
  name: text("name").notNull(),
  email: text("email").notNull().unique(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
});

export const posts = pgTable("posts", {
  id: uuid("id").primaryKey().defaultRandom(),
  title: text("title").notNull(),
  authorId: uuid("author_id").references(() => users.id).notNull(),
});

export const usersRelations = relations(users, ({ many }) => ({
  posts: many(posts),
}));

export const postsRelations = relations(posts, ({ one }) => ({
  author: one(users, { fields: [posts.authorId], references: [users.id] }),
}));

// Query with relations
const result = await db.query.users.findFirst({
  where: eq(users.id, userId),
  with: { posts: true },
});

Avoid

  • drizzle-kit push in production — use generate + migrate for tracked migrations
  • Raw SQL when Drizzle API covers it — use sql template tag only for complex expressions
  • Forgetting relations() definitions — without them, db.query relational queries won't work
  • N+1 queries — use with in db.query to join relations in a single query
  • Missing indexes on foreign keys and filtered columns — Drizzle doesn't auto-create them

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Tool-use patterns, multi-step reasoning, agent orchestration, and structured outputs.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Web analytics integration — event tracking, custom dashboards, privacy-first.

YepAPI/skills

Framer Motion — transitions, scroll animations, layout animations.

YepAPI/skills

OpenAPI 3.1 from Zod schemas, interactive docs with Swagger/Scalar, versioning, and example requests for every endpoint.

YepAPI/skills

Authentication security — bcrypt/argon2 hashing, brute force protection, secure password resets.

YepAPI/skills

Session auth, social providers, CSRF protection, and secure cookie patterns.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Link building research and backlink audit using YepAPI.

YepAPI/skills

MDX blog setup, RSS feed generation, sitemap.xml, structured data/JSON-LD, and related posts.

YepAPI/skills

Redis caching, CDN cache headers, stale-while-revalidate, cache invalidation, React Query.

YepAPI/skills

Recharts/Chart.js data visualization — bar, line, area, pie charts.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

Skills associés