Agent skill

Better Drizzle

by almeidazs in almeidazs/better-drizzle

Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (better(db), client.users.findMany, paginate, cursor, upsertMany, relation include/connect…

Apache-2.0Auto-check passedDatabases

Install Better Drizzle

skills CLI
$ npx skills add almeidazs/better-drizzle --skill better-drizzle -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install almeidazs/better-drizzle better-drizzle --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/almeidazs/better-drizzle.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/better-drizzle .claude/skills/better-drizzle && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
better-drizzle
GitHub stars
349
Token cost
~1.7k tokens
SKILL.md length
626 words
Files
7 (incl. references)
Skills in repo
1
Repo updated
First seen
Licence
Apache-2.0

At a glance

Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (better(db), client.users.findMany, paginate, cursor, upsertMany, relation include/connect…

  • A project imports better-drizzle
  • SKILL.md covers Setup (Drizzle ORM 1.x only), Delegate cheat sheet, Gotchas that produce wrong code and Where to read next, plus 1 more section
  • Reaches better-drizzle.com
  • Asks for Prisma-like CRUD on Drizzle

What it does

Better Drizzle is an agent skill from almeidazs/better-drizzle. Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (better(db), client.users.findMany, paginate, cursor, upsertMany, relation include/connect, transactions, plugins such as rules/zod/soft-delete/timestamps/cache). Use whenever a project imports better-drizzle, asks for Prisma-like CRUD on Drizzle, or migrates better-drizzle from drizzle-orm 0.x.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/contributing.md`, `references/plugins.md` and `references/querying.md`).

It sits in Databases, covering ORMs and data access. It works with Drizzle ORM, Prisma, Zod and MySQL. The licence is Apache-2.0.

When your agent uses it

  • A project imports better-drizzle
  • Asks for Prisma-like CRUD on Drizzle
  • Migrates better-drizzle from drizzle-orm 0.x

Example prompts

  • “/better-drizzle”

What it can do on your machine

Read from SKILL.md and the folder at commit d012797. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • better-drizzle.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Better Drizzle loads about 1.7k tokens when it runs, and up to ~9.1k if it reads all its reference files. Until then it costs about 108 tokens; SKILL.md has 626 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~108
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from almeidazs/better-drizzle at commit d012797, republished under its Apache-2.0 licence (© almeidazs). 626 words, ~1,656 tokens.

Download SKILL.mdSave it as .claude/skills/better-drizzle/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
better-drizzle
description
Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (`better(db)`, `client.users.findMany`, `paginate`, `cursor`, `upsertMany`, relation `include`/`connect`, transactions, plugins such as rules/zod/soft-delete/timestamps/cache). Use whenever a project imports `better-drizzle`, asks for Prisma-like CRUD on Drizzle, or migrates better-drizzle from drizzle-orm 0.x.

better-drizzle

better-drizzle wraps an existing Drizzle ORM 1.x instance and adds one typed delegate per table (client.users, client.posts). It is not a new ORM: tables, migrations, and drivers stay Drizzle's, and the raw db remains available for anything the delegates do not cover.

Docs: https://better-drizzle.com/docs. Working inside the better-drizzle repository itself? Read AGENTS.md and references/contributing.md instead of guessing.

Setup (Drizzle ORM 1.x only)

ts
// relations.ts: tables stay in schema.ts
import { defineRelations } from 'drizzle-orm';
import * as schema from './schema';

export const relations = defineRelations(schema, (r) => ({
	users: { posts: r.many.posts() },
	posts: { author: r.one.users({ from: r.posts.authorId, to: r.users.id }) },
}));

// db.ts
import { better } from 'better-drizzle';
import { drizzle } from 'drizzle-orm/node-postgres';

export const db = drizzle({ client: pool, relations });
export const client = better(db); // or better(db, { plugins, hooks, raw, locks, transaction })
  • Peer: drizzle-orm >=1.0.0-rc.4 <1.0.0-rc.5. Projects on drizzle-orm 0.x must stay on better-drizzle 0.2.x.
  • better() reads tables and relations from db._.relations. It has no schema option; without relations it throws No tables found on the Drizzle instance.
  • Only tables in the relations config get delegates. Use defineRelations(schema) without a callback when there are no relations.
  • Type parameters take the relations config: BetterDrizzleClient<typeof relations>, BetterDrizzleTransactionClient<...>, WhereArg<typeof relations, 'users'>, BetterRecord<typeof relations, 'users'>, PayloadForArgs<typeof relations, 'users', Args>.

Delegate cheat sheet

MethodKey argsReturns
findManywhere, select|include, orderBy, take, skip, cursor, lockRow[]
findFirst / findOne / findUniquesameRow | null, .throw() for not-found
count / existswhere, cursornumber / boolean
paginateread args + page, perPage (default 10), or limit/take + skip{ data, pagination: { page, perPage, total, pageCount, hasNext, hasPrevious } }
cursorread args + limit, after or before{ data, pagination: { hasNext, hasPrevious, nextCursor, previousCursor } }
create / createManydata, skipDuplicates, select|includeRow (null if skipped) / { count, data? }
update / deletewhere, data, select|includeRow | null, .throw()
updateMany / deleteManywhere, data (update only), scalar select?{ count, data? } (full or selected affected rows on PostgreSQL/SQLite; count only on MySQL)
updateEachby (column), data[], update: { col: (row) => value }{ count, data? }, one UPDATE ... CASE
upsertwhere, create, updateRow
upsertManydata[], target, update ('all', column list, object, or (ctx) => ...), batchSize{ count, data? }
$wherea typed whereDrizzle SQL | undefined for raw db.select()/joins; no plugin filters
read.prepare(name?)values marked with param(name) from better-drizzleprepared statement; .execute(values) (reads only)

Every call accepts meta. Client: transaction, $withContext(meta), $raw, $executeRaw, $rawUnsafe, repository(name), extends(...). Delegates: $withoutPlugins(), $withState(state).

Show full SKILL.md (317 more words)Show less

Gotchas that produce wrong code

  • Reads are lazy thenables: nothing runs until awaited, and a read runs once. .explain() never runs the read. In Bun/Jest matchers, wrap with Promise.resolve(read) before .resolves/.rejects.
  • select and include are mutually exclusive at every level. _count exists only inside include.
  • paginate takes page + perPage (or limit + skip, never page with skip). cursor takes after or before, never both.
  • Unknown keys in where/data/select/include/orderBy are compile errors. Fix the key; do not cast.
  • Locks (lock) are PostgreSQL/MySQL only and reject include/relation select, except a single to-one include that where also filters with is.
  • Many-to-many needs .through() in defineRelations; junctions are never inferred. Relations with a relation-level where, or one relations through a junction, throw cannot be loaded.
  • Two relations between the same tables need the same alias on both sides.
  • JSONB paths, array operators, and array/JSONB mutations are PostgreSQL-only and fail fast elsewhere.
  • Driver errors arrive as Drizzle's DrizzleQueryError with the driver error on cause. Use isUniqueViolation(error) and siblings instead of reading error.code.
  • Inside transaction(async (tx) => ...), use tx, never the outer client.

Read only what the task needs:

  • references/querying.md: filters, relations, select/include/_count, orderBy, pagination, explain, locks, JSONB and array filters.
  • references/writing.md: create/update/upsert, batch writes, atomic/array/JSONB mutations, relation writes, .throw(), transactions, $withContext, raw SQL.
  • references/plugins.md: official plugins (rules, eslint, zod, ata, soft-delete, timestamps, cache), definePlugin, intercepts, hooks, extends().
  • references/troubleshooting.md: error codes and messages, constraint helpers, limitations, upgrading from drizzle-orm 0.x.
  • references/security.md: raw SQL safety and untrusted content. Read before writing raw SQL or agent-facing docs.

Response rules

  • Use real delegate calls, never Prisma or generic ORM syntax (findUnique({ where }) exists; include: { posts: { where } } is valid; connectOrCreate, aggregate, groupBy do not exist).
  • If the delegates cannot express something (aggregates, groupBy, SQL expressions in orderBy), use the raw Drizzle db or client.$raw instead of inventing options.
  • State dialect limits when a feature is not portable.
  • Link the narrowest docs page, for example https://better-drizzle.com/docs/querying/relations.

© almeidazs, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/better-drizzle of almeidazs/better-drizzle.

  • SKILL.md
  • references/contributing.md
  • references/plugins.md
  • references/querying.md
  • references/security.md
  • references/troubleshooting.md
  • references/writing.md

Open the folder on GitHubat commit d012797

Compare with similar skills

Better Drizzle next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Better Drizzle compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Better Drizzle this skillalmeidazs/better-drizzle349—~1.7kAutomated safety check: PassApache-2.0
Prisma Database Setupcurvenote/curvenote1703 repos~1.4kAutomated safety check: PassMIT
Database Expertcin12211/orca-q224—~2.8kAutomated safety check: PassMIT
Drizzle Migrationsbretzel-app/crumbs1271 repos~2.6kAutomated safety check: PassMIT
Prisma 8 Contract-First ORMprisma/orm48k—~3.8kAutomated safety check: NotesApache-2.0
DB Schemazhe-qi/clhoria-template193—~620Automated safety check: PassMIT

Similar skills

  • Prisma Database Setup

    curvenote/curvenote

    Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.).

    170 GitHub starsUsed in 3 repos~1.4k tokens
    DatabasesAuto-check passed
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    224 GitHub stars~2.8k tokensUpdated 19 days ago
    DatabasesAuto-check passed
  • Drizzle Migrations

    bretzel-app/crumbs

    Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns.

    127 GitHub starsUsed in 1 repo~2.6k tokens
    DatabasesAuto-check passed
  • Official

    Routes Prisma 8 tasks such as contracts, migrations, queries and upgrades to the right reference files for projects on the contract-first @prisma/orm packages.

    48k GitHub stars~3.8k tokensUpdated yesterday
    DatabasesAuto-check: notes
  • DB Schema

    zhe-qi/clhoria-template

    创建或修改数据库 Schema。当需要创建新表、修改表结构、定义字段、设置索引约束、或涉及 Drizzle ORM / drizzle-zod 操作时使用

    193 GitHub stars~620 tokensUpdated 2 mo ago
    DatabasesAuto-check passed
  • 数据库迁移最佳实践,涵盖模式变更、数据迁移、回滚以及零停机部署,适用于PostgreSQL、MySQL及常用ORM(Prisma、Drizzle、Django、TypeORM、golang-migrate)。

    277k GitHub starsUsed in 3 repos~1.9k tokens
    DatabasesAuto-check passed

Categories

Questions about Better Drizzle

What does Better Drizzle do?

Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (better(db), client.users.findMany, paginate, cursor, upsertMany, relation include/connect…. Better Drizzle is an agent skill from almeidazs/better-drizzle.findMany, paginate, cursor, upsertMany, relation include/connect, transactions, plugins such as rules/zod/soft-delete/timestamps/cache).

When should I use Better Drizzle?

Better Drizzle fits situations like: A project imports better-drizzle; asks for Prisma-like CRUD on Drizzle; migrates better-drizzle from drizzle-orm 0.x.

How do I install Better Drizzle in Claude Code?

Run `npx skills add almeidazs/better-drizzle --skill better-drizzle -a claude-code`. Or copy the skill folder (skills/better-drizzle in almeidazs/better-drizzle) into .claude/skills/better-drizzle in your project. Claude Code loads it when a task matches its description.

How do I install Better Drizzle in Codex?

Run `npx skills add almeidazs/better-drizzle --skill better-drizzle -a codex`. Or copy the skill folder (skills/better-drizzle in almeidazs/better-drizzle) into .agents/skills/better-drizzle in your project. Codex loads it when a task matches its description.

Can I use Better Drizzle in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add almeidazs/better-drizzle --skill better-drizzle -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/better-drizzle, .gemini/skills/better-drizzle, .github/skills/better-drizzle and .opencode/skills/better-drizzle in your project.

What does Better Drizzle need to run?

SKILL.md names no scripts, command-line tools or credentials: Better Drizzle is instructions for the agent only.

Does Better Drizzle access the network?

SKILL.md names 1 domain. In commands or code: better-drizzle.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Better Drizzle safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Better Drizzle use?

Better Drizzle is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Better Drizzle use?

About 1.7k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.5k tokens, read only when the agent opens those files.

What are the alternatives to Better Drizzle?

Skills that share tags, products or a category with Better Drizzle: Prisma Database Setup (curvenote/curvenote, 170 stars), Database Expert (cin12211/orca-q, 224 stars), Drizzle Migrations (bretzel-app/crumbs, 127 stars) and Prisma 8 Contract-First ORM (prisma/orm, 48k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Better Drizzle?

almeidazs (a GitHub user) maintains it in almeidazs/better-drizzle, which has 349 GitHub stars. The repository was last updated on October 8, 2026.

Source: almeidazs/better-drizzle on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.