W Refactor

blockmatic/basilic-skills/skills/workflow/w-refactor

作者 blockmatic7e05e2abd052dc6b526e8a28e36d102d42bfd635無授權條款1 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫6 天前更新

Refactor selected code while preserving behavior, then verify.

AI 產生的概覽

在保持行為不變的前提下重構選定的程式碼,並以現有檢查進行驗證。

功能
此技能引導對選定檔案或指定關注點進行保持行為的重構。它要求代理先記錄呼叫端相依性與驗證檢查的基準,再做最小且有用的結構調整,並且只有在有實測證據時才變更演算法或資料結構。接著執行基準中的相關檢查,若失敗則還原原有行為。它不授權提交、推送或建立拉取請求。
適用情境
當程式碼需要在不改變行為的情況下進行結構改善,例如消除重複、釐清命名或減少巢狀時使用。它適合能先建立測試、型別或手動情境基準的工作。它不用於提交、推送或建立拉取請求。
執行需求
不需要指令碼或特殊工具,僅為指示。它依賴儲存庫現有的測試、型別檢查、效能分析器或追蹤記錄來建立並驗證基準。

Use the selected files or a named concern. Capture current behavior with tests, types, or a manual scenario before editing. Refactor does not authorize commit, push, or PR.

  1. Record a baseline: what callers depend on, which checks prove it, and what must not change.
  2. Improve structure in the smallest useful diff: extract duplication, clarify names, reduce nesting. Reuse existing packages. Do not add comments that restate the code.
  3. Change algorithms or data structures only with measured evidence from the repository's profiler, tests, or traces.
  4. Run the affected checks from the baseline. Restore behavior if they fail. Never the full pre-push suite.
  5. Docs: /w-docs if behavior or commands changed.

來源與署名

來源:blockmatic/basilic-skills位於skills/workflow/w-refactor提交7e05e2a

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架