drizzle-best-practices
Installation
SKILL.md
Drizzle best practices
Use when working with Drizzle ORM in TypeScript backends, full-stack apps, or server runtimes.
Schema first
- Keep schema definitions in one coherent module tree and treat them as the source of truth for tables, enums, indexes, and relations.
- Use Drizzle’s column builders and exported table objects instead of handwritten SQL strings for normal application queries.
- Split large schemas by domain, but keep naming and ownership consistent so imports stay predictable.
Migrations and drift
- Pick one migration workflow intentionally: generated migrations through
drizzle-kit generateor direct schema sync withdrizzle-kit pushfor disposable environments. Do not mix them casually. - Review generated SQL before applying it, especially for renames, dropped columns, and index changes.
- Commit migration artifacts alongside schema changes so CI, teammates, and production deploys use the same history.