orch-refine-code
SkillDev toolsorch-refine-code is a skill that guides an AI agent through a behavior-preserving refactor. It confirms the test suite is green before any changes, plans the restructuring, applies it in small steps with tests rerun after each, and stops at approval gates before committing. Use it when structure should improve but behavior must not change.
Available today. Use it from your connected AI after setup.
No other account needed.
Have a codebase with an existing test suite, since the suite is the safety net and no new behavior tests are written.
Then ask your AI: use the orch-refine-code skill
What your AI can do with it
- Confirms relevant tests exist and are green before touching code
- Plans the restructure and stops at Gate 1 for approval
- Restructures in small steps, re-running tests after each change
- Delegates dead-code and duplication cleanup to the refactor-cleaner agent
- Uses knip, depcheck, and ts-prune for cleanup sweeps
- Commits as refactor: only after Gate 2 confirms the diff is behavior-neutral
Getting started
- Have a codebase with an existing test suite, since the suite is the safety net and no new behavior tests are written.
- Add the orch-refine-code skill to the agent's available skills.
- If test coverage is thin, have the agent add characterization tests before restructuring.
- Ask the agent to run orch-refine-code with the refactor you want, such as extracting a module.
- Approve the restructure plan at Gate 1 and confirm the commit at Gate 2.
What this skill tells your AI
The instructions your AI receives, as published by affaan-m/ecc in skills/orch-refine-code/SKILL.md and read by ahel’s review.
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
- Run the
orch-pipelineengine with the settings above. - For dead-code / duplication sweeps, delegate to the
refactor-cleaneragent (it runs knip / depcheck / ts-prune and removes safely). - Stop at Gate 1 (restructure plan) and Gate 2 (pre-commit).
- 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]
Signals
- GitHub stars
- 268k
- Forks
- 40k
- Last commit
- Sep 2026
Questions
- When should this skill be used?
- When the structure should improve but behavior must not change, extracting modules, removing duplication, killing dead code, reducing nesting, or renaming for clarity.
- What if behavior is meant to change?
- This is the wrong skill. Use orch-change-feature or orch-fix-defect instead, since orch-refine-code requires the diff to be behavior-neutral.
- Does it write new tests?
- No. No new behavior tests are written; the existing suite is the safety net. If coverage is thin, characterization tests are added first.
Advanced
- Item type
- skill
- Key
orch-refine-code- Source
- github.com/affaan-m/ecc