rails-migration-review

Review Rails database migrations for production safety and best practices.

Updated Dec 8, 2022
One-click install
npx skills add https://github.com/lekemula/dotfiles --skill rails-migration-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-migration-review
Source: https://github.com/lekemula/dotfiles/tree/main/claude/skills/rails-migration-review
Command: npx skills add https://github.com/lekemula/dotfiles --skill rails-migration-review

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps prevent production incidents caused by unsafe or inefficient database migrations in Ruby on Rails applications.

Core Features & Use Cases

  • Safety Auditing: Analyzes migrations for potential table locking, data loss, and reversibility issues.
  • Best Practice Enforcement: Checks for adherence to common Rails database migration guidelines and gem usage (e.g., strong_migrations).
  • Use Case: Before merging a new database migration, use this Skill to automatically flag any potential risks like adding a non-nullable column to a large table without a proper strategy.

Quick Start

Review the migration file at 'db/migrate/20231027100000_add_user_email_index.rb' for production safety.

Frequently Asked Questions about rails-migration-review

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

FAQPage Schema
How do I review Rails database migrations for production safety?

To review Rails database migrations for production safety, this Skill analyzes migration files to flag potential table locking, data loss, and reversibility issues before merging. It checks for lock safety, data backfills, and index coverage.

What are common unsafe Rails migration patterns to avoid?

Common unsafe Rails migration patterns include adding non-nullable columns without a default strategy and failing to ensure reversibility. This Skill detects these risks by enforcing best practices around NOT NULL constraints, foreign keys, and default values.

Does this migration review support the strong_migrations gem rules?

Yes, this migration review supports strong_migrations gem rules. It enforces adherence to common Rails database migration guidelines and gem usage, specifically analyzing your migrations against strong_migrations configurations.

How can I check if a Rails migration will lock a large database table?

To check if a Rails migration will lock a large database table, submit your migration file for analysis. The Skill audits for lock safety, concurrent index creation, and potential table locking issues to prevent production incidents.

What is the best way to ensure Rails database migration reversibility?

The best way to ensure Rails database migration reversibility is to audit the migration file before merging. This Skill analyzes for reversibility issues, verifying that up and down methods are properly structured to prevent data loss.

When do I need to use concurrent index creation in Rails migrations?

You need to use concurrent index creation in Rails migrations when adding indexes to large tables to avoid locking. This Skill analyzes your migration to ensure concurrent index creation is used appropriately and adheres to safety best practices.