drizzle-generate

Generate Drizzle migration SQL files by diffing the schema against the latest snapshot.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/saad-tayyab/lumora --skill drizzle-generate-saad-tayyab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drizzle-generate
Source: https://github.com/saad-tayyab/lumora/tree/main/.agents/skills/drizzle-generate
Command: npx skills add https://github.com/saad-tayyab/lumora --skill drizzle-generate-saad-tayyab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires drizzle-kit.

What problem does it solve? After editing a Drizzle schema, developers need a reliable way to produce the corresponding migration SQL file without hand-writing SQL or guessing at ambiguous changes like renames versus new columns. ## Core Features & Use Cases - Migration Generation: Runs drizzle-kit generate via CLI or the generate(...) SDK to diff the schema against the latest snapshot and write a new migration SQL file. - Structured JSON Envelope: Decodes the discriminated-union response envelope (ok, no_changes, missing_hints, error) so agents and CI pipelines can branch on typed outcomes and exit codes. - Dry-Run and Hints Support: Uses --explain for dry-run statement previews and --hints/--hints-file to resolve ambiguous diffs before writing files. - Use Case: After adding a email_v2 column to the users table in your Drizzle schema, run the generate command with --output json to produce drizzle/0001_name/migration.sql, or receive a missing_hints response telling you exactly which ambiguity to resolve. ## Quick Start Ask the AI to generate a new Drizzle migration from the current schema using drizzle-kit generate with JSON output and the existing drizzle.config.ts.

Frequently Asked Questions about drizzle-generate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a Drizzle migration from my schema?

Run drizzle-kit generate with your drizzle.config.ts to diff the schema against the latest snapshot and write a new migration SQL file. Add --output json for a machine-readable envelope, or call the generate(...) SDK function with dialect, schema, and out options.

Should I use the drizzle-kit CLI or the generate SDK?

Both emit the same discriminated-union envelope. The CLI suits shell and CI contexts when passed --output json, which is always non-interactive. The SDK runs in JSON mode internally with no flag and never throws on user-level failures, returning every outcome through the envelope.

What does the missing_hints status mean in drizzle-kit generate?

A missing_hints status with exit code 2 means the schema diff is ambiguous or unsafe, such as a column that could be a rename or a new column. The response lists unresolved items, and you supply resolutions via --hints or --hints-file, then retry.

Does drizzle-kit generate hang waiting for input in CI?

No. With --output json the CLI is always non-interactive. Under the default text output it prompts only when stdin is a TTY; in non-TTY environments it prints the missing-decisions report and exits with code 2 instead of hanging.

Can I preview migration SQL without writing files?

Yes. Pass --explain to run generate in dry-run mode, which returns the planned SQL statements and computed hints in the response envelope instead of writing a migration file to disk.