From aj-geddes-useful-ai-prompts-4
Creates safe, reversible database migration scripts with rollback, validation, and zero-downtime for schema changes, data migrations between systems, and large-scale transformations.
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4This skill uses the workspace's default tool permissions.
- [Overview](#overview)
references/alembic-migrations-pythonsqlalchemy.mdreferences/cross-database-migration.mdreferences/knexjs-migrations-nodejs.mdreferences/large-data-migration-with-batching.mdreferences/migration-validation.mdreferences/zero-downtime-migration-pattern.mdscripts/validate-schema.shtemplates/migration-template.sqlSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Create robust, safe, and reversible data migration scripts for database schema changes and data transformations with minimal downtime.
Minimal working example:
import { Knex } from "knex";
// migrations/20240101000000_add_user_preferences.ts
export async function up(knex: Knex): Promise<void> {
// Create new table
await knex.schema.createTable("user_preferences", (table) => {
table.uuid("id").primary().defaultTo(knex.raw("gen_random_uuid()"));
table
.uuid("user_id")
.notNullable()
.references("id")
.inTable("users")
.onDelete("CASCADE");
table.jsonb("preferences").defaultTo("{}");
table.timestamp("created_at").defaultTo(knex.fn.now());
table.timestamp("updated_at").defaultTo(knex.fn.now());
table.index("user_id");
});
// Migrate existing data
await knex.raw(`
INSERT INTO user_preferences (user_id, preferences)
SELECT id, jsonb_build_object(
'theme', COALESCE(theme, 'light'),
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Knex.js Migrations (Node.js) | Knex.js Migrations (Node.js) |
| Alembic Migrations (Python/SQLAlchemy) | Alembic Migrations (Python/SQLAlchemy) |
| Large Data Migration with Batching | Large Data Migration with Batching |
| Zero-Downtime Migration Pattern | Zero-Downtime Migration Pattern |
| Migration Validation | Migration Validation |
| Cross-Database Migration | Cross-Database Migration |
up and down migrations