---
name: "drizzle-kit-schema-migrations"
description: "Generate and apply atomic SQL migrations and inspect database data via Drizzle Studio."
metadata:
  author: "Drizzle Team"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "generate drizzle migrations"
  - "drizzle-kit push schema"
  - "open drizzle studio"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Drizzle Kit Declarative Migrations & Studio Inspector

Configures Drizzle Kit: writing drizzle.config.ts, generating migration SQL files (drizzle-kit generate), pushing schema prototypes (drizzle-kit push), dropping tables safely, and launching visual Drizzle Studio.

## When to Invoke
Invoke this skill whenever you need to:
- generate drizzle migrations
- drizzle-kit push schema
- open drizzle studio

## Execution SOP & Rules
1. Define drizzle.config.ts with schema: './src/db/schema.ts', out: './drizzle', dialect: 'postgresql'.
2. Generate migration SQL: npx drizzle-kit generate.
3. Apply migrations to production: npx drizzle-kit migrate or use programmatic migrate() function.
4. Open interactive visual database editor: npx drizzle-kit studio.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
