hieudoanm/hieudoanm.github.io/drizzle
Claude Code and agent skill by hieudoanm/hieudoanm.github.io
- community
Checking that the SKILL.md file is still in the repository.
Best practices for building database layers with Drizzle ORM (TypeScript). Use when creating, structuring, or reviewing a Drizzle schema, migrations, or queries — covers schema/relations, drizzle-kit workflow, relational queries, raw SQL, transactions, and testing.
Install
npx vskill@latest install hieudoanm/hieudoanm.github.io/drizzleSKILL.md
The same SKILL.md was published earlier as hieudoanm/hieudoanm.github.io/drizzle.
Drizzle ORM Best Practices
Drizzle is a "headless" TypeScript ORM: schema is _code_ (drizzle.ts), the client is lightweight, and it stays close to SQL — type-safety without hiding the query. Best practice here is about treating the schema module as the single source of truth, using drizzle-kit for migrations, and knowing when the SQL-adjacent power (tagged sql\\``, relational queries, prepared statements) should be used instead of emulating a framework ORM.
When to use
Use when creating, structuring, or reviewing a Drizzle schema, migrations, or queries.
Prerequisites
- Basic familiarity with TypeScript and the project conventions.
- For implementation, access to the relevant source code and development environment.
Scope boundary
- When the project does not use this technology or pattern, or the task falls outside its scope; follow the project’s existing stack and conventions.
Essential checks
- Schema-as-code discipline — the TS module _is_ the schema; migrate from it, never scissors-edit the DB directly
- Choose based on the query shape — relational queries for nested reads, select builder for flat lists, sql\\`` for anything SQL-shaped; don't force one style
- Stay close to the DB — Drizzle earns its value when you let the SQL show; if you want a framework hiding SQL, pick Prisma; if you want SQL with safety rails, Drizzle + tagged sql is the sweet spot
- Repository boundaries — keep schema.ts + queries behind a data module so models don't cross layers untranslated; map driver errors at this seam
- Prepared statements and indexes on hot paths — Drizzle gives you the control, so use it where it counts (see §4–5)
- [ ] Schema as a typed module (pg-core/mysql-core/sqlite-core/d1), $inferSelect/$inferInsert types exported
- [ ] Relations declared bidirectionally for db.query relational reads
- [ ] FKs with onDelete behaviour in the schema
Focus areas
- 1. Setup & Schema as Code
- 2. Relations & Type Safety
- 3. Drizzle-Kit Workflow (Migrations)
- 4. Querying
- 5. Prepared Statements & Performance
- 6. Transactions & Batchs
- 7. Errors & Edge Cases
- 8. Seeding & Testing
Detailed references
Related materials
Security
- Security scanPassed, 100 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 repositoryChecking.skills/programming/languages/typescript/orm/drizzle/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
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/hieudoanm/hieudoanm.github.io/drizzle)