AgentSkillsCN

Backend Migrations

按照最佳实践创建和管理数据库迁移,进行模式变更和数据迁移。在创建数据库迁移文件、修改数据库模式、添加或删除表和列、处理迁移文件(prisma/migrations/*、db/migrate/*、migrations/*)、实现带回滚方法的可逆迁移、管理数据库索引、处理零停机部署、分离模式变更与数据迁移或确保模式更新向后兼容时,可使用此技能。在设置新数据库表、更改现有数据库结构、创建迁移脚本或审查迁移安全性和回滚策略时,可应用此技能。

SKILL.md
--- frontmatter
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