Create a Claude Skill for Database Schema Migrations & Performance Tuning
Generate a Claude Skill (SKILL.md) for writing safe, zero-downtime database migrations, composite indexes, and query performance optimizations.
System Directive • Copy and Paste Below
You are a Principal Database Administrator and High-Scale Data Architect. Develop an automated database engineering skill named `database-architect` in a valid `SKILL.md` file. ### DATABASE SPECIFICATIONS: - Database Engine: [DATABASE_ENGINE] (PostgreSQL 16, MySQL 8, SQLite) - Migration Tool / ORM: [MIGRATION_TOOL] (Prisma, Drizzle, Flyway, Alembic) - Production Scale & Constraints: [DATABASE_SCALE] (Zero-downtime, millions of records) ### SKILL.MD DIRECTIVES TO EMBED: 1. **Frontmatter**: Valid `name: database-architect` triggering on schema migrations, SQL queries, and index optimization requests. 2. **Phase 1: Zero-Downtime Migration Safety**: - Enforce backwards-compatible schema changes (Expand and Contract pattern). - Prevent table-locking operations on production tables (e.g. `CREATE INDEX CONCURRENTLY` in PostgreSQL). - Ensure default values on new columns do not cause full table rewrites. 3. **Phase 2: Indexing & Performance Engineering**: - Design composite B-Tree, GIN, and Partial indexes tailored to high-frequency query filters. - Detect and eliminate unused or duplicate indexes. 4. **Phase 3: SQL Execution Plan Analysis**: - Analyze `EXPLAIN (ANALYZE, BUFFERS)` output to identify sequential scans and costly nested loops. 5. **Phase 4: Rollback Strategy**: - Provide paired `up` and `down` migration scripts with verified idempotency. Generate the complete `SKILL.md` file.
Customization & Placeholders
Provide your database engine and migration tool. Claude will generate a zero-downtime schema migration skill for Claude Code.
Example Input Values
Engine: PostgreSQL 16, Tool: Drizzle ORM, Scale: 10M rows with 24/7 uptime requirements.
Expected Output Structure
A complete SKILL.md detailing non-blocking index creation, safe column additions, rollback strategies, and EXPLAIN ANALYZE checks.
Database Architecture & Performance Optimization
Qubenix designs robust database schemas, high-throughput query caching, and zero-downtime data migrations.
More Prompts in Claude Development Toolkit
Generate a Production-Ready CLAUDE.md for an Existing Repository
Inspect an existing codebase and generate a comprehensive, accurate CLAUDE.md with project architecture, build commands, and coding conventions.
Create a Professional design.md Specification from Current Website
Inspect an existing web application or website and extract a complete, structured design.md with design tokens, typography, and component specs.
Create a Reusable Claude Skill for React & Next.js Development
Generate a fully conformant SKILL.md for React and Next.js development that enforces type safety, component modularity, and zero-re-render patterns.