backend-migrations
根据模式更改和数据迁移的最佳实践创建和管理数据库迁移。在创建数据库迁移文件、修改数据库模式、添加或删除表和列、使用迁移文件(prisma/migrations/*, db/migrate/*, migrations/*)、实现带有回滚方法的可逆迁移、管理数据库索引、处理零停机部署、将模式更改与数据迁移分离,或在模式更新期间确保向后兼容性时使用此技能。在设置新数据库表、修改现有数据库结构、创建迁移脚本或审查迁移安全性和回滚策略时应用此技能。
📖 中文导读:根据模式更改和数据迁移的最佳实践创建和管理数据库迁移。在创建数据库迁移文件、修改数据库模式、添加或删除表和列、使用迁移文件(prisma/migrations/*, db/migrate/*, migrations/*)、实现带有回滚方法的可逆迁移、管理数据库索引、处理零停机部署、将模式更改与数据迁移分离,或在模式更新期间确保向后兼容性时使用此技能。在设置新数据库表、修改现有数据库结构、创建迁移脚本或审查迁移安全性和回滚策略时应用此技能。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Backend Migrations description: Create and manage database migrations following best practices for schema changes and data migrations. Use this skill when creating database migration files, modifying database schemas, adding or removing tables and columns, working with migration files (prisma/migrations/, db/migrate/, migrations/*), implementing reversible migrations with rollback methods, managing database indexes, handling zero-downtime deployments, separating schema changes from data migrations, or ensuring backwards compatibility during schema updates. Apply this skill when setting up new database tables, altering existing database structures, creating migration scripts, or reviewing migration safety and rollback strategies.
Backend Migrations
When to use this skill
- When creating new database migration files (e.g.,
prisma/migrations/*,db/migrate/*,migrations/*) - When modifying database schemas (adding, removing, or altering tables and columns)
- When implementing rollback or down methods for migrations
- When adding or modifying database indexes on large tables
- When separating schema changes from data migrations
- When considering zero-downtime deployment strategies for database changes
- When naming migration files with descriptive, clear names
- When reviewing migration safety and ensuring backwards compatibility
- When managing database constraints (foreign keys, NOT NULL, UNIQUE)
- When planning multi-step migrations for complex schema changes
- When working with version-controlled database schema definitions
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle backend migrations.
Instructions
For details, refer to the information provided in this file: backend migrations