agentleFS
DannykkhDannykkh/skill-olympus/skills/deprecation-and-migration/SKILL.md

deprecation-and-migration

Skill9 starsChanged 3 months agoMITView on GitHub

코드 부채 정리 + 안전한 마이그레이션 + 코드 최소화(reducing-entropy). 레거시 코드 폐기 계획, API 버전 전환, 라이브러리 마이그레이션, 단계적 제거, Dead Code 탐지, LOC 측정. /deprecate로 실행.

80 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use accessibility-engineering, using-agent-skills and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • steven123397Skill

    accessibility-engineering

    Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.

    Also in 4 projects that use this

  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 38 projects that use this

  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 19 projects that use this

  • LLl0k0laDSkill

    idea-refine

    Refine ideas through structured divergent and convergent thinking. Use "idea-refine" or "ideate" to trigger.

    Also in 41 projects that use this

  • HK-hubSkill

    source-driven-development

    Grounds every implementation decision in official documentation. Use when you want authoritative, source-cited code free from outdated patterns. Use when building with any framework or library where correctness matters.

    Also in 45 projects that use this

  • seikaikyoSkill

    doubt-driven-development

    對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。

    Also in 40 projects that use this

  • +3 more from LLl0k0laD

The file

Files
SKILL.md

Deprecation & Migration — 코드 부채 정리 + 안전한 마이그레이션

코드는 자산이 아니라 부채다. 유지보수할 코드가 적을수록 팀은 빠르게 움직인다. 삭제하지 못하는 코드는 미래의 버그이고, 마이그레이션하지 않는 레거시는 기술 부채의 이자다.

Quick Start

/deprecate                          # 대화형 폐기/마이그레이션 계획 수립
/deprecate scan                     # 프로젝트 내 폐기 대상 스캔
/deprecate plan "jQuery → vanilla"  # 특정 마이그레이션 계획 생성
/deprecate api v1 → v2              # API 버전 전환 계획
/deprecate audit                    # 기술 부채 감사

공식 호출명: /deprecate (별칭: 마이그레이션, 레거시 정리, 코드 부채)

적용 시점

상황적용
라이브러리/프레임워크 메이저 버전 업그레이드O
API 버전 폐기 (v1 → v2)O
레거시 코드 단계적 제거O
언어/런타임 마이그레이션 (JS → TS, Python 2 → 3)O
DB 스키마 대규모 변경O
인프라 전환 (온프렘 → 클라우드)O
단순 리팩토링 (이름 변경, 파일 이동)X — 일반 리팩토링
새 기능 추가X

CRITICAL: First Actions

1. Print Intro

Deprecation & Migration — 코드 부채 정리
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
순서: Audit → Plan → Deprecate → Migrate → Verify → Cleanup

2. 현재 상태 스캔

# 1. @deprecated 어노테이션/주석 찾기
echo "=== @deprecated ==="
grep -rn "@deprecated\|@Deprecated\|# deprecated\|// deprecated\|DEPRECATED" \
  --include="*.{ts,tsx,js,jsx,py,java,go,rb,cs,kt,rs}" . 2>/dev/null | head -30

# 2. TODO/FIXME/HACK 찾기
echo "=== TODO/FIXME/HACK ==="
grep -rn "TODO\|FIXME\|HACK\|XXX\|WORKAROUND" \
  --include="*.{ts,tsx,js,jsx,py,java,go,rb,cs,kt,rs}" . 2>/dev/null | wc -l

# 3. 오래된 의존성 확인
echo "=== Outdated Dependencies ==="
npm outdated 2>/dev/null || pip list --outdated 2>/dev/null || \
  go list -m -u all 2>/dev/null | grep '\[' | head -20

# 4. Dead code 후보 (export되지만 import 안 되는 것)
echo "=== Unused Exports (sample) ==="
grep -rn "^export " --include="*.{ts,tsx,js,jsx}" . 2>/dev/null | head -10

Step 1: 기술 부채 감사 (Audit)

부채 분류 매트릭스

카테고리예시리스크우선순위 기준
보안 부채패치 안 된 의존성, 취약한 암호화높음즉시
호환성 부채EOL 런타임, 폐기 예정 API높음분기 내
성능 부채N+1 쿼리, 불필요한 번들중간다음 스프린트
가독성 부채죽은 코드, 혼란스러운 네이밍낮음여유 시

감사 보고서 템플릿

# Tech Debt Audit Report

**Date**: {YYYY-MM-DD}
**Scope**: {프로젝트/모듈}

## Summary
- 총 부채 항목: {N}개
- Critical: {N} | High: {N} | Medium: {N} | Low: {N}

## Critical Items
| # | 항목 | 위치 | 리스크 | 예상 작업량 |
|---|------|------|--------|-----------|
| 1 | {항목} | {파일:라인} | {리스크} | {시간/일} |

## Recommended Migration Order
1. {가장 먼저 해야 할 것} — 이유: {왜}
2. {두 번째} — 이유: {왜}

Step 2: 폐기 계획 (Deprecation Plan)

2.1 API 폐기 패턴

# API Deprecation Plan: {API 이름} v{old} → v{new}

## Timeline
| 단계 | 날짜 | 조치 |
|------|------|------|
| Announce | {D-day} | 폐기 공지 + v{new} 제공 |
| Sunset Warning | {+30일} | 응답 헤더에 Sunset 추가 |
| Usage Drop Gate | {+60일} | v{old} 사용률 < 5% 확인 |
| Soft Removal | {+90일} | v{old} 410 Gone 반환 |
| Hard Removal | {+120일} | v{old} 코드 삭제 |

## API Response Headers (Sunset 기간)
```http
Sunset: Sat, 01 Nov 2026 00:00:00 GMT
Deprecation: true
Link: <https://api.example.com/v2/docs>; rel="successor-version"

Migration Guide for Consumers

v1 Endpointv2 EndpointBreaking Changes
GET /v1/usersGET /v2/users페이지네이션 변경

### 2.2 라이브러리 마이그레이션 패턴

```markdown
# Migration Plan: {old-lib} → {new-lib}

## Compatibility Layer (Strangler Fig 패턴)
1. new-lib를 설치하고 old-lib과 공존
2. 새 코드는 new-lib으로 작성
3. 기존 코드를 모듈 단위로 전환
4. old-lib 사용처가 0이 되면 제거

## File-by-File Migration Tracker
| 파일 | 상태 | old-lib 사용 | 비고 |
|------|------|-------------|------|
| src/components/Button.tsx | migrated | 0 | |
| src/utils/api.ts | pending | 3 | 복잡도 높음 |
| src/pages/Home.tsx | pending | 1 | |

2.3 코드 폐기 마킹

언어별 폐기 어노테이션:

// TypeScript/JavaScript
/** @deprecated Use `newFunction()` instead. Will be removed in v3.0. */
export function oldFunction(): void { ... }
# Python
import warnings
def old_function():
    """Deprecated: Use new_function() instead. Removed in v3.0."""
    warnings.warn("old_function is deprecated, use new_function", DeprecationWarning, stacklevel=2)
    return new_function()
// Java
@Deprecated(since = "2.0", forRemoval = true)
public void oldMethod() { ... }
// C#
[Obsolete("Use NewMethod() instead. Will be removed in v3.0.", false)]
public void OldMethod() { ... }

Step 3: 마이그레이션 실행

3.1 Strangler Fig 패턴 (점진적 교체)

Phase 1: 공존 — old + new 모두 동작
  └─ new-lib 설치, adapter/bridge 작성
  └─ 새 코드는 무조건 new 사용

Phase 2: 전환 — 모듈 단위로 old → new 교체
  └─ 리스크 낮은 모듈부터 시작
  └─ 각 모듈 전환 후 테스트

Phase 3: 정리 — old 제거
  └─ old-lib 사용처 0 확인
  └─ old-lib 의존성 제거
  └─ adapter/bridge 코드 제거

3.2 Feature Flag 기반 전환

// 피처 플래그로 old/new 전환
if (featureFlags.isEnabled('use-new-auth')) {
  return newAuthService.login(credentials);
} else {
  return legacyAuthService.login(credentials);  // @deprecated
}

3.3 마이그레이션 스크립트 (자동화 가능한 경우)

# codemod 예시 (jscodeshift)
npx jscodeshift -t transforms/old-to-new.ts src/**/*.tsx

# AST 기반 변환 (Python)
python -m libcst.tool codemod old_to_new.OldToNewTransform .

# sed 기반 단순 치환 (최후 수단)
find src -name "*.ts" -exec sed -i 's/oldImport/newImport/g' {} +

Step 4: 검증

마이그레이션 완료 검증 체크리스트

#항목확인 방법
1old-lib 사용처 0grep -rn "old-lib" src/ 결과 없음
2old-lib 의존성 제거package.json / requirements.txt에서 삭제
3테스트 전체 통과CI 그린
4@deprecated 마킹 정리제거 완료된 항목의 deprecated 주석 삭제
5adapter/bridge 코드 정리호환 레이어 제거
6문서 업데이트API 문서, README에서 old 참조 제거
7CHANGELOG 기록Breaking changes 명시

회귀 테스트 전략

# 전체 테스트 실행
npm test -- --coverage    # JS/TS
pytest --cov=src          # Python
go test -cover ./...      # Go

# 마이그레이션 전후 스냅샷 비교 (API 응답)
diff <(curl -s localhost:3000/api/v1/users) <(curl -s localhost:3000/api/v2/users)

Step 5: 정리 + 문서화

마이그레이션 후 Dead Code 정리

마이그레이션 완료 후 old 코드 잔재물 정리는 /hestia(헤스티아)를 사용합니다:

/hestia scan    # 미사용 export, 의존성, 파일 스캔
/hestia clean   # 스캔 + 자동 삭제

마이그레이션 ADR 작성

마이그레이션 결정은 반드시 ADR로 기록:

/adr "jQuery를 제거하고 vanilla JS로 전환"

출력 형식

마이그레이션 계획 생성 완료
━━━━━━━━━━━━━━━━━━━━━━━━━━
  대상: moment.js → date-fns
  전략: Strangler Fig (점진적 교체)
  
  현재 상태:
    moment.js 사용처: 47개 파일
    예상 작업량: 3-5일
  
  생성된 산출물:
    - docs/migration-moment-to-datefns.md  (마이그레이션 계획)
    - docs/adr/0008-replace-moment.md      (ADR)
  
  권장 순서:
    1. date-fns 설치 + adapter 작성
    2. utils/ 모듈 먼저 전환 (리스크 낮음)
    3. components/ 전환
    4. moment.js 제거 + 테스트

다음 단계:
  - /adr로 결정 기록 (자동 생성됨)
  - 모듈별 PR 분리 권장
  - /launch로 배포 전 체크

Red Flags — 위험한 마이그레이션 패턴

패턴위험대안
빅뱅 마이그레이션 (한 번에 전부)롤백 불가, 디버깅 불가Strangler Fig 패턴
마이그레이션 중 기능 추가범위 폭발, 원인 혼동마이그레이션과 기능을 분리
"나중에 정리" 약속영원히 안 함마이그레이션 PR에 정리 포함
테스트 없이 전환회귀 버그전환 전 테스트부터 작성
deprecated 마킹만 하고 제거 안 함부채 누적제거 일정 + 알림 설정
adapter 코드 영구 유지복잡도 증가전환 완료 후 즉시 제거

파이프라인 위치

/deprecate audit → /deprecate plan → /agent-team (구현) → /code-reviewer → /launch
  부채 감사        마이그레이션 계획    병렬 구현          리뷰           출시

독립 실행 가능 — scan, audit, plan 각각 단독 사용 가능.


Related Files

파일역할
docs/migration-*.md마이그레이션 계획
docs/adr/*.md관련 아키텍처 결정
skills/documentation-and-adrs/SKILL.mdADR 작성
skills/dependency-updater/SKILL.md의존성 업데이트
skills/release-notes/SKILL.mdBreaking changes 기록

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.