基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/arbazkhan971/godmode --skill migrate命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Turn on Godmode. 135 skills, 7 subagents, zero configuration. Routes to the right skill automatically.
Backup and disaster recovery. backup strategy, disaster recovery, RPO/RTO, data integrity, durability, runbook.
Changelog and release notes management. Keep a Changelog format, Conventional Commits auto-generation, breaking change communication, migration guides, audience-specific notes.
| name | migrate |
| description | Database migration and schema management. |
/godmode:migrate, "add a column", "schema change"# Auto-detect ORM/tool
ls prisma/schema.prisma drizzle.config.ts \
alembic/env.py db/migrate/ 2>/dev/null
IF prisma/schema.prisma exists: Tool=Prisma, dir=prisma/migrations/
IF drizzle.config.ts exists: Tool=Drizzle, dir=drizzle/
IF alembic/env.py exists: Tool=Alembic
IF db/migrate/ exists: Tool=Rails
IF knexfile exists: Tool=Knex
SCHEMA CHANGE REQUEST:
Type: CREATE|ALTER|DROP TABLE, ADD|DROP COLUMN,
RENAME, CHANGE TYPE, ADD INDEX/CONSTRAINT
Tables: <affected tables>
Source: <user request | model diff | drift detection>
# Prisma diff
npx prisma migrate diff \
--from-migrations prisma/migrations \
--to-schema-datamodel prisma/schema.prisma
# Django dry-run
python manage.py makemigrations --dry-run --verbosity 2
Risk: SAFE | CAUTION | DANGEROUS | BREAKING
Reversible: YES | PARTIAL | NO
Data loss: NONE | POTENTIAL | GUARANTEED
Lock duration: NONE | ROW | TABLE (estimate seconds)
SAFE: ADD COLUMN with DEFAULT/NULLABLE, ADD INDEX
CONCURRENTLY, ADD TABLE
CAUTION: ADD COLUMN NOT NULL without DEFAULT,
RENAME COLUMN, ADD INDEX on >1M rows
DANGEROUS: DROP COLUMN, CHANGE TYPE with data loss
BREAKING: DROP TABLE, RENAME TABLE with live traffic
IF risk >= DANGEROUS: use expand-contract pattern. IF table > 10M rows: use online DDL tools. IF lock estimate > 5 seconds: require DBA approval.
PHASE 1 — EXPAND: Add new alongside old, write BOTH,
backfill, verify.
PHASE 2 — CONTRACT: Read from new, stop writing old,
drop old after 2-week stability.
Every migration MUST include:
# Prisma
npx prisma migrate dev --name add_user_role
# Django
python manage.py makemigrations
# Rails
bin/rails generate migration AddRoleToUsers
# Syntax check
npx prisma validate # or python manage.py check
# Rollback test: UP -> DOWN -> UP (idempotency)
# Data preservation: row count before == after
# Lock estimation for large tables:
SELECT pg_size_pretty(pg_total_relation_size('table'));
SELECT reltuples::bigint FROM pg_class
WHERE relname = 'table';
< 100K rows: locks negligible
100K-1M: ADD COLUMN ~seconds, INDEX ~minutes
1M-10M: use CONCURRENTLY
10M-100M: use pt-online-schema-change / gh-ost
> 100M: DBA review + maintenance window
PRE-APPLY: validated, rollback tested, data verified,
lock acceptable, app code compatible, backup exists.
Print: Migrate: {table}.{change} — risk: {level}. Rollback: {tested|untested}. Data: {preserved}.
Append .godmode/migrate-results.tsv:
timestamp migration orm direction status details
KEEP if: UP clean, DOWN reverses, rows preserved,
tests pass, lock < 5s or approved.
DISCARD if: DOWN fails, data loss, NOT NULL without
DEFAULT, lock > 5s without approval.
STOP when FIRST of:
- UP clean + DOWN reverses + tests pass
- Data preserved + seeds updated
- Lock estimated for >1M row tables
On failure: git reset --hard HEAD~1. Never pause.
| Failure | Action |
|---|---|
| Fails on data | Check NOT NULL, type casts, add DEFAULT |
| DOWN fails | Fix before proceeding, test on copy |
| ORM not detected | Check package.json, requirements.txt |