skills/migration/SKILL.md
데이터베이스/스키마 마이그레이션을 위한 가이드를 실행합니다.
npx skillsauth add excatt/superclaude-plusplus migrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
데이터베이스/스키마 마이그레이션을 위한 가이드를 실행합니다.
1. 항상 롤백 가능하게
2. 작은 단위로 점진적으로
3. 무중단 배포 고려
4. 데이터 손실 방지
5. 테스트 환경에서 먼저
1. 새 스키마 추가 (additive)
2. 코드 배포 (양쪽 지원)
3. 데이터 마이그레이션
4. 이전 코드 제거
5. 이전 스키마 제거
-- ✅ 안전: 컬럼 추가 (기본값)
ALTER TABLE users ADD COLUMN status VARCHAR(20) DEFAULT 'active';
-- ✅ 안전: 인덱스 추가 (CONCURRENTLY)
CREATE INDEX CONCURRENTLY idx_users_email ON users(email);
-- ✅ 안전: 새 테이블 생성
CREATE TABLE user_preferences (...);
-- ⚠️ 주의: 컬럼 삭제 (데이터 손실)
ALTER TABLE users DROP COLUMN old_field;
-- ⚠️ 주의: 컬럼 타입 변경
ALTER TABLE users ALTER COLUMN age TYPE INTEGER;
-- ⚠️ 주의: NOT NULL 추가
ALTER TABLE users ALTER COLUMN email SET NOT NULL;
-- ⚠️ 주의: 테이블 이름 변경
ALTER TABLE users RENAME TO accounts;
단계:
1. 새 컬럼 추가
2. 데이터 복사 (백그라운드)
3. 코드 업데이트 (양쪽 읽기)
4. 새 컬럼만 사용하도록 코드 변경
5. 이전 컬럼 삭제
# 마이그레이션 생성
npx prisma migrate dev --name add_user_status
# 프로덕션 적용
npx prisma migrate deploy
# 롤백 (수동)
npx prisma migrate resolve --rolled-back add_user_status
// schema.prisma
model User {
id Int @id @default(autoincrement())
email String @unique
status String @default("active") // 새 필드
createdAt DateTime @default(now())
}
# 마이그레이션 생성
alembic revision --autogenerate -m "add_user_status"
# 적용
alembic upgrade head
# 롤백
alembic downgrade -1
# migrations/versions/xxx_add_user_status.py
def upgrade():
op.add_column('users',
sa.Column('status', sa.String(20), server_default='active')
)
def downgrade():
op.drop_column('users', 'status')
# 마이그레이션 생성
npx knex migrate:make add_user_status
# 적용
npx knex migrate:latest
# 롤백
npx knex migrate:rollback
// migrations/xxx_add_user_status.js
exports.up = function(knex) {
return knex.schema.alterTable('users', (table) => {
table.string('status', 20).defaultTo('active');
});
};
exports.down = function(knex) {
return knex.schema.alterTable('users', (table) => {
table.dropColumn('status');
});
};
async function migrateData() {
const BATCH_SIZE = 1000;
let offset = 0;
while (true) {
const rows = await db.query(`
SELECT id, old_field
FROM users
WHERE new_field IS NULL
LIMIT ${BATCH_SIZE}
`);
if (rows.length === 0) break;
for (const row of rows) {
await db.query(`
UPDATE users
SET new_field = $1
WHERE id = $2
`, [transform(row.old_field), row.id]);
}
offset += BATCH_SIZE;
console.log(`Migrated ${offset} rows`);
// 부하 방지
await sleep(100);
}
}
-- 마이그레이션 전후 비교
SELECT
COUNT(*) as total,
COUNT(new_field) as migrated,
COUNT(*) - COUNT(new_field) as remaining
FROM users;
-- 데이터 정합성 검증
SELECT * FROM users
WHERE old_field IS NOT NULL
AND new_field != expected_transform(old_field);
Phase 1: Expand (확장)
┌─────────┐ ┌─────────┐
│old_field│ + │new_field│
└─────────┘ └─────────┘
코드: 양쪽 모두 쓰기, old에서 읽기
Phase 2: Migrate (이전)
데이터를 old → new로 복사
Phase 3: Contract (축소)
코드: new에서만 읽기/쓰기
old_field 삭제
-- Phase 1: 새 컬럼 추가
ALTER TABLE users ADD COLUMN full_name VARCHAR(100);
-- Phase 2: 데이터 복사
UPDATE users SET full_name = name WHERE full_name IS NULL;
-- 트리거로 동기화 (선택)
CREATE TRIGGER sync_name
BEFORE INSERT OR UPDATE ON users
FOR EACH ROW
EXECUTE FUNCTION sync_name_fields();
-- Phase 3: 이전 컬럼 제거 (코드 배포 후)
ALTER TABLE users DROP COLUMN name;
## Migration Plan
### Overview
[마이그레이션 목표 및 영향 범위]
### Risk Assessment
| 위험 | 영향 | 대응 |
|------|------|------|
| 데이터 손실 | High | 백업 확인 |
### Steps
1. [단계 1] - 예상 시간: 5분
2. [단계 2] - 예상 시간: 30분
### Migration Scripts
```sql
-- Up
[적용 스크립트]
-- Down (Rollback)
[롤백 스크립트]
-- 검증 쿼리
[롤백 절차]
---
요청에 맞는 마이그레이션 계획을 수립하세요.
testing
사용자 계획을 기존 도메인 모델에 대해 stress-test하는 인터뷰 세션. 용어를 날카롭게 다듬고, 결정이 굳어질 때마다 CONTEXT.md(도메인 어휘 사전)와 ADR을 인라인으로 갱신한다. 새 기능 요구사항 탐색은 `/brainstorm`을, 기존 도메인 모델·용어와의 정합성 점검은 이 스킬을 사용한다.
development
# Excel (XLSX) Spreadsheet Skill Claude Code supports comprehensive spreadsheet operations through the **xlsx** skill, enabling creation, editing, and analysis of Excel files (.xlsx, .xlsm, .csv, .tsv). ## Trigger - When user needs Excel spreadsheet creation or editing - Financial modeling or data analysis required - Spreadsheet formulas and calculations needed - Data import from CSV/TSV files ## Core Capabilities **Primary functions include:** - Creating new spreadsheets with formulas and f
tools
Generate structured implementation workflows from PRDs and feature requirements
development
실시간 통신 설계 가이드를 실행합니다.