skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
pproenca/dot-skills177 installs

drizzle-sqlite

Drizzle ORM targeting SQLite (better-sqlite3, libsql/Turso, bun:sqlite, Cloudflare D1, expo-sqlite, op-sqlite). Covers schema definition (column modes, primary keys, foreign keys, indexes), drizzle-kit migrations (generate vs push, renames, custom SQL), the query builder (selects, upserts, returning, EXPLAIN), the relational query builder (relations(), `with`, partial columns), transactions and `db.batch()`, prepared statements with `sql.placeholder()`, connection pragmas (WAL, foreign_keys, busy_timeout), and Drizzle type inference (`$inferSelect`, `$inferInsert`, `$type<>`, drizzle-zod). Use when writing, reviewing, or refactoring Drizzle code for SQLite. Trigger even if the user doesn't say "performance" — schema/migration choices made now are expensive to reverse later, and SQLite-specific traps (single-writer model, no native booleans/dates, ALTER TABLE limits, FK pragma off by default) catch teams who reach for Drizzle without reading the SQLite docs.

How do I install this agent skill?

npx skills add https://github.com/pproenca/dot-skills --skill drizzle-sqlite
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill is a comprehensive technical reference for Drizzle ORM with SQLite backends. It provides educational guidance on schema definition, migrations, query optimization, and type safety. No security risks were identified.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

dot-skills Drizzle SQLite Best Practices

Library-reference skill for Drizzle ORM with SQLite-family backends. 45 rules across 8 categories, ordered by execution-lifecycle impact: schema → migrations → query → relations → transactions → performance → connection → types.

When to Apply

Reference these guidelines when:

  • Defining sqliteTable schemas — choosing column types, primary keys, indexes, foreign keys
  • Running drizzle-kit generate / migrate / push, or hand-editing a migration SQL file
  • Writing queries with db.select(), db.insert(), db.update(), db.delete()
  • Reaching for nested data with db.query.* and the relational query builder
  • Wrapping multi-statement writes in db.transaction() or db.batch() (libsql/Turso/D1)
  • Optimizing a hot-path query with .prepare() + sql.placeholder() or covering indexes
  • Setting up the Drizzle client (pragmas, driver choice, singleton lifecycle)
  • Wiring database types into application code ($inferSelect, drizzle-zod, JSON shapes)

The skill is not specific to one driver — it covers behavior shared across better-sqlite3, libsql, bun:sqlite, expo-sqlite, op-sqlite, and Cloudflare D1, calling out driver-specific deviations where they exist.

Architectural Context

SQLite is unusual among production databases:

  • No client/server. The "connection" is a file open. There is no connection pool, no auth, no network in the local-file case.
  • Single writer. One writer at a time, no matter how many connections. Reads can be parallel under WAL.
  • No native booleans or dates. Everything is INTEGER, REAL, TEXT, BLOB, or NULL — Drizzle column modes encode the rest.
  • Limited ALTER TABLE. Only RENAME COLUMN, ADD COLUMN, DROP COLUMN. Type changes and constraint additions need a table rebuild.
  • Foreign keys off by default. PRAGMA foreign_keys = ON is per-connection and not persistent.

Many rules in this skill exist because Drizzle's API abstracts over PostgreSQL/MySQL/SQLite uniformly — but the underlying SQLite engine has constraints that show up at runtime if you treat it like Postgres.

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Schema DefinitionCRITICALschema-
2Migrations & Drizzle KitCRITICALmigrate-
3Query BuildingHIGHquery-
4RelationsHIGHrel-
5Transactions & BatchingMEDIUM-HIGHtx-
6Prepared Statements & Hot PathsMEDIUM-HIGHperf-
7Connection & Driver SetupMEDIUMconn-
8Type InferenceMEDIUMtypes-

Quick Reference

1. Schema Definition (CRITICAL)

2. Migrations & Drizzle Kit (CRITICAL)

3. Query Building (HIGH)

4. Relations (HIGH)

5. Transactions & Batching (MEDIUM-HIGH)

6. Prepared Statements & Hot Paths (MEDIUM-HIGH)

7. Connection & Driver Setup (MEDIUM)

8. Type Inference (MEDIUM)

How to Use

Read the relevant category overview in references/_sections.md, then the specific rule files for detailed explanations and code examples. Each rule has incorrect-vs-correct examples — apply the correct pattern to the code under review.

For complex changes (schema redesign, migration strategy, performance work), read all rules in the affected category before deciding.

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information

Related Skills

  • effect-ts — When the application is Effect-based; Drizzle integrates via Effect.tryPromise.
  • nextjs-bundle-optimizer — For Next.js apps reaching for SQLite as the data layer.
  • better-auth — Often paired with Drizzle SQLite for auth tables; see better-auth-scaffold for table generation.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/pproenca/dot-skills/drizzle-sqlite">View drizzle-sqlite on skillZs</a>