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 從公開儲存庫中收錄這些內容。

檢舉或申請下架