alekspetrov/navigator/database-migration
Claude Code and agent skill by alekspetrov/navigator
- community
Checking that the SKILL.md file is still in the repository.
Create database migration with schema changes and rollback. Auto-invoke when user says "create migration", "add table", "modify schema", or "change database".
Install
npx vskill@latest install alekspetrov/navigator/database-migrationSKILL.md
Database Migration Generator
Generate database migrations with rollback capability for schema changes, with built-in ToM verification for safe database operations.
Implementation note: This skill uses directWrite()calls with inline templates (see Steps 3–4 and "Schema Change Templates" section below). Unlikefrontend-componentandbackend-endpoint, there are no Python helper functions — the skill is prose-driven by design, since migration generation is highly schema-specific and benefits from inline framework templates. Future work (tracked for v6.6.0) may extract a timestamp generator and per-framework templates.
When to Invoke
Auto-invoke when user mentions:
- "Create migration"
- "Add table"
- "Modify schema"
- "Change database"
- "Database migration for [change]"
- "Add column to [table]"
- "Rename [table/column]"
What This Does
- Detects migration framework (Knex, Prisma, TypeORM, raw SQL)
- Gathers migration requirements
- Verifies understanding before generating (ToM checkpoint - critical for DB changes)
- Generates migration file with timestamp
- Creates schema change (up migration)
- Creates rollback (down migration)
- Validates migration safety
- Shows migration summary
Execution Steps
Step 0: Check Existing Patterns (Phase 0)
Before detecting the framework, query the knowledge graph for what we already know about database work in this project. For migrations — the highest-stakes execution path — Phase 0 is especially valuable because past pitfalls (failed NOT NULL adds, bad rollback assumptions, naming collisions) often repeat.
Also check migration, schema, and performance (for index decisions).
If memories surface (PATTERN, PITFALL, DECISION entries), read the full memory files for any relevant ones:
What to do with what you find:
- Patterns: apply them (e.g. "we always use UUIDs over auto-increment IDs")
- Pitfalls: avoid them — these are the most important for migrations (record what you avoided in
pitfalls_avoidedin Step 7) - Decisions: respect them (e.g. "we chose JSONB over separate tables for tags")
Skip this step only if the knowledge graph is disabled in .agent/.nav-config.json.
Step 1: Detect Migration Framework
Check project for migration tool:
Framework detection result:
If no framework detected:
Step 2: Gather Migration Requirements
Ask user for migration details:
Step 2.5: Verify Understanding (ToM Checkpoint - ALWAYS for DB) [EXECUTE]
CRITICAL: This step MUST ALWAYS be executed for database migrations. No exceptions.
Database migrations are high-stakes - ALWAYS verify before generating.
Display verification:
Never skip verification for database migrations - they can cause data loss.
Step 3: Generate Migration File
Based on detected framework:
Knex Migration
Knex template:
Prisma Migration
Show Prisma workflow:
TypeORM Migration
TypeORM template:
Step 4: Generate Rollback Logic
Ensure every UP has a corresponding DOWN:
| UP Operation | DOWN Operation | |
|---|---|---|
| CREATE TABLE | DROP TABLE | |
| ADD COLUMN | DROP COLUMN | |
| ADD INDEX | DROP INDEX | |
| ADD CONSTRAINT | DROP CONSTRAINT | |
| RENAME | RENAME (reverse) | |
| ALTER COLUMN | ALTER COLUMN (reverse) |
Warning for destructive operations:
Step 5: Validate Migration Safety
Check for common issues:
Safety warnings to check:
- Adding NOT NULL without DEFAULT (will fail on existing rows)
- Dropping columns with data
- Renaming columns (may break application code)
- Adding UNIQUE constraint (may fail if duplicates exist)
- Large table alterations (may lock table)
Step 6: Show Migration Summary
Display completed migration:
Step 7: Emit Execution Summary (Graph Ingestion)
After Step 6, emit an execution_summary JSON block. Database migrations are the highest-stakes execution path — recording the patterns and decisions here is the most valuable. This block flows into the knowledge graph via execution_to_graph.py.
Output the block verbatim (replace placeholders with actual values):
Ingestion (run from project root):
Migration-specific rules:
- Always record pitfalls — DB changes are easy to get wrong, future agents need the warning.
- Stack detection should include both the migration framework AND the target DB (e.g.
knex+postgres). - Decisions about column types, indexes, and constraints are valuable to capture even when they feel obvious.
Schema Change Templates
Create Table (Knex)
Add Column (Knex)
Add Index (Knex)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/database-migration/SKILL.md
Popularity
- 7-day trend score
- 0
Refreshed 16 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alekspetrov/navigator/database-migration)