d1-drizzle-schema

d1-drizzle-schema is a skill for Claude Code from jezweb/claude-skills. It costs 90 tokens per session (1,344 once invoked), scanned A, original, MIT.

A schema generator for Drizzle ORM, a TypeScript database library, targeting Cloudflare D1, Cloudflare’s hosted SQLite database. It creates database schema files, migration commands, exported types, and documentation while accounting for D1’s limits.

In plain words
What is it for?
Use it to turn a data model into D1-ready Drizzle tables, indexes, and relationships, then generate migrations and type exports for application code.
Why use it?
Standard SQLite patterns can cause bugs on D1 because D1 handles foreign keys, data types, JSON, and query parameters differently. This keeps the generated schema aligned with those rules.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cloudflare plugin — 8 skills, 8 commands shipped together

not rated 1.0krepo +5 2mo ago A scan Socket: passSnyk: passSkillSpector: pass 90 tokens original MIT

Good fit Use it to turn a data model into D1-ready Drizzle tables, indexes, and relationships, then generate migrations and type exports for application code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jezweb/claude-skills/d1-drizzle-schema
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 jezweb/claude-skills --skill d1-drizzle-schema
Clone the repo
git clone --depth 1 https://github.com/jezweb/claude-skills

Made for: Claude Code.

Or install cloudflare, the plugin that ships this one along with the rest of its 8 skills, 8 commands.

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 d1-drizzle-schema

README.md
[![agentmods](https://agentmods.dev/badge/skills/jezweb/claude-skills/d1-drizzle-schema/github.svg)](https://agentmods.dev/skills/jezweb/claude-skills/d1-drizzle-schema)
Your own site
<a href="https://agentmods.dev/skills/jezweb/claude-skills/d1-drizzle-schema"><img src="https://agentmods.dev/badge/skills/jezweb/claude-skills/d1-drizzle-schema/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 d1-drizzle-schema

Your own site · 80×15
<a href="https://agentmods.dev/skills/jezweb/claude-skills/d1-drizzle-schema"><img src="https://agentmods.dev/badge/skills/jezweb/claude-skills/d1-drizzle-schema.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,344 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
  • Socket pass 18 Mar 2026
  • Snyk pass 18 Feb 2026
  • 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.00090 $0.01344
Opus 5 $0.00045 $0.00672
Sonnet 5 $0.00018 $0.00269
Haiku 4.5 $0.00009 $0.00134

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

Security

Grade A, and why

d1-drizzle-schema 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.

The scan reads SKILL.md. This mod also ships 2 executable files (assets/drizzle-config-template.ts, assets/schema-template.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

plugins/cloudflare/skills/d1-drizzle-schema/SKILL.md · 153 lines

How it starts

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

D1 Drizzle Schema

Generate correct Drizzle ORM schemas for Cloudflare D1. D1 is SQLite-based but has important differences that cause subtle bugs if you use standard SQLite patterns. This skill produces schemas that work correctly with D1's constraints.

Critical D1 Differences

Feature Standard SQLite D1
Foreign keys OFF by default Always ON (cannot disable)
Boolean type No No — use integer({ mode: 'boolean' })
Datetime type No No — use integer({ mode: 'timestamp' })
Max bound params ~999 100 (affects bulk inserts)
JSON support Extension Always available (json_extract, ->, ->>)
Concurrency Multi-writer Single-threaded (one query at a time)

Workflow

Step 1: Describe the Data Model

Gather requirements: what tables, what relationships, what needs indexing. If working from an existing description, infer the schema directly.

Step 2: Generate Drizzle Schema

Create schema files using D1-correct column patterns:

import { sqliteTable, text, integer, real, index, uniqueIndex } from 'drizzle-orm/sqlite-core'

export const users = sqliteTable('users', {
  // UUID primary key (preferred for D1)
  id: text('id').primaryKey().$defaultFn(() => crypto.randomUUID()),

  // Text fields
  name: text('name').notNull(),
  email: text('email').notNull(),

  // Enum (stored as TEXT, validated at schema level)
  role: text('role', { enum: ['admin', 'editor', 'viewer'] }).notNull().default('viewer'),

  // Boolean (D1 has no BOOL — stored as INTEGER 0/1)
  emailVerified: integer('email_verified', { mode: 'boolean' }).notNull().default(false),

  // Timestamp (D1 has no DATETIME — stored as unix seconds)
  createdAt: integer('created_at', { mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
  updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),

  // Typed JSON (stored as TEXT, Drizzle auto-serialises)
  preferences: text('preferences', { mode: 'json' }).$type<UserPreferences>(),

  // Foreign key (always enforced in D1)
  organisationId: text('organisation_id').references(() => organisations.id, { onDelete: 'cascade' }),
}, (table) => ({
  emailIdx: uniqueIndex('users_email_idx').on(table.email),
  orgIdx: index('users_org_idx').on(table.organisationId),
}))

Read the full file on GitHub · 153 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 153 lines · 90 tokens per session scan A 23bd31f1e12f

Subscribe to this mod's changes

d1-drizzle-schema is a skill published in the GitHub repository jezweb/claude-skills (1,001 stars, last pushed 2mo ago), licensed MIT. It adds 90 tokens to every session and 1,344 once invoked, about $0.0005 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