jpskill.com
📦 その他 コミュニティ

deprecation-and-migration

既存のシステムやAPI、機能などを段階的に廃止・移行する際に、ユーザーへの影響を最小限に抑えつつ、新環境へのスムーズな移行計画を立て、コードの維持または廃止の判断を支援するSkill。

📜 元の英語説明(参考)

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.

🇯🇵 日本人クリエイター向け解説

一言でいうと

既存のシステムやAPI、機能などを段階的に廃止・移行する際に、ユーザーへの影響を最小限に抑えつつ、新環境へのスムーズな移行計画を立て、コードの維持または廃止の判断を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o deprecation-and-migration.zip https://jpskill.com/download/9578.zip && unzip -o deprecation-and-migration.zip && rm deprecation-and-migration.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9578.zip -OutFile "$d\deprecation-and-migration.zip"; Expand-Archive "$d\deprecation-and-migration.zip" -DestinationPath $d -Force; ri "$d\deprecation-and-migration.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して deprecation-and-migration.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → deprecation-and-migration フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

廃止と移行

概要

コードは資産ではなく負債です。コードのすべての行には、修正すべきバグ、更新すべき依存関係、適用すべきセキュリティパッチ、そして新たに教育すべきエンジニアという、継続的なメンテナンスコストが発生します。廃止とは、もはやその価値に見合わないコードを削除する規律であり、移行とは、ユーザーを古いものから新しいものへ安全に移行させるプロセスです。

ほとんどのエンジニアリング組織は、何かを構築することには長けています。しかし、それらを削除することに長けている組織はほとんどありません。このスキルは、そのギャップに対処するものです。

いつ使うか

  • 古いシステム、API、またはライブラリを新しいものに置き換える場合
  • もはや必要とされない機能を廃止する場合
  • 重複した実装を統合する場合
  • 誰も所有していないが、誰もが依存しているデッドコードを削除する場合
  • 新しいシステムのライフサイクルを計画する場合(廃止計画は設計時に開始されます)
  • レガシーシステムを維持するか、移行に投資するかを決定する場合

中核となる原則

コードは負債である

コードのすべての行には継続的なコストが発生します。テスト、ドキュメント、セキュリティパッチ、依存関係の更新、そして近くで作業する人にとっての精神的なオーバーヘッドが必要です。コードの価値は、コード自体ではなく、それが提供する機能です。同じ機能をより少ないコード、より少ない複雑さ、またはより優れた抽象化で提供できる場合、古いコードは削除されるべきです。

Hyrumの法則が削除を困難にする

十分な数のユーザーがいれば、バグ、タイミングの癖、文書化されていない副作用など、すべての観察可能な動作が依存されるようになります。これが、廃止には単なる告知ではなく、積極的な移行が必要な理由です。代替品が再現しない動作に依存している場合、ユーザーは「ただ切り替える」ことはできません。

廃止計画は設計時に開始する

何か新しいものを構築するときは、「これを3年後に削除するにはどうすればよいか?」と自問してください。クリーンなインターフェース、フィーチャーフラグ、および最小限の表面積で設計されたシステムは、実装の詳細があらゆる場所に漏洩しているシステムよりも廃止が容易です。

廃止の決定

何かを廃止する前に、次の質問に答えてください。

1. このシステムはまだ独自の価値を提供していますか?
   → はいの場合は、それを維持します。いいえの場合は、続行します。

2. 依存しているユーザー/コンシューマーの数は?
   → 移行範囲を定量化します。

3. 代替品は存在しますか?
   → いいえの場合は、最初に代替品を構築します。代替品なしに廃止しないでください。

4. 各コンシューマーの移行コストは?
   → 簡単に自動化できる場合は、実行します。手動で手間がかかる場合は、メンテナンスコストと比較検討します。

5. 廃止しない場合の継続的なメンテナンスコストは?
   → セキュリティリスク、エンジニアの時間、複雑さによる機会費用。

強制的な廃止と推奨的な廃止

タイプ いつ使うか メカニズム
推奨的 移行は任意であり、古いシステムは安定している 警告、ドキュメント、促し。ユーザーは独自のタイムラインで移行します。
強制的 古いシステムにセキュリティ上の問題がある、進捗を妨げる、またはメンテナンスコストが持続不可能である 強制的な締め切り。古いシステムはX日に削除されます。移行ツールを提供します。

デフォルトは推奨的です。 メンテナンスコストまたはリスクが移行を強制するのに正当な場合にのみ、強制的な廃止を使用してください。強制的な廃止には、移行ツール、ドキュメント、およびサポートの提供が必要です。単に締め切りを発表することはできません。

移行プロセス

ステップ 1: 代替品を構築する

動作する代替品なしに廃止しないでください。代替品は次のことを行う必要があります。

  • 古いシステムのすべての重要なユースケースをカバーする
  • ドキュメントと移行ガイドがある
  • 本番環境で実績がある(単に「理論的に優れている」だけではない)

ステップ 2: 発表とドキュメント化

## 廃止のお知らせ: OldService

**ステータス:** 2025-03-01をもって廃止
**代替品:** NewService (以下の移行ガイドを参照)
**削除日:** 推奨 — まだ強制的な締め切りはありません
**理由:** OldServiceは手動スケーリングが必要であり、可観測性がありません。
            NewServiceは両方を自動的に処理します。

### 移行ガイド
1. `import { client } from 'old-service'` を `import { client } from 'new-service'` に置き換えます
2. 構成を更新します (以下の例を参照)
3. 移行検証スクリプトを実行します: `npx migrate-check`

ステップ 3: 段階的に移行する

コンシューマーを一度にすべてではなく、1つずつ移行します。各コンシューマーについて:

1. 廃止されたシステムとのすべての接点を特定します
2. 代替品を使用するように更新します
3. 動作が一致することを確認します (テスト、統合チェック)
4. 古いシステムへの参照を削除します
5. リグレッションがないことを確認します

チャーンルール: 廃止されるインフラストラクチャを所有している場合は、ユーザーを移行するか、移行を必要としない下位互換性のあるアップデートを提供する責任があります。廃止を発表して、ユーザーにそれを理解させるために放置しないでください。

ステップ 4: 古いシステムを削除する

すべてのコンシューマーが移行した後のみ:

1. アクティブな使用状況がゼロであることを確認します (メトリクス、ログ、依存関係分析)
2. コードを削除します
3. 関連するテスト、ドキュメント、および構成を削除します
4. 廃止のお知らせを削除します
5. 祝う — コードの削除は成果です

移行パターン

ストラングラーパターン

古いシステムと新しいシステムを並行して実行します。トラフィックを古いものから新しいものへ段階的にルーティングします。古いシステムがトラフィックの0%を処理する場合、それを削除します。

フェーズ 1: 新しいシステムが 0% を処理し、古いシステムが 100% を処理する
フェーズ 2: 新しいシステムが 10% を処理する (カナリア)
フェーズ 3: 新しいシステムが 50% を処理する
フェーズ 4: 新しいシステムが 100% を処理し、古いシステムがアイドル状態になる
フェーズ 5: 古いシステムを削除する

アダプターパターン

古いインターフェースから新しい実装への呼び出しを変換するアダプターを作成します。バックエンドを移行している間、コンシューマーは古いインターフェースを使用し続けます。

// アダプター: 古いインターフェース、新しい実装
class LegacyTaskService implements OldTaskAPI {
  constructor(private newService: NewTaskService) {}

  // 古いメソッドシグネチャ、新しい実装に委譲する
  getTask(id: number): OldTask {
    const task = this.newService.findById(String(id));
    return this.toOldFormat(task);
  }
}

フィーチャーフラグ移行

フィーチャーフラグを使用して、コンシューマーを古いシステムから新しいシステムへ一度に1つずつ切り替えます。

functio
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Deprecation and Migration

Overview

Code is a liability, not an asset. Every line of code has ongoing maintenance cost — bugs to fix, dependencies to update, security patches to apply, and new engineers to onboard. Deprecation is the discipline of removing code that no longer earns its keep, and migration is the process of moving users safely from the old to the new.

Most engineering organizations are good at building things. Few are good at removing them. This skill addresses that gap.

When to Use

  • Replacing an old system, API, or library with a new one
  • Sunsetting a feature that's no longer needed
  • Consolidating duplicate implementations
  • Removing dead code that nobody owns but everybody depends on
  • Planning the lifecycle of a new system (deprecation planning starts at design time)
  • Deciding whether to maintain a legacy system or invest in migration

Core Principles

Code Is a Liability

Every line of code has ongoing cost: it needs tests, documentation, security patches, dependency updates, and mental overhead for anyone working nearby. The value of code is the functionality it provides, not the code itself. When the same functionality can be provided with less code, less complexity, or better abstractions — the old code should go.

Hyrum's Law Makes Removal Hard

With enough users, every observable behavior becomes depended on — including bugs, timing quirks, and undocumented side effects. This is why deprecation requires active migration, not just announcement. Users can't "just switch" when they depend on behaviors the replacement doesn't replicate.

Deprecation Planning Starts at Design Time

When building something new, ask: "How would we remove this in 3 years?" Systems designed with clean interfaces, feature flags, and minimal surface area are easier to deprecate than systems that leak implementation details everywhere.

The Deprecation Decision

Before deprecating anything, answer these questions:

1. Does this system still provide unique value?
   → If yes, maintain it. If no, proceed.

2. How many users/consumers depend on it?
   → Quantify the migration scope.

3. Does a replacement exist?
   → If no, build the replacement first. Don't deprecate without an alternative.

4. What's the migration cost for each consumer?
   → If trivially automated, do it. If manual and high-effort, weigh against maintenance cost.

5. What's the ongoing maintenance cost of NOT deprecating?
   → Security risk, engineer time, opportunity cost of complexity.

Compulsory vs Advisory Deprecation

Type When to Use Mechanism
Advisory Migration is optional, old system is stable Warnings, documentation, nudges. Users migrate on their own timeline.
Compulsory Old system has security issues, blocks progress, or maintenance cost is unsustainable Hard deadline. Old system will be removed by date X. Provide migration tooling.

Default to advisory. Use compulsory only when the maintenance cost or risk justifies forcing migration. Compulsory deprecation requires providing migration tooling, documentation, and support — you can't just announce a deadline.

The Migration Process

Step 1: Build the Replacement

Don't deprecate without a working alternative. The replacement must:

  • Cover all critical use cases of the old system
  • Have documentation and migration guides
  • Be proven in production (not just "theoretically better")

Step 2: Announce and Document

## Deprecation Notice: OldService

**Status:** Deprecated as of 2025-03-01
**Replacement:** NewService (see migration guide below)
**Removal date:** Advisory — no hard deadline yet
**Reason:** OldService requires manual scaling and lacks observability.
            NewService handles both automatically.

### Migration Guide
1. Replace `import { client } from 'old-service'` with `import { client } from 'new-service'`
2. Update configuration (see examples below)
3. Run the migration verification script: `npx migrate-check`

Step 3: Migrate Incrementally

Migrate consumers one at a time, not all at once. For each consumer:

1. Identify all touchpoints with the deprecated system
2. Update to use the replacement
3. Verify behavior matches (tests, integration checks)
4. Remove references to the old system
5. Confirm no regressions

The Churn Rule: If you own the infrastructure being deprecated, you are responsible for migrating your users — or providing backward-compatible updates that require no migration. Don't announce deprecation and leave users to figure it out.

Step 4: Remove the Old System

Only after all consumers have migrated:

1. Verify zero active usage (metrics, logs, dependency analysis)
2. Remove the code
3. Remove associated tests, documentation, and configuration
4. Remove the deprecation notices
5. Celebrate — removing code is an achievement

Migration Patterns

Strangler Pattern

Run old and new systems in parallel. Route traffic incrementally from old to new. When the old system handles 0% of traffic, remove it.

Phase 1: New system handles 0%, old handles 100%
Phase 2: New system handles 10% (canary)
Phase 3: New system handles 50%
Phase 4: New system handles 100%, old system idle
Phase 5: Remove old system

Adapter Pattern

Create an adapter that translates calls from the old interface to the new implementation. Consumers keep using the old interface while you migrate the backend.

// Adapter: old interface, new implementation
class LegacyTaskService implements OldTaskAPI {
  constructor(private newService: NewTaskService) {}

  // Old method signature, delegates to new implementation
  getTask(id: number): OldTask {
    const task = this.newService.findById(String(id));
    return this.toOldFormat(task);
  }
}

Feature Flag Migration

Use feature flags to switch consumers from old to new system one at a time:

function getTaskService(userId: string): TaskService {
  if (featureFlags.isEnabled('new-task-service', { userId })) {
    return new NewTaskService();
  }
  return new LegacyTaskService();
}

Zombie Code

Zombie code is code that nobody owns but everybody depends on. It's not actively maintained, has no clear owner, and accumulates security vulnerabilities and compatibility issues. Signs:

  • No commits in 6+ months but active consumers exist
  • No assigned maintainer or team
  • Failing tests that nobody fixes
  • Dependencies with known vulnerabilities that nobody updates
  • Documentation that references systems that no longer exist

Response: Either assign an owner and maintain it properly, or deprecate it with a concrete migration plan. Zombie code cannot stay in limbo — it either gets investment or removal.

Common Rationalizations

Rationalization Reality
"It still works, why remove it?" Working code that nobody maintains accumulates security debt and complexity. Maintenance cost grows silently.
"Someone might need it later" If it's needed later, it can be rebuilt. Keeping unused code "just in case" costs more than rebuilding.
"The migration is too expensive" Compare migration cost to ongoing maintenance cost over 2-3 years. Migration is usually cheaper long-term.
"We'll deprecate it after we finish the new system" Deprecation planning starts at design time. By the time the new system is done, you'll have new priorities. Plan now.
"Users will migrate on their own" They won't. Provide tooling, documentation, and incentives — or do the migration yourself (the Churn Rule).
"We can maintain both systems indefinitely" Two systems doing the same thing is double the maintenance, testing, documentation, and onboarding cost.

Red Flags

  • Deprecated systems with no replacement available
  • Deprecation announcements with no migration tooling or documentation
  • "Soft" deprecation that's been advisory for years with no progress
  • Zombie code with no owner and active consumers
  • New features added to a deprecated system (invest in the replacement instead)
  • Deprecation without measuring current usage
  • Removing code without verifying zero active consumers

Verification

After completing a deprecation:

  • [ ] Replacement is production-proven and covers all critical use cases
  • [ ] Migration guide exists with concrete steps and examples
  • [ ] All active consumers have been migrated (verified by metrics/logs)
  • [ ] Old code, tests, documentation, and configuration are fully removed
  • [ ] No references to the deprecated system remain in the codebase
  • [ ] Deprecation notices are removed (they served their purpose)