技能 编程开发 行为保持代码重构编排器

行为保持代码重构编排器

v20260704
orch-refine-code
该技能用于编排行为保持的复杂代码重构流程。当代码结构需要优化(如提取模块、消除冗余、简化嵌套)但核心业务功能必须不变时使用。它遵循严格的多阶段门控机制,确保在整个开发生命周期中,现有测试始终保持绿色,实现安全可靠的重构。
获取技能
173 次下载
概览

orch-refine-code

Actor · action · target: orch · refine · code. Thin wrapper over the shared engine in orch-pipeline.

When 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).

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.

How It Works

  1. Run the orch-pipeline engine with the settings above.
  2. For dead-code / duplication sweeps, delegate to the refactor-cleaner agent (it runs knip / depcheck / ts-prune and removes safely).
  3. Stop at Gate 1 (restructure plan) and Gate 2 (pre-commit).
  4. Commit as refactor: — the diff must be behavior-neutral.

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]
信息
Category 编程开发
Name orch-refine-code
版本 v20260704
大小 1.78KB
更新时间 2026-07-09
语言