drizzle-v1

drizzle-v1 is a skill for Claude Code from zhe-qi/clhoria-template. It costs 48 tokens per session (4,106 once invoked), scanned A, original, MIT.

A guide to using Drizzle ORM v1, a TypeScript tool for working with databases, to define and query links between tables. It covers the newer Relations Query v2 style and moving from older Drizzle versions.

In plain words
What is it for?
Use it when defining table relationships, writing related-data queries, creating many-to-many links through another table, adding reusable filters, or migrating an existing Drizzle project to v1.
Why use it?
It helps developers avoid guessing how the changed relation definitions and query APIs work. It also explains how to organize relationship definitions and handle many-to-many links.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when defining table relationships, writing related-data queries, creating many-to-many links through another table, adding reusable filters, or migrating an existing Drizzle project to v1.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zhe-qi/clhoria-template/drizzle-v1
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add zhe-qi/clhoria-template --skill drizzle-v1
Clone the repo
git clone --depth 1 https://github.com/zhe-qi/clhoria-template

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for drizzle-v1

README.md
[![agentmods](https://agentmods.dev/badge/skills/zhe-qi/clhoria-template/drizzle-v1/github.svg)](https://agentmods.dev/skills/zhe-qi/clhoria-template/drizzle-v1)
Your own site
<a href="https://agentmods.dev/skills/zhe-qi/clhoria-template/drizzle-v1"><img src="https://agentmods.dev/badge/skills/zhe-qi/clhoria-template/drizzle-v1/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for drizzle-v1

Your own site · 80×15
<a href="https://agentmods.dev/skills/zhe-qi/clhoria-template/drizzle-v1"><img src="https://agentmods.dev/badge/skills/zhe-qi/clhoria-template/drizzle-v1.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,106 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.04106
Opus 5 $0.00024 $0.02053
Sonnet 5 $0.00010 $0.00821
Haiku 4.5 $0.00005 $0.00411

Measured 12d ago against content hash 6b0d72743081, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

drizzle-v1 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/drizzle-v1/SKILL.md · 580 lines

How it starts

The opening of the file, as written. The whole thing — 580 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Drizzle ORM v1 (Relations Query v2) 指南

版本信息

  • 当前版本: [email protected](已进入 RC 阶段)
  • 官方文档: 所有 drizzle 官方文档已更新为 v1 写法
  • 关键变化: Relations 定义方式、查询 API、多对多 through 支持

核心概念

drizzle() 初始化

传入 relations 而非 schema

import { drizzle } from "drizzle-orm/postgres-js";
import { relations } from "./relations";

const db = drizzle({
  client: getQueryClient(),
  relations,
  casing: "snake_case",
});

Relations 定义

基本结构

使用 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>
  • 返回对象直接 spread 到 defineRelations
  • src/db/relations/{tier}/{feature}.ts 组织文件

Read the full file on GitHub · 580 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 580 lines · 48 tokens per session scan A 6b0d72743081

Subscribe to this mod's changes

drizzle-v1 is a skill published in the GitHub repository zhe-qi/clhoria-template (190 stars, last pushed 1mo ago), licensed MIT. It adds 48 tokens to every session and 4,106 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

no-bare-casts

Writing as in TypeScript or TSX production code, modifying a file that contains a bare as cast, silencing a type error with a cast, encountering as unknown as, or reviewing a cast site.

prisma/orm · 52 tokens

azure-resource-manager-postgresql-dotnet

Azure PostgreSQL Flexible Server SDK for .NET. Database management for PostgreSQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "PostgreSQL", "PostgreSqlFlexibleServer", "PostgreSQL Flexible Server", "Azure Database for…

microsoft/skills · 97 tokens

azure-cosmos-java

Azure Cosmos DB SDK for Java. NoSQL database operations with global distribution, multi-model support, and reactive patterns. Triggers: "CosmosClient java", "CosmosAsyncClient", "cosmos database java", "cosmosdb java", "document database java".

microsoft/skills · 59 tokens

azure-data-tables-java

Build table storage applications with Azure Tables SDK for Java. Use when working with Azure Table Storage or Cosmos DB Table API for NoSQL key-value data, schemaless storage, or structured data at scale.

microsoft/skills · 47 tokens

efcore-patterns

Entity Framework Core best practices including NoTracking by default, query splitting for navigation collections, migration management, dedicated migration services, and common pitfalls to avoid.

Aaronontheweb/dotnet-skills · 35 tokens

jpa-patterns

JPA/Hibernate patterns and common pitfalls (N+1, lazy loading, transactions, queries). Use when user has JPA performance issues, LazyInitializationException, or asks about entity relationships and fetching strategies.

decebals/claude-code-java · 47 tokens