From review-migration
Analyze Mattermost schema migrations against best practices and generate a review report. Pass a migration number/name as argument or omit to auto-detect new migrations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/review-migration:review-migrationThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze a Mattermost schema migration against best practices and produce a filled-out review report.
Analyze a Mattermost schema migration against best practices and produce a filled-out review report.
If $ARGUMENTS is provided, use it to locate the migration:
server/channels/db/migrations/postgres/$ARGUMENTS*.up.sql
server/channels/db/migrations/postgres/$ARGUMENTS*.down.sql
If $ARGUMENTS is empty, auto-detect new or modified migrations:
git diff --name-only HEAD and git diff --name-only --cached to find staged/unstaged migration files.git diff --name-only main...HEAD to find migrations added on the current branch.Read both the .up.sql and .down.sql files. If the down migration is missing, flag it.
Check every SQL statement against the rules from the official guide and reference.md. Pay particular attention to:
morph:nontransactional is present as the first line)Output the following markdown template, filling in every section based on your analysis. Use the exact status values shown: ✅, ❌, or N/A.
If the table is empty or feature-flagged, add a context note at the top: > **Context:** The table is gated by a feature flag and will be empty when this migration runs.
# Schema Migration Review: [version] — [description]
## Schema Changes
- [ ] New table(s): ...
- [ ] New column(s): ...
- [ ] New index(es): ...
- [ ] Modified column(s): ...
- [ ] Dropped object(s): ...
## Safety Analysis
| Check | Status | Notes |
|-------|--------|-------|
| No ALTER COLUMN TYPE | ✅/❌/N/A | ... |
| CREATE INDEX uses CONCURRENTLY | ✅/❌/N/A | ... |
| DROP INDEX uses CONCURRENTLY | ✅/❌/N/A | ... |
| No FOREIGN KEY via ALTER TABLE | ✅/❌/N/A | ... |
| No full-table DELETE/UPDATE | ✅/❌/N/A | ... |
| morph:nontransactional where needed | ✅/❌/N/A | ... |
| Down migration exists | ✅/❌ | ... |
| Transactional/nontransactional split correct | ✅/❌/N/A | ... |
## Backwards Compatibility
- Compatible with previous ESR: Yes/No
- Can previous Mattermost version run with new schema: Yes/No — [explain]
- Impact if not compatible: ...
## Table Locks & Impact
- Tables affected: ...
- Lock types acquired: ... (use lock types from the official guide)
- Impact to concurrent operations: ...
## Zero Downtime
- Possible: Yes/No
- Reason: ...
## Large-Dataset Testing Recommendation
- **Recommended: Yes/No**
- Reason: ...
- Tables to seed for testing: ...
## Test Results (fill manually if testing recommended)
| DB | Table Size | Row Count | Duration | Instance |
|----|-----------|-----------|----------|----------|
| PostgreSQL | | | | |
## SQL Queries
```sql
[contents of the .up.sql file]
```
Ask the user if they'd like to save the report to a file. Suggest the path:
server/channels/db/migrations/reviews/<migration-name>.md
npx claudepluginhub mattermost/mattermost-ai-marketplace --plugin review-migrationReviews database migration safety, schema design, query correctness, and data integrity with engine-specific knowledge (Postgres, MySQL, SQLite).
Creates a structured, zero-downtime database migration plan using the expand/contract pattern with SQL, rollback steps, and deployment runbook.