Skip to content
affaan-m avatar

Orch Refine Code

Behavior-preserving refactor that confirms green tests, restructures in small steps, and gates the commit.

CCM score
69 of 100
skills.sh installs
6.8K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers confirming the relevant tests are green, planning the restructure, moving code in small steps, and review
  • Delegates dead-code and duplication sweeps to the refactor-cleaner agent, which runs knip, depcheck, and ts-prune
  • Adds characterization tests first when coverage is thin, and stops at two gates: restructure plan and pre-commit
  • Designed for structure-only changes where behavior must not change, and commits are labeled refactor:

Install

$ npx -y skills add affaan-m/ecc --skill orch-refine-code -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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

Details

Repository
github.com/affaan-m/ecc
Categories
Code Review & Quality, Git & Releases, Agent Workflow & Planning
First seen
Jul 14, 2026

Questions

What does the orch-refine-code skill do?

It orchestrates a behavior-preserving refactor: it confirms the tests are green, restructures the code without changing behavior, keeps tests green, runs a review, and makes a gated commit. The skill is meant for cases where the structure should improve but behavior must stay the same.

When should I use orch-refine-code instead of a sibling skill?

Use it when you want better structure, such as extracting modules, removing duplication, killing dead code, reducing nesting, or renaming for clarity. If behavior is meant to change at all, the page points to orch-change-feature or orch-fix-defect instead.

How do I install orch-refine-code?

Run npx -y skills add affaan-m/ecc --skill orch-refine-code -y in your project. Once installed, the agent can run an orchestrated refactor that stops at a plan gate and a pre-commit gate before committing as refactor:.

How does orch-refine-code handle dead code and duplication sweeps?

For dead-code and duplication sweeps it delegates to the refactor-cleaner agent, which runs knip, depcheck, and ts-prune and removes code safely. If test coverage is thin, it adds characterization tests before restructuring in small steps.

More from affaan-m/ecc

All 257

Similar to Orch Refine Code

More Code Review & Quality