跳到正文
Skillpedia
通用编程15k · #10980

principle-migrate-callers-then-delete-legacy-apis

它能做什么

为智能体提供一条干净替换内部接口的规则。适合拥有自己的代码、并能协调改动的团队。

适用场景

  • ✓当你引入新的内部 API,而旧的调用方仍然存在的时候。
  • ✓当重构否则会留下兼容包装层的时候。
  • ✓当没有外部用户依赖旧接口的时候。

技能链接

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我们有一个新的内部支付 API。请把每个调用方都迁移过来,并在同一次改动中删除旧的 API。”

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

工作原理

智能体会把每个调用方更新到新的约定,并在同一批次中移除旧接口。它还会更新测试,以断言新的行为,并删除那些只保护旧实现细节的测试。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Migrate Callers Then Delete Legacy APIs

  • Update tests to assert the new contract, and delete tests that only protect pre-refactor implementation details

When this applies:

  • No external users depend on backward compatibility
  • The project can absorb coordinated breaking changes
  • The new API is part of a simplification or refactor initiative
常见问题

什么时候适用?

当没有外部用户依赖向后兼容性,并且项目能够承受协调好的破坏性改动时。

为什么不保留兼容层?

据该技能所述,临时的兼容代码往往会变成长期债务。

测试会怎样?

测试会更新为检查新的约定,而只检查旧内部实现的测试会被删除。

详情

作者的原始描述

Apply when introducing a new internal API while old callers still exist. Migrate callers and delete the old API in the same wave instead of preserving compatibility layers.

repo: cursor/plugins

热度

GitHub 星标
15k
排名
#10980
许可证
—
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能