Files
everything-claude-code-zh/docs/zh-TW/commands/refactor-clean.md

29 lines
739 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 重構清理
透過測試驗證安全地識別和移除無用程式碼:
1. 執行無用程式碼分析工具:
- knip找出未使用的 exports 和檔案
- depcheck找出未使用的相依性
- ts-prune找出未使用的 TypeScript exports
2. 在 .reports/dead-code-analysis.md 產生完整報告
3. 依嚴重性分類發現:
- 安全:測試檔案、未使用的工具
- 注意API 路由、元件
- 危險:設定檔、主要進入點
4. 只提議安全的刪除
5. 每次刪除前:
- 執行完整測試套件
- 驗證測試通過
- 套用變更
- 重新執行測試
- 如果測試失敗則回滾
6. 顯示已清理項目的摘要
在執行測試前絕不刪除程式碼!