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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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
评论
- …
同一仓库的更多技能
advisor
15k如果你开启该功能,让你的智能体在关键节点咨询一个更强的第二模型,例如在重大决定之前,或在错误上卡住时。
check-agent-compatibility
15k全面检查 AI 编程智能体能否启动、验证和记录某个代码仓库,并返回一个兼容性评分以及主要问题。
cli-for-agents
15k教你的智能体设计或审查命令行工具,使 AI 智能体无需提示即可运行,并提供清晰的帮助文字和示例。
continual-learning
15k通过把回顾过往对话的工作交给专门的记忆更新程序,使你的 AGENTS.md 笔记保持最新。