ai-migration

Guides authoring and validating SQLite schema migration pairs with rollback testing.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/Vimurai/ai-os --skill ai-migration-vimurai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ai-migration
Source: https://github.com/Vimurai/ai-os/tree/main/.claude/skills/ai-migration
Command: npx skills add https://github.com/Vimurai/ai-os --skill ai-migration-vimurai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Changing the shape of core SQLite databases (state.sqlite, telemetry.sqlite) without a controlled process risks broken deployments, data loss, and unrecoverable schema drift. This Skill provides a structured workflow for designing, validating, and committing reversible database migrations. ## Core Features & Use Cases - Migration Pair Authoring: Guides creation of timestamped .up.sql and .down.sql files with transactional guarantees (BEGIN TRANSACTION / COMMIT) and idempotent guards. - Rollback Validation: Tests UP-then-DOWN cycles in a sandbox using node:sqlite DatabaseSync before any commit, ensuring reversibility. - PII & Safety Checks: Flags sensitive columns with PII comments and verifies destructive operations have restore paths. - Use Case: An engineer needs to add an encrypted token column to a state table. The Skill walks them through scoping the change, delegating design to the db_architect agent, sandbox-testing the rollback, and committing the migration pair with an audit log entry. ## Quick Start Ask the AI to help you design and validate a reversible SQLite migration for adding a new column to the state database.

Frequently Asked Questions about ai-migration

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

FAQPage Schema
How do I create a reversible SQLite migration with rollback?▼

Author a pair of timestamped files: an .up.sql that applies changes inside BEGIN TRANSACTION/COMMIT, and a .down.sql that mirrors the changes in reverse with IF EXISTS guards. Test both in a sandbox database before committing.

How to test database migrations before deploying to production?▼

Apply the baseline schema, run the UP migration, verify the new tables or columns, then run the DOWN migration and confirm the schema reverts. Use an isolated test database such as node:sqlite DatabaseSync rather than the live database.

Can I apply migrations directly to the production SQLite database?▼

No. Migrations should only be authored and sandbox-tested during development. Applying them to staging or production requires explicit approval and a recorded rollback plan, never direct modification of the live state database.

What should a down migration script include?▼

A down script must exactly reverse the up changes, restore dropped data where possible, and use idempotent guards like IF EXISTS. It should also drop any PII-flagged columns to prevent sensitive data leakage.

When should I escalate a migration to a database architect agent?▼

Escalate when the migration scope is unclear or contradictory, schema changes conflict with existing ORM queries, or PII auditing requirements are ambiguous. The architect agent can validate migrations directly with sandbox execution rights.