w-refactor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUse 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.
- Record a baseline: what callers depend on, which checks prove it, and what must not change.
- Improve structure in the smallest useful diff: extract duplication, clarify names, reduce nesting. Reuse existing packages. Do not add comments that restate the code.
- Change algorithms or data structures only with measured evidence from the repository's profiler, tests, or traces.
- Run the affected checks from the baseline. Restore behavior if they fail. Never the full pre-push suite.
- Docs: if behavior or commands changed.
/w-docs
使用选定的文件或明确指定的问题范围。编辑前,通过测试、类型检查或手动场景记录当前行为。重构并不授权执行 commit、push 或 PR。
- 记录基线:调用方依赖哪些行为,哪些检查可以证明这些行为,以及哪些内容不得发生改变。
- 以最小且有实际价值的 diff 改善代码结构:提取重复代码、明确命名、减少嵌套。复用现有 packages。不要添加只是复述代码含义的注释。
- 仅在 repository 的 profiler、测试或 traces 提供了明确证据时,才更改算法或数据结构。
- 运行基线中确定的相关检查。如果检查失败,则恢复原有行为。绝不运行完整的 pre-push 测试套件。
- 文档:如果行为或命令发生变化,请更新 。
/w-docs