跳到正文
Skillpedia
通用编程48k · #4376

deprecation-and-migration

它能做什么

这个工具可以帮你判断什么时候、以什么方式移除那些已经没用的旧系统、旧功能或旧代码,还能协助把用户迁移到新方案上。

适用场景

  • ✓当你要用新系统替换旧系统时。
  • ✓当某个功能不再需要时。
  • ✓当你在规划一个系统的停用(生命周期终结)时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/deprecation-and-migration/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/deprecation-and-migration/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“还有一些人在用的旧系统,我该怎么规划下线?”

每周 5 个新技能,1 分钟读完。

工作原理

它会评估维护旧东西的成本,并与迁移用户所需的工作量进行对比。然后给出具体步骤,包括如何通知变更,以及如何安全地把用户迁移到新方案上。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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 project-owned migration verification command documented in this guide. Do not execute an unknown package from the registry.

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

…

常见问题

为什么要移除不用的代码?

旧代码会带来维护成本,比如要修 bug、打安全补丁,而且新开发者也很难理解。移除不再需要的部分可以节省资源。

什么是“Hyrum 定律”(Hyrum's Law)?

这条定律指出,随着时间推移,即使是旧系统的 bug 或意外行为,也可能被用户当成依赖。因此,迁移需要格外小心,不能只是发个通知就完事。

移除之前一定要提前通知吗?

是的,一定要。你需要宣布停用的决定,说明原因,提供替代方案,并指导用户完成过渡。只有在所有人都迁移完成之后,才应该真正移除。

详情

作者的原始描述

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.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4376
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能