Agent skill

Drizzle Migrations

by bretzel-app in bretzel-app/crumbs

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

MITAuto-check passedDatabases

Install Drizzle Migrations

skills CLI
$ npx skills add bretzel-app/crumbs --skill drizzle-migrations -a claude-code

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

GitHub CLI
$ gh skill install bretzel-app/crumbs drizzle-migrations --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/bretzel-app/crumbs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/drizzle-migrations .claude/skills/drizzle-migrations && 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
drizzle-migrations
GitHub stars
127
Used in
1 other repo
Token cost
~2.6k tokens
SKILL.md length
215 words
Files
1
Skills in repo
2
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 6 steps: Always use transactions for related… → Always include WHERE on DELETE/UPDATE → Use indexes for frequently queried columns → …
  • Tasks that involve ORMs and data access
  • SKILL.md covers When to Use, Project Setup, Schema Definition and Column Types, plus 5 more sections
  • Calls npm

What it does

Drizzle Migrations is an agent skill from bretzel-app/crumbs. Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns. NOT for Prisma, TypeORM, Sequelize, or raw SQL migration tools.

Its SKILL.md is about 2.6k 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 SQLite, SQL, Drizzle ORM and Prisma. The repository describes itself as: Crumbs by Bretzel - a self-hosted, privacy-first Google Keep alternative. Capture your thoughts, ideas and notes. Built with SvelteKit. The licence is MIT.

When your agent uses it

  • Tasks that involve ORMs and data access

Example prompts

  • “/drizzle-migrations”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(npm:*,npx:*)

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Always use transactions for related changes
  2. Always include WHERE on DELETE/UPDATE
  3. Use indexes for frequently queried columns
  4. Store dates as ISO strings for SQLite
  5. Use returning() to get inserted/updated rows
  6. Generate migrations, don't push to production

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(npm:*
    • npx:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

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

  • Network

    Links to these hosts (documentation or services it may open):

    • orm.drizzle.team

    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

Drizzle Migrations loads about 2.6k tokens when it runs. Until then it costs about 62 tokens; SKILL.md has 215 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~62
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

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 bretzel-app/crumbs at commit 31732e8, republished under its MIT licence (© bretzel-app). 215 words, ~2,553 tokens.

Download SKILL.mdSave it as .claude/skills/drizzle-migrations/SKILL.md (or your agent's skills folder).
name
drizzle-migrations
description
Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns. NOT for Prisma, TypeORM, Sequelize, or raw SQL migration tools.
allowed-tools
Read, Write, Edit, Bash(npm:*,npx:*)
metadata.category
Data & Analytics
metadata.tags
database, drizzle, migrations

Drizzle ORM Migrations

This skill helps you manage database schema changes using Drizzle ORM with SQLite.

When to Use

✅ USE this skill for:

  • Adding new tables or modifying existing columns
  • Generating and running database migrations
  • Drizzle-specific query patterns and relations
  • SQLite schema best practices with Drizzle
  • Setting up Drizzle configuration

❌ DO NOT use for:

  • Supabase/PostgreSQL → use supabase-admin skill
  • Raw SQL without Drizzle → use standard SQL resources
  • Prisma ORM → different syntax and patterns
  • General database design theory → use database architecture resources

Project Setup

Configuration: drizzle.config.ts

typescript
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './src/db/schema.ts',
  out: './drizzle',
  dialect: 'sqlite',
  dbCredentials: {
    url: './data/app.db',
  },
});

Commands:

bash
npm run db:generate  # Generate migration files
npm run db:push      # Push schema directly (dev only)
npm run db:studio    # Open Drizzle Studio GUI

Schema Definition

Location: src/db/schema.ts

Table Definition
typescript
import { sqliteTable, text, integer, real, blob } from 'drizzle-orm/sqlite-core';
import { relations } from 'drizzle-orm';

// Basic table
export const users = sqliteTable('users', {
  id: text('id').primaryKey(),
  email: text('email').notNull().unique(),
  username: text('username').notNull(),
  passwordHash: text('password_hash'),
  createdAt: text('created_at').notNull().default(sql`CURRENT_TIMESTAMP`),
  updatedAt: text('updated_at'),
});

// Table with foreign key
export const checkIns = sqliteTable('check_ins', {
  id: text('id').primaryKey(),
  userId: text('user_id').notNull().references(() => users.id, {
    onDelete: 'cascade',
  }),
  mood: integer('mood').notNull(),
  cravingLevel: integer('craving_level').notNull(),
  sleepHours: real('sleep_hours'),
  notes: text('notes'),
  createdAt: text('created_at').notNull().default(sql`CURRENT_TIMESTAMP`),
});

// Table with composite index
export const auditLog = sqliteTable('audit_log', {
  id: text('id').primaryKey(),
  userId: text('user_id').notNull(),
  action: text('action').notNull(),
  targetType: text('target_type'),
  targetId: text('target_id'),
  details: text('details'),  // JSON string
  createdAt: text('created_at').notNull().default(sql`CURRENT_TIMESTAMP`),
}, (table) => ({
  userActionIdx: index('idx_audit_user_action').on(table.userId, table.action),
  createdAtIdx: index('idx_audit_created').on(table.createdAt),
}));
Relations
typescript
export const usersRelations = relations(users, ({ many }) => ({
  checkIns: many(checkIns),
  sessions: many(sessions),
  journalEntries: many(journalEntries),
}));

export const checkInsRelations = relations(checkIns, ({ one }) => ({
  user: one(users, {
    fields: [checkIns.userId],
    references: [users.id],
  }),
}));

Column Types

SQLite Types in Drizzle
typescript
import {
  sqliteTable,
  text,           // TEXT - strings, JSON, dates
  integer,        // INTEGER - numbers, booleans (0/1)
  real,           // REAL - floating point
  blob,           // BLOB - binary data
} from 'drizzle-orm/sqlite-core';

const examples = sqliteTable('examples', {
  // Strings
  name: text('name').notNull(),
  description: text('description'),

  // Numbers
  count: integer('count').notNull().default(0),
  rating: real('rating'),

  // Booleans (stored as 0/1)
  isActive: integer('is_active', { mode: 'boolean' }).default(true),

  // Dates (stored as ISO strings)
  createdAt: text('created_at').notNull().default(sql`CURRENT_TIMESTAMP`),
  expiresAt: text('expires_at'),

  // JSON (stored as TEXT)
  metadata: text('metadata', { mode: 'json' }),

  // Enums (stored as TEXT)
  status: text('status', { enum: ['pending', 'active', 'archived'] }),
});

Migration Strategies

Strategy 1: Push (Development Only)
bash
npm run db:push
  • Directly applies schema changes
  • Fast for development
  • Never use in production
Strategy 2: Generate & Migrate (Production)
bash
# 1. Generate migration file
npm run db:generate

# 2. Review generated SQL in /drizzle folder

# 3. Apply migration (in code or manually)
Applying Migrations in Code
typescript
import { drizzle } from 'drizzle-orm/better-sqlite3';
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
import Database from 'better-sqlite3';

const sqlite = new Database('./data/app.db');
const db = drizzle(sqlite);

// Run migrations
migrate(db, { migrationsFolder: './drizzle' });

Common Schema Changes

Adding a New Table
typescript
// 1. Add to schema.ts
export const newFeature = sqliteTable('new_feature', {
  id: text('id').primaryKey(),
  userId: text('user_id').notNull().references(() => users.id),
  name: text('name').notNull(),
  createdAt: text('created_at').notNull().default(sql`CURRENT_TIMESTAMP`),
});

// 2. Add relations
export const newFeatureRelations = relations(newFeature, ({ one }) => ({
  user: one(users, {
    fields: [newFeature.userId],
    references: [users.id],
  }),
}));

// 3. Generate migration
// npm run db:generate
Adding a Column
typescript
// In schema.ts, add the new column
export const users = sqliteTable('users', {
  // existing columns...
  newColumn: text('new_column'),  // Add this
});

// Generate migration
// npm run db:generate
Adding an Index
typescript
export const messages = sqliteTable('messages', {
  id: text('id').primaryKey(),
  conversationId: text('conversation_id').notNull(),
  createdAt: text('created_at').notNull(),
}, (table) => ({
  // Add index
  convCreatedIdx: index('idx_messages_conv_created')
    .on(table.conversationId, table.createdAt),
}));
Renaming (Requires Manual SQL)

SQLite doesn't support direct column renames in older versions. For complex changes:

sql
-- drizzle/XXXX_rename_column.sql
-- Manual migration for column rename

-- 1. Create new table with desired schema
CREATE TABLE users_new (
  id TEXT PRIMARY KEY,
  email TEXT NOT NULL UNIQUE,
  display_name TEXT NOT NULL,  -- renamed from username
  created_at TEXT NOT NULL
);

-- 2. Copy data
INSERT INTO users_new SELECT id, email, username, created_at FROM users;

-- 3. Drop old table
DROP TABLE users;

-- 4. Rename new table
ALTER TABLE users_new RENAME TO users;

Query Patterns

Basic Queries
typescript
import { db } from '@/db';
import { eq, and, or, desc, asc, like, gte, lte } from 'drizzle-orm';
import { users, checkIns } from '@/db/schema';

// Select all
const allUsers = await db.select().from(users);

// Select with conditions
const activeUsers = await db
  .select()
  .from(users)
  .where(eq(users.isActive, true));

// Select specific columns
const userEmails = await db
  .select({ id: users.id, email: users.email })
  .from(users);

// Complex where clause
const results = await db
  .select()
  .from(checkIns)
  .where(
    and(
      eq(checkIns.userId, userId),
      gte(checkIns.createdAt, startDate),
      lte(checkIns.createdAt, endDate)
    )
  )
  .orderBy(desc(checkIns.createdAt))
  .limit(30);
Insert
typescript
// Single insert
const [newUser] = await db
  .insert(users)
  .values({
    id: generateId(),
    email: 'user@example.com',
    username: 'newuser',
  })
  .returning();

// Bulk insert
await db.insert(checkIns).values([
  { id: '1', userId, mood: 7, cravingLevel: 2 },
  { id: '2', userId, mood: 8, cravingLevel: 1 },
]);

// Upsert (insert or update)
await db
  .insert(users)
  .values({ id: 'user-1', email: 'new@example.com' })
  .onConflictDoUpdate({
    target: users.id,
    set: { email: 'new@example.com' },
  });
Update
typescript
await db
  .update(users)
  .set({ username: 'newname', updatedAt: new Date().toISOString() })
  .where(eq(users.id, userId));
Delete
typescript
// Always use WHERE clause!
await db
  .delete(checkIns)
  .where(eq(checkIns.id, checkInId));

// Delete with multiple conditions
await db
  .delete(sessions)
  .where(
    and(
      eq(sessions.userId, userId),
      lte(sessions.expiresAt, new Date().toISOString())
    )
  );
Joins
typescript
const userWithCheckIns = await db
  .select({
    user: users,
    checkIn: checkIns,
  })
  .from(users)
  .leftJoin(checkIns, eq(users.id, checkIns.userId))
  .where(eq(users.id, userId));
Aggregations
typescript
import { count, avg, sum, max, min } from 'drizzle-orm';

const stats = await db
  .select({
    totalCheckIns: count(),
    avgMood: avg(checkIns.mood),
    maxStreak: max(checkIns.streak),
  })
  .from(checkIns)
  .where(eq(checkIns.userId, userId));

Best Practices

  1. Always use transactions for related changes
typescript
await db.transaction(async (tx) => {
  await tx.insert(users).values(userData);
  await tx.insert(profiles).values(profileData);
});
  1. Always include WHERE on DELETE/UPDATE
  2. Use indexes for frequently queried columns
  3. Store dates as ISO strings for SQLite
  4. Use returning() to get inserted/updated rows
  5. Generate migrations, don't push to production

References

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

Files

Just SKILL.md in .agents/skills/drizzle-migrations of bretzel-app/crumbs.

Open the folder on GitHubat commit 31732e8

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in bretzel-app/crumbs, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Drizzle Migrations 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.

Drizzle Migrations compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Drizzle Migrations this skillbretzel-app/crumbs1271 repos~2.6kAutomated safety check: PassMIT
Better Drizzlealmeidazs/better-drizzle349—~1.7kAutomated safety check: PassApache-2.0
Database Expertcin12211/orca-q224—~2.8kAutomated safety check: PassMIT
Drizzle Orm Expertdavila7/claude-code-templates33k3 repos~2.6kAutomated safety check: PassMIT
DB Review312362115/claude107—~1.8kAutomated safety check: PassMIT
Drizzle OrmEpicenterHQ/epicenter4.8k—~1.3kAutomated safety check: PassCustom licence

Similar skills

  • Better Drizzle

    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…

    349 GitHub stars~1.7k tokensUpdated yesterday
    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 Orm Expert

    davila7/claude-code-templates

    Expert in Drizzle ORM for TypeScript — schema design, relational queries, migrations, and serverless database integration.

    33k GitHub starsUsed in 3 repos~2.6k tokens
    DatabasesAuto-check passed
  • DB Review

    312362115/claude

    数据库代码审查 + Migration 安全检查. An agent skill from 312362115/claude.

    107 GitHub stars~1.8k tokensUpdated 4 mo ago
    DatabasesAuto-check passed
  • Drizzle Orm

    EpicenterHQ/epicenter

    Apply Drizzle ORM patterns for schemas, migrations, queries, branded types, and Postgres or D1 boundaries.

    4.8k GitHub stars~1.3k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • SQL Database Assistant

    alirezarezvani/claude-skills

    A skill your agent uses when the user asks to write SQL queries, optimize database performance, generate migrations, explore database schemas, or work with ORMs like Prisma, Drizzle, TypeORM, or…

    28k GitHub stars~4k tokensUpdated 1 mo ago
    DatabasesAuto-check passed

More from bretzel-app/crumbs

  • Typescript Best Practices

    bretzel-app/crumbs

    Provides TypeScript patterns for type-first development, making illegal states unrepresentable, exhaustive handling, and runtime validation.

    127 GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed

Categories

Questions about Drizzle Migrations

What does Drizzle Migrations do?

Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns. Drizzle Migrations is an agent skill from bretzel-app/crumbs. Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns.

When should I use Drizzle Migrations?

Drizzle Migrations fits situations like: tasks that involve ORMs and data access.

How do I install Drizzle Migrations in Claude Code?

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

How do I install Drizzle Migrations in Codex?

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

Can I use Drizzle Migrations 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 bretzel-app/crumbs --skill drizzle-migrations -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-migrations, .gemini/skills/drizzle-migrations, .github/skills/drizzle-migrations and .opencode/skills/drizzle-migrations in your project.

What does Drizzle Migrations need to run?

Going by SKILL.md and its folder, Drizzle Migrations needs the command-line tools its instructions call (npm). Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(npm:*,npx:*).

Does Drizzle Migrations access the network?

SKILL.md names 1 domain. As links in the text: orm.drizzle.team. This is read from the text; nothing was executed.

Is Drizzle Migrations 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 Drizzle Migrations use?

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

How many tokens does Drizzle Migrations use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Drizzle Migrations?

Skills that share tags, products or a category with Drizzle Migrations: Better Drizzle (almeidazs/better-drizzle, 349 stars), Database Expert (cin12211/orca-q, 224 stars), Drizzle Orm Expert (davila7/claude-code-templates, 33k stars) and DB Review (312362115/claude, 107 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Drizzle Migrations?

bretzel-app (a GitHub organization) maintains it in bretzel-app/crumbs, which has 127 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 6, 2026.

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