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 从公开仓库中收录这些内容。

举报或申请下架