orch-refine-code
SkillDev toolsorch-refine-code is a skill that guides an AI agent through a behavior-preserving refactor. It confirms tests are green, restructures code without changing behavior, keeps tests green, reviews the result, and commits only after approval gates. Use it when the structure should improve but behavior must not change.
Use orch-refine-code in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add orch-refine-code and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the orch-refine-code skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; ahel provides instructions and does not run this skill.
No other account needed.
Have a project with a test suite that can be run from the command line.
What your AI can do with it
- Verify tests pass before starting a refactor
- Plan a behavior-preserving restructuring
- Make changes in small steps and rerun tests after each
- Review the refactor and enforce approval gates before commit
- Delegate dead-code and duplicate cleanup to a helper agent using knip and depcheck
Getting started
- Have a project with a test suite that can be run from the command line.
- Add the orch-refine-code skill to your agent's available skills.
- Configure the agent so it can run your test command and read the results.
- Start a refactor task and let the skill walk through its pipeline.
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
- 270k
- Forks
- 40k
- Last commit
- Sep 2026
Questions
- What does orch-refine-code do?
- It orchestrates a behavior-preserving refactor: confirm tests are green, restructure without changing behavior, keep tests green, review, and gated commit.
- When should I use this skill?
- Use it when the structure should improve but behavior must not change.
- Does it change behavior?
- No. The skill is for behavior-preserving refactors, so behavior must not change.
- Can it clean up dead code and duplicates?
- Yes, dead-code and duplicate cleanup can be delegated to a helper agent using tools like knip and depcheck.
- Does it commit automatically?
- No. It uses approval gates before committing.
Advanced
- Item type
- skill
- Key
orch-refine-code- Source
- github.com/affaan-m/ecc