orch-refine-code
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseorch-refine-code
orch-refine-code
Actor · action · target: orch · refine · code. Thin wrapper over the shared
engine in .
orch-pipeline角色·操作·目标:orch · refine · code。是对中共享引擎的轻量封装。
orch-pipelineWhen to Use
使用场景
- Same behavior, better structure: extract modules, remove duplication, kill dead code, reduce nesting, rename for clarity.
- Distinguish from siblings: if behavior is meant to change at all, this is the
wrong skill (/
orch-change-feature).orch-fix-defect
- 行为不变,结构优化:提取模块、消除重复代码、清理死代码、减少嵌套、重命名以提升可读性。
- 与同类技能区分:若需要改变代码行为,则不应使用本技能(应使用/
orch-change-feature)。orch-fix-defect
Operation settings
操作设置
- Default size floor: standard — restructures touch multiple files.
- Phase mask: 0 → 2 (plan the restructure) → 4 (keep green) → 5 → 6. No new behavior tests are written — the existing suite is the safety net.
- First move (phase 4): confirm the relevant tests exist and are green before touching code; if coverage is thin, add characterization tests first. Then restructure in small steps, re-running tests after each.
- 默认规模下限: 标准级——重构涉及多个文件。
- 阶段掩码: 0 → 2(规划重构方案)→ 4(保持测试全绿)→ 5 → 6。无需编写新的行为测试——现有测试套件即为安全保障。
- 第一步(阶段4): 在修改代码前,确认相关测试存在且全部通过;若测试覆盖率较低,需先添加特征测试。之后分小步进行重构,每一步完成后重新运行测试。
How It Works
工作原理
- Run the engine with the settings above.
orch-pipeline - For dead-code / duplication sweeps, delegate to the agent (it runs knip / depcheck / ts-prune and removes safely).
refactor-cleaner - Stop at Gate 1 (restructure plan) and Gate 2 (pre-commit).
- Commit as — the diff must be behavior-neutral.
refactor:
- 使用上述设置运行引擎。
orch-pipeline - 清理死代码/重复代码时,委托给Agent(它会运行knip / depcheck / ts-prune工具来安全清理)。
refactor-cleaner - 在**Gate 1(重构方案评审)和Gate 2(提交前检查)**处暂停。
- 以为前缀提交代码——代码差异必须保证行为无变化。
refactor:
Example
示例
orch-refine-code: extract the NWS HTTP client out of poller.py
→ confirm tests green → plan extraction [GATE 1: approve]
→ move in small steps, tests green throughout → code-review
→ commit refactor: [GATE 2: confirm]orch-refine-code: extract the NWS HTTP client out of poller.py
→ confirm tests green → plan extraction [GATE 1: approve]
→ move in small steps, tests green throughout → code-review
→ commit refactor: [GATE 2: confirm]