w-refactor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
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.
使用选定的文件或明确指定的问题范围。编辑前,通过测试、类型检查或手动场景记录当前行为。重构并不授权执行 commit、push 或 PR。
  1. 记录基线:调用方依赖哪些行为,哪些检查可以证明这些行为,以及哪些内容不得发生改变。
  2. 以最小且有实际价值的 diff 改善代码结构:提取重复代码、明确命名、减少嵌套。复用现有 packages。不要添加只是复述代码含义的注释。
  3. 仅在 repository 的 profiler、测试或 traces 提供了明确证据时,才更改算法或数据结构。
  4. 运行基线中确定的相关检查。如果检查失败,则恢复原有行为。绝不运行完整的 pre-push 测试套件。
  5. 文档:如果行为或命令发生变化,请更新
    /w-docs
    。