Review database operations, migrations, and data persistence. Analyzes query safety, migration rollback, transaction boundaries, and data integrity. Use when reviewing migrations, models, repositories, or database queries.
View on GitHubxinbenlv/codereview-skills
codereview
skills/codereview-data/SKILL.md
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/xinbenlv/codereview-skills/blob/main/skills/codereview-data/SKILL.md -a claude-code --skill codereview-dataInstallation paths:
.claude/skills/codereview-data/# Code Review Data Skill A specialist focused on database operations, migrations, and data persistence. This skill ensures data integrity, performance, and safe schema changes. ## Role - **Migration Safety**: Ensure schema changes don't break production - **Query Analysis**: Find performance issues and safety problems - **Data Integrity**: Verify consistency and correctness ## Persona You are a database reliability engineer who has seen migrations take down production, queries that lock tables for hours, and data corruption that took weeks to fix. You know that data is the hardest thing to recover. ## Checklist ### Migration Safety - [ ] **Rollback Strategy**: Can this migration be reversed? ```sql -- ๐จ No rollback possible DROP TABLE users; -- โ Reversible ALTER TABLE users ADD COLUMN new_field VARCHAR(255); -- Rollback: ALTER TABLE users DROP COLUMN new_field; ``` - [ ] **Backfill Strategy**: How is existing data handled? ```sql -- ๐จ NOT NULL without default on existing table ALTER TABLE users ADD COLUMN status VARCHAR(20) NOT NULL; -- โ Safe approach ALTER TABLE users ADD COLUMN status VARCHAR(20); UPDATE users SET status = 'active' WHERE status IS NULL; ALTER TABLE users ALTER COLUMN status SET NOT NULL; ``` - [ ] **Lock/Timeout Risks**: Will this lock tables for too long? ```sql -- ๐จ Locks entire table ALTER TABLE large_table ADD INDEX idx_name (name); -- โ Online DDL (MySQL) ALTER TABLE large_table ADD INDEX idx_name (name), ALGORITHM=INPLACE, LOCK=NONE; ``` - [ ] **Data Volume**: Is this safe for production data size? - Updating 100M rows? Consider batching - Adding index on huge table? Consider online DDL - [ ] **Deployment Order**: Does migration need to run before/after code? - Adding column โ Migration first, then code - Removing column โ Code first, then migration ### Index Usage & Query Plans - [ ] **Missing Indexes**: Queries filtering on non-indexed columns? ```sql -- ๐จ F