drizzle-sqlite
БесплатноБез исполняемых скриптовНе проверенDrizzle ORM targeting SQLite (better-sqlite3, libsql/Turso, bun:sqlite, Cloudflare D1, expo-sqlite, op-sqlite). Covers schema definition (column modes…
от pproenca★ 231 звезда на GitHubОб этом скилле
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
sqliteTableschemas — 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()ordb.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, orNULL— Drizzle column modes encode the rest. - Limited
ALTER TABLE. OnlyRENAME COLUMN,ADD COLUMN,DROP COLUMN. Type changes and constraint additions need a table rebuild. - Foreign keys off by default.
PRAGMA foreign_keys = ONis 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
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Schema Definition | CRITICAL | schema- |
| 2 | Migrations & Drizzle Kit | CRITICAL | migrate- |
| 3 | Query Building | HIGH | query- |
| 4 | Relations | HIGH | rel- |
| 5 | Transactions & Batching | MEDIUM-HIGH | tx- |
| 6 | Prepared Statements & Hot Paths | MEDIUM-HIGH | perf- |
| 7 | Connection & Driver Setup | MEDIUM | conn- |
| 8 | Type Inference | MEDIUM | types- |
Quick Reference
1. Schema Definition (CRITICAL)
schema-integer-for-booleans— Useinteger({ mode: 'boolean' })so the inferred type isboolean, not0 | 1schema-timestamp-mode-for-dates— Store dates asinteger({ mode: 'timestamp_ms' }), not textschema-always-primary-key— Declare an explicit PK (single or composite); don't rely on hidden rowidschema-foreign-keys-with-actions— SpecifyonDelete/onUpdateon every.references()schema-index-foreign-keys-and-lookups— Index FK columns and frequentWHEREs — SQLite does not auto-index FKsschema-text-json-not-blob-json— Usetext({ mode: 'json' })sojson_extractand JSON-path indexes workschema-unique-constraints-for-natural-keys—.unique()for email/slug/externalId so onConflict has a target
2. Migrations & Drizzle Kit (CRITICAL)
migrate-generate-not-push-in-prod— Usegenerate + migrate;pushdrops columns it can't reconcilemigrate-explicit-renames— Answer the rename prompt — defaults treat renames as drop+addmigrate-config-dialect-and-out— Definedrizzle.config.tsso commands work without flagsmigrate-apply-with-migrator— Apply viadrizzle-kit migrateor the drivermigratormodule, not raw SQLmigrate-data-backfill-as-custom-sql— Hand-edit migration SQL to backfill atomically with the DDLmigrate-commit-migrations-to-git— Commitdrizzle/SQL anddrizzle/meta/snapshots — both are required
3. Query Building (HIGH)
query-select-columns-not-star— Project to the columns you need withdb.select({ ... })- [
query-avoid-n-plus-one-with-inarray](references/query-avoid-n-plus-o
Установить drizzle-sqlite в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл drizzle-sqlite?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл drizzle-sqlite запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic