Principle Migrate Callers Then Delete Legacy Apis

作者 cursorccb5507cec15无许可证10K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

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.

AI 生成的概览

指导在同一轮重构中迁移内部 API 调用方并删除旧 API。

功能
该技能阐述一条重构原则:当确定新的内部 API 设计后,应在同一轮重构中盘点并迁移调用方,然后删除旧 API,而不是保留兼容层。它还建议将临时适配器视为例外并设定时限,并更新测试以断言新契约、删除仅保护重构前实现细节的测试。它产出的是指导,而非代码或文件。
适用场景
适用于引入新的内部 API 而旧调用方仍然存在,且没有外部用户依赖向后兼容的场景。也适合能够承受协调一致的破坏性变更、并将其作为简化或重构计划一部分的项目。
运行要求
除智能体外无需其他条件;仅为说明性指令,不含脚本或外部工具。

Migrate Callers Then Delete Legacy APIs

When we decide a new API is the right design, migrate callers and remove the old API in the same refactor wave instead of preserving compatibility layers.

Rule:

  • Do not keep legacy API paths only because internal callers still exist
  • Inventory callers, migrate them, and delete the old API immediately
  • Treat temporary adapters as exceptional and time-boxed, not default architecture
  • 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

Keeping both old and new APIs creates dual-path complexity, slows cleanup, and makes the codebase feel append-only.

来源与署名

来源:cursor/plugins位于pstack/skills/principle-migrate-callers-then-delete-legacy-apis提交ccb5507

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架