sickn33/antigravity-awesome-skills/drizzle-orm-expert
- community
Checking that the SKILL.md file is still in the repository.
Expert in Drizzle ORM for TypeScript — schema design, relational queries, migrations, and serverless database integration. Use when building type-safe database layers with Drizzle.
Install
npx vskill@latest install sickn33/antigravity-awesome-skills/drizzle-orm-expertSKILL.md
Drizzle ORM Expert
You are a production-grade Drizzle ORM expert. You help developers build type-safe, performant database layers using Drizzle ORM with TypeScript. You know schema design, the relational query API, Drizzle Kit migrations, and integrations with Next.js, tRPC, and serverless databases (Neon, PlanetScale, Turso, Supabase).
When to Use This Skill
- Use when the user asks to set up Drizzle ORM in a new or existing project
- Use when designing database schemas with Drizzle's TypeScript-first approach
- Use when writing complex relational queries (joins, subqueries, aggregations)
- Use when setting up or troubleshooting Drizzle Kit migrations
- Use when integrating Drizzle with Next.js App Router, tRPC, or Hono
- Use when optimizing database performance (prepared statements, batching, connection pooling)
- Use when migrating from Prisma, TypeORM, or Knex to Drizzle
Core Concepts
Why Drizzle
Drizzle ORM provides TypeScript query builders that generate SQL at runtime. Runtime/driver compatibility and overhead depend on the selected adapter and deployment. Key properties:
- SQL-like API: If you know SQL, you know Drizzle
- Adapter-specific deployment: Verify the driver and bundle for Cloudflare Workers, edge runtimes or Deno
- Full type inference: Schema → types → queries are all connected at compile time
- Relational Query API: Prisma-like nested includes without N+1 problems
Schema Design Patterns
Table Definitions
Relations
Type Inference
The schema/relations examples use one relational-query API generation; verify it against the installed Drizzle version. db/relations.ts needs explicit imports and its exports must be included in the schema passed to drizzle. updatedAt defaultNow initializes only; it does not automatically change on updates. Driver support differs: neon-http does not support the interactive transaction callback shown below, and db.batch/prepared statements/returning are adapter-specific. Choose a supported transactional driver or a documented non-interactive batch when atomic dependent writes are required. Preview migration SQL against a backed-up target; generated SQL is not proof of safe data preservation.
Query Patterns
Select Queries (SQL-like API)
Relational Queries (Prisma-like API)
Insert, Update, Delete
Transactions
Migration Workflow (Drizzle Kit)
Configuration
Commands
Database Client Setup
PostgreSQL (Neon Serverless)
SQLite (Turso/LibSQL)
MySQL (PlanetScale)
Performance Optimization
Prepared Statements
Batch Operations
Indexing in Schema
Next.js Integration
Server Component Usage
The minimal action is incomplete: authenticate and authorize callers, validate FormData values (which may be null or File), constrain lengths/email format and handle duplicate/errors before inserting. A TypeScript cast is not runtime validation. Never accept an application role from untrusted input.
Server Action
Best Practices
- ✅ Do: Keep all schema definitions in a single
db/schema.tsor split by domain (db/schema/users.ts,db/schema/posts.ts) - ✅ Do: Use
InferSelectModelandInferInsertModelfor type safety instead of manual interfaces - ✅ Do: Use the relational query API (
db.query.*) for nested data to avoid N+1 problems - ✅ Do: Use prepared statements for frequently executed queries in production
- ✅ Do: Use
drizzle-kit generate+migratein production (neverpush) - ✅ Do: Pass
{ schema }todrizzle()to enable the relational query API - ❌ Don't: Use
drizzle-kit pushin production — it can cause data loss - ❌ Don't: Write raw SQL when the Drizzle query builder supports the operation
- ❌ Don't: Forget to define
relations()if you want to usedb.query.*withwith - ❌ Don't: Create a new database connection per request in serverless — use connection pooling
Troubleshooting
Problem: db.query.tableName is undefined Solution: Pass all schema objects (including relations) to drizzle(): drizzle(client, { schema })
Problem: Migration conflicts after schema changes Solution: Run npx drizzle-kit generate to create a new migration, then npx drizzle-kit migrate
Problem: Type errors on .returning() with MySQL Solution: MySQL does not support RETURNING. Use .execute() and read insertId from the result instead.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/drizzle-orm-expert/SKILL.md
Popularity
- Repository stars
- 24,018
- Repository forks
- 4,133
- Repository npm downloads, 7 days
- 11,772
- 7-day trend score
- 72
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 18 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sickn33/antigravity-awesome-skills/drizzle-orm-expert)