Drizzle
kurealnum/dotfiles
Drizzle ORM schema and database guide. An agent skill from kurealnum/dotfiles.
Drizzle ORM v1 关系查询指南。当需要定义 Relations v2、编写关系查询、使用 through 多对多、预定义过滤器、或从旧版 Drizzle 迁移时使用
$ npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install zhe-qi/clhoria-template drizzle-v1 --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/drizzle-v1 .claude/skills/drizzle-v1 && rm -rf skills-srcUse ~/.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/
Install the "drizzle-v1" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/drizzle-v1 into .claude/skills/drizzle-v1/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "drizzle-v1", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/drizzle-v1Type this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install zhe-qi/clhoria-template drizzle-v1 --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/drizzle-v1 .agents/skills/drizzle-v1 && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "drizzle-v1" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/drizzle-v1 into .agents/skills/drizzle-v1/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "drizzle-v1", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install zhe-qi/clhoria-template drizzle-v1 --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/drizzle-v1 .cursor/skills/drizzle-v1 && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "drizzle-v1" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/drizzle-v1 into .cursor/skills/drizzle-v1/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "drizzle-v1", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/zhe-qi/clhoria-template.git --path .agents/skills/drizzle-v1--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install zhe-qi/clhoria-template drizzle-v1 --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/drizzle-v1 .gemini/skills/drizzle-v1 && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "drizzle-v1" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/drizzle-v1 into .gemini/skills/drizzle-v1/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "drizzle-v1", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install zhe-qi/clhoria-template drizzle-v1Installs for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/drizzle-v1 .github/skills/drizzle-v1 && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "drizzle-v1" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/drizzle-v1 into .github/skills/drizzle-v1/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "drizzle-v1", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install zhe-qi/clhoria-template drizzle-v1 --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/drizzle-v1 .opencode/skills/drizzle-v1 && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "drizzle-v1" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/drizzle-v1 into .opencode/skills/drizzle-v1/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "drizzle-v1", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
drizzle-v1Drizzle ORM v1 关系查询指南。当需要定义 Relations v2、编写关系查询、使用 through 多对多、预定义过滤器、或从旧版 Drizzle 迁移时使用
Drizzle V1 is an agent skill from zhe-qi/clhoria-template. Drizzle ORM v1 关系查询指南。当需要定义 Relations v2、编写关系查询、使用 through 多对多、预定义过滤器、或从旧版 Drizzle 迁移时使用
Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Databases, covering ORMs and data access. It works with Drizzle ORM. The repository describes itself as: Production-ready Hono backend template that doubles as an AI agent harness — providing feedforward guides, feedback sensors, and progressive specialization to make AI coding… The licence is MIT.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 589f13e. It shows what the files ask for, not the result of running them.
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.
Shell commands in SKILL.md call:
pnpmFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
orm.drizzle.teamFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Drizzle V1 loads about 3k tokens when it runs. Until then it costs about 25 tokens; SKILL.md has 333 words of instructions outside code blocks.
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.
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.
The full file from zhe-qi/clhoria-template at commit 589f13e, republished under its MIT licence (© zhe-qi). 333 words, ~3,050 tokens.
.claude/skills/drizzle-v1/SKILL.md (or your agent's skills folder).drizzle-orm@1.0.0-beta.21(已进入 RC 阶段)传入 relations 而非 schema:
import { drizzle } from "drizzle-orm/postgres-js";
import { relations } from "./relations";
const db = drizzle({
client: getQueryClient(),
relations,
casing: "snake_case",
});使用 defineRelations 在一处定义所有关系:
// src/db/relations/index.ts
import { defineRelations } from "drizzle-orm";
import * as schema from "@/db/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,
}),
},
}));本项目使用 defineRelationsPart + spread 方式拆分关系定义:
// src/db/relations/index.ts
import { defineRelations } from "drizzle-orm";
import * as schema from "@/db/schema";
import { userRolesRelations } from "./admin/user-roles";
export const relations = defineRelations(schema, (r) => ({
...userRolesRelations(r),
}));// src/db/relations/admin/user-roles.ts
import type { ExtractTablesFromSchema, RelationsBuilder } from "drizzle-orm";
import type * as schema from "@/db/schema";
type Schema = ExtractTablesFromSchema<typeof schema>;
export const userRolesRelations = (r: RelationsBuilder<Schema>) => ({
systemUsers: {
roles: r.many.systemRoles({
from: r.systemUsers.id.through(r.systemUserRoles.userId),
to: r.systemRoles.id.through(r.systemUserRoles.roleId),
}),
enabledRoles: r.many.systemRoles({
from: r.systemUsers.id.through(r.systemUserRoles.userId),
to: r.systemRoles.id.through(r.systemUserRoles.roleId),
where: { status: Status.ENABLED },
}),
},
systemRoles: {
users: r.many.systemUsers(),
},
});关键模式:
ExtractTablesFromSchema<typeof schema> + RelationsBuilder<Schema>defineRelations 中src/db/relations/{tier}/{feature}.ts 组织文件// one: 指定 from → to 映射
posts: {
author: r.one.users({
from: r.posts.authorId,
to: r.users.id,
}),
},
// many: 可以只定义 many 侧(无需在对端定义 one)
users: {
posts: r.many.posts({
from: r.users.id,
to: r.posts.authorId,
}),
},使用 .through() 指定连接表,无需手动查询连接表再映射:
users: {
groups: r.many.groups({
from: r.users.id.through(r.usersToGroups.userId),
to: r.groups.id.through(r.usersToGroups.groupId),
}),
},
groups: {
participants: r.many.users(), // 反向可省略 from/to
},在关系定义中预设过滤条件,查询时直接使用:
systemUsers: {
enabledRoles: r.many.systemRoles({
from: r.systemUsers.id.through(r.systemUserRoles.userId),
to: r.systemRoles.id.through(r.systemUserRoles.roleId),
where: { status: Status.ENABLED },
}),
},optional: false 使关系成为必填(TypeScript 类型非 nullable):
posts: {
author: r.one.users({
from: r.posts.authorId,
to: r.users.id,
optional: false, // author 不会是 null
}),
},自引用或同表多关系时使用 alias 区分:
posts: {
author: r.one.users({
from: r.posts.authorId,
to: r.users.id,
alias: "author_post",
}),
reviewer: r.one.users({
from: r.posts.reviewerId,
to: r.users.id,
alias: "reviewer_post",
}),
},// 简单等值
db.query.users.findFirst({
where: { id: userId },
});
// 多条件(AND)
db.query.users.findMany({
where: { status: Status.ENABLED, username: "admin" },
});
// 操作符
db.query.users.findMany({
where: {
id: { gt: 10 },
name: { like: "M%" },
},
});
// 按关系过滤(v1 新增!)
db.query.users.findMany({
where: {
id: { gt: 10 },
posts: {
content: { like: "M%" },
},
},
});
// 关系存在性过滤:获取至少有 1 篇 post 的用户
db.query.users.findMany({
with: { posts: true },
where: { posts: true },
});where: {
// 逻辑组合
OR: [], // 或
AND: [], // 与
NOT: {}, // 非
// RAW SQL
RAW: (table) => sql`${table.id} = 1`,
// 按关系过滤
[relation]: {}, // 如 posts: { content: { like: "M%" } }
// 列操作符
[column]: {
eq: 1, // =
ne: 1, // !=
gt: 1, // >
gte: 1, // >=
lt: 1, // <
lte: 1, // <=
in: [1, 2], // IN
notIn: [1, 2], // NOT IN
like: "M%", // LIKE
ilike: "m%", // ILIKE(不区分大小写)
notLike: "M%", // NOT LIKE
notIlike: "m%", // NOT ILIKE
isNull: true, // IS NULL
isNotNull: true, // IS NOT NULL
arrayOverlaps: [1, 2], // 数组重叠
arrayContained: [1, 2], // 数组被包含
arrayContains: [1, 2], // 数组包含
// 列级逻辑组合
OR: [],
AND: [],
NOT: {},
},
}db.query.users.findMany({
orderBy: { id: "asc" },
});
// 多字段排序
db.query.users.findMany({
orderBy: { createdAt: "desc", name: "asc" },
});
// 自定义 SQL 排序
db.query.posts.findMany({
orderBy: (t) => sql`${t.id} asc`,
});
// 关系内排序
db.query.posts.findMany({
orderBy: { id: "asc" },
with: {
comments: {
orderBy: { id: "desc" },
},
},
});// 加载全部列
db.query.users.findFirst({
where: { id: userId },
with: { roles: true },
});
// 选择部分列
db.query.users.findFirst({
where: { id: userId },
with: {
roles: {
columns: { id: true, name: true },
},
},
});
// 预定义过滤关系
db.query.users.findFirst({
where: { id: userId },
with: { enabledRoles: { columns: { id: true } } },
});db.query.users.findFirst({
where: { id: userId },
columns: { id: true, username: true, avatar: true },
});// v1 新增:关系内也支持 offset
db.query.posts.findMany({
limit: 5,
offset: 2,
with: {
comments: {
offset: 3,
limit: 3,
},
},
});在查询中添加自定义 SQL 计算字段:
import { sql } from "drizzle-orm";
// 简单 extras
db.query.users.findMany({
extras: {
loweredName: sql`lower(${users.name})`,
},
});
// 回调语法
db.query.users.findMany({
extras: {
loweredName: (users, { sql }) => sql`lower(${users.name})`,
},
});
// 嵌套关系中也支持 extras
db.query.posts.findMany({
extras: {
contentLength: (table, { sql }) => sql<number>`length(${table.content})`,
},
with: {
comments: {
extras: {
commentSize: (table, { sql }) => sql<number>`length(${table.content})`,
},
},
},
});注意:extras 目前不支持聚合函数,需要聚合请使用 core queries。
import { posts } from "./schema";
import { eq } from "drizzle-orm";
// 获取用户及其 post 总数
db.query.users.findMany({
with: { posts: true },
extras: {
totalPostsCount: (table) => db.$count(posts, eq(posts.authorId, table.id)),
},
});使用 placeholder 提升重复查询性能:
import { sql } from "drizzle-orm";
// where 中使用 placeholder
const prepared = db.query.users.findMany({
where: { id: { eq: sql.placeholder("id") } },
with: {
posts: {
where: { id: 1 },
},
},
}).prepare("query_name");
const result = await prepared.execute({ id: 1 });
// limit/offset 中使用 placeholder
const prepared2 = db.query.users.findMany({
limit: sql.placeholder("uLimit"),
offset: sql.placeholder("uOffset"),
where: {
OR: [{ id: { eq: sql.placeholder("id") } }, { id: 3 }],
},
with: {
posts: {
where: { id: { eq: sql.placeholder("pid") } },
limit: sql.placeholder("pLimit"),
},
},
}).prepare("query_name");
const result2 = await prepared2.execute({
pLimit: 1, uLimit: 3, uOffset: 1, id: 2, pid: 6,
});使用 defineRelationsPart 拆分关系定义时的重要规则:
规则 1:spread 时主 relations 必须在前:
// ✅ 正确
const db = drizzle(url, { relations: { ...relations, ...part } })
// ❌ 错误
const db = drizzle(url, { relations: { ...part, ...relations } })规则 2:必须有一个 main relations(使用 defineRelations),让 drizzle 能推断所有表。如果只想用 parts,可以创建一个空的 main:
export const mainPart = defineRelationsPart(schema); // 空 main,用于推断所有表// 旧版:必须嵌套查询连接表再映射
const response = await db.query.users.findMany({
with: {
usersToGroups: {
columns: {},
with: { group: true },
},
},
});
// 还需要手动 map: response.map(u => ({ ...u, groups: u.usersToGroups.map(utg => utg.group) }))// 新版:直接查多对多,无需映射
const response = await db.query.users.findMany({
with: { groups: true },
});src/db/relations/{tier}/{feature}.tssrc/db/relations/index.ts 注册:spread 到 defineRelations 中// 1. src/db/relations/{tier}/{feature}.ts
import type { ExtractTablesFromSchema, RelationsBuilder } from "drizzle-orm";
import type * as schema from "@/db/schema";
type Schema = ExtractTablesFromSchema<typeof schema>;
export const {feature}Relations = (r: RelationsBuilder<Schema>) => ({
{parentTable}: {
{relName}: r.many.{childTable}({
from: r.{parentTable}.id,
to: r.{childTable}.{parentTable}Id,
}),
},
{childTable}: {
{parentRef}: r.one.{parentTable}({
from: r.{childTable}.{parentTable}Id,
to: r.{parentTable}.id,
}),
},
});
// 2. src/db/relations/index.ts
import { {feature}Relations } from "./{tier}/{feature}";
export const relations = defineRelations(schema, (r) => ({
...userRolesRelations(r),
...{feature}Relations(r), // 新增
}));注意:同一个表的关系在多个 part 中定义时,后 spread 的会覆盖前面同名的 key。确保不同 part 中同一表的关系 key 名不冲突,或在 index.ts 中手动合并。
| v1 旧版 | v1 新版 (Relations v2) |
|---|---|
import { relations } from "drizzle-orm" | import { relations } from "drizzle-orm/_relations" ← 旧版移到这 |
fields: [posts.authorId] | from: r.posts.authorId |
references: [users.id] | to: r.users.id |
relationName: "xxx" | alias: "xxx" |
每表单独 relations() | 统一 defineRelations() |
db.query.xxx (旧语法) | db._query.xxx (可继续用旧语法) |
where: (t, { eq }) => eq(t.id, 1) | where: { id: 1 } |
orderBy: (t, { asc }) => [asc(t.id)] | orderBy: { id: "asc" } |
drizzle(url, { schema }) | drizzle(url, { relations }) |
MySQL mode: "planetscale" | 不再需要 mode |
如果需要逐步迁移而非一次性切换:
import { relations } from "drizzle-orm" 改为 import { relations } from "drizzle-orm/_relations"db._query.xxx 替代 db.query.xxxdb.query.xxx(新语法)pnpm drizzle-kit pull会在 drizzle/relations.ts 生成新语法的关系定义,可直接复制到项目的 src/db/relations/ 中使用。注意修改导入路径。
defineRelations (v2) 和旧版 relations() (v1) 不兼容from: r.posts.authorId,多列时才用数组 from: [r.posts.a, r.posts.b]r.usersToGroups.userId 前提是 usersToGroups 表已导出where 子句只能包含 to 端表的列.as() 别名:drizzle 会忽略 extras 字段上的 .as("<alias>")pnpm drizzle-kit up:更新 migrations 文件夹结构(移除 journal.json,按文件夹分组)drizzle-zod → drizzle-orm/zoddrizzle-valibot → drizzle-orm/valibotdrizzle-typebox → drizzle-orm/typeboxdrizzle-arktype → drizzle-orm/arktype© zhe-qi, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/drizzle-v1 of zhe-qi/clhoria-template.
Open the folder on GitHubat commit 589f13e
Drizzle V1 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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Drizzle V1 this skillzhe-qi/clhoria-template | 193 | — | ~3k | Automated safety check: Pass | MIT | |
| Drizzlekurealnum/dotfiles | 290 | — | ~1.3k | Automated safety check: Pass | None | |
| Drizzle Migration Safety on Neonsuperset-sh/superset | 15k | — | ~2k | Automated safety check: Notes | Custom licence | |
| Better Drizzlealmeidazs/better-drizzle | 349 | — | ~1.7k | Automated safety check: Pass | Apache-2.0 | |
| Drizzle Erdhiroppy/mf-dashboard | 418 | — | ~627 | Automated safety check: Pass | MIT | |
| Drizzle Migrationsbretzel-app/crumbs | 127 | 1 repos | ~2.6k | Automated safety check: Pass | MIT |
kurealnum/dotfiles
Drizzle ORM schema and database guide. An agent skill from kurealnum/dotfiles.
superset-sh/superset
Generates a Drizzle migration on a fresh Neon branch and runs a production-safety checklist for table sizes, lock order and load rehearsal before the PR opens.
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…
hiroppy/mf-dashboard
A skill your agent uses when needing to visualize database schema, generate ERD diagrams from Drizzle ORM schemas, or understand table relationships
bretzel-app/crumbs
Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns.
giuseppe-trisciuoglio/developer-kit
Generates complete CRUD modules for NestJS applications with Drizzle ORM.
zhe-qi/clhoria-template
Effect v4 模式指南。当需要创建 Effect 服务、定义错误类型、编写 Effect 程序、管理 Layer 组合、或使用 Effect 封装异步操作时使用
zhe-qi/clhoria-template
创建或修改 BullMQ 队列任务。当需要创建新队列、添加任务类型、注册 Worker、设置定时任务、或用户请求"添加后台任务/队列处理"时使用
zhe-qi/clhoria-template
创建或修改一个新的 API tier。当用户请求“新增 tier / 创建 partner tier / 新增 merchant 端 / 新增 tenant 端 / 新增 API 端 / 新增一套路由层”时使用。目标是在不修改框架核心的前提下,为新 tier 补齐配置、中间件、类型别名、路由入口和测试。
zhe-qi/clhoria-template
创建或修改 CRUD 模块。当需要创建新的增删改查 API、修改现有路由模块、添加新字段、新增接口、或用户请求"创建/修改 XX 管理"时使用
zhe-qi/clhoria-template
创建或修改数据库 Schema。当需要创建新表、修改表结构、定义字段、设置索引约束、或涉及 Drizzle ORM / drizzle-zod 操作时使用
zhe-qi/clhoria-template
Enter explore mode - think through ideas, investigate problems, clarify requirements
Works with
Categories
Drizzle ORM v1 关系查询指南。当需要定义 Relations v2、编写关系查询、使用 through 多对多、预定义过滤器、或从旧版 Drizzle 迁移时使用. Drizzle V1 is an agent skill from zhe-qi/clhoria-template.
Drizzle V1 fits situations like: tasks that involve ORMs and data access.
Run `npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a claude-code`. Or copy the skill folder (.agents/skills/drizzle-v1 in zhe-qi/clhoria-template) into .claude/skills/drizzle-v1 in your project. Claude Code loads it when a task matches its description.
Run `npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a codex`. Or copy the skill folder (.agents/skills/drizzle-v1 in zhe-qi/clhoria-template) into .agents/skills/drizzle-v1 in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zhe-qi/clhoria-template --skill drizzle-v1 -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/drizzle-v1, .gemini/skills/drizzle-v1, .github/skills/drizzle-v1 and .opencode/skills/drizzle-v1 in your project.
Going by SKILL.md and its folder, Drizzle V1 needs the command-line tools its instructions call (pnpm).
SKILL.md names 1 domain. As links in the text: orm.drizzle.team. This is read from the text; nothing was executed.
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.
Drizzle V1 is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Drizzle V1: Drizzle (kurealnum/dotfiles, 290 stars), Drizzle Migration Safety on Neon (superset-sh/superset, 15k stars), Better Drizzle (almeidazs/better-drizzle, 349 stars) and Drizzle Erd (hiroppy/mf-dashboard, 418 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
zhe-qi (a GitHub user) maintains it in zhe-qi/clhoria-template, which has 193 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on July 30, 2026.
Source: zhe-qi/clhoria-template on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.