Agent skill
Database Development
Database migrations and Drizzle ORM guidelines for the vm0 project
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/database-development
SKILL.md
Database Development
Commands
cd turbo/apps/web
pnpm db:generate # Generate migration from schema changes
pnpm db:migrate # Run pending migrations
pnpm db:studio # Open Drizzle Studio UI
Critical: _journal.json
Manual migrations MUST have an entry in src/db/migrations/meta/_journal.json.
Without this entry, the migration will NOT run and CI will fail.
{
"idx": 25, // Next sequential number
"version": "7", // Always "7"
"when": 1765000000000, // Timestamp (ms)
"tag": "0025_my_migration", // Must match filename without .sql
"breakpoints": true
}
Migration Workflows
Auto-Generated (simple changes)
# 1. Edit schema in src/db/schema/
# 2. Generate (auto-updates _journal.json)
pnpm db:generate
# 3. Run locally
pnpm db:migrate
Manual (renames, complex ALTER)
# 1. Create: src/db/migrations/XXXX_name.sql
# 2. Add entry to _journal.json ← DON'T FORGET!
# 3. Update schema file to match
# 4. Run locally
pnpm db:migrate
Checklist
Before committing:
- Schema file updated in
src/db/schema/ - Schema exported in
src/db/db.ts(if new table) -
_journal.jsonupdated (manual migrations) -
pnpm db:migrateworks locally -
pnpm testpasses
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?