orch-refine-code
What it does
This tool reorganizes your code to make it cleaner and easier to understand, without changing what it does. It ensures everything keeps working as it did before.
When to use it
- ✓When you want to improve code organization.
- ✓When there's repeated code that can be removed.
- ✓When you want to remove code that is no longer used.
Skill link
https://github.com/affaan-m/ECC/blob/main/skills/orch-refine-code/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Refactor the NWS HTTP client code out of the poller.py file”
5 new skills a week. 1 minute to read.
How it works
The tool first checks if existing tests pass. Then, it reorganizes the code in small steps, testing after each change. Finally, it saves the changes if everything is working correctly.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
- 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]
FAQ
What does 'behavior' of the code mean?
Behavior is what the code does, how it functions, and what results it produces. This tool ensures the final outcome doesn't change.
What are 'tests'?
Tests are automatic checks that ensure the code is working as expected. If a test fails, it means something in the code has been broken.
What is a 'commit'?
A commit is like saving a set of changes to the code. A 'gated commit' means the save only happens if all checks (tests) pass.
Details
Original description by the author
Orchestrate a behavior-preserving refactor — confirm tests are green, restructure without changing behavior, keep tests green, review, and gated commit. Use when the structure should improve but behavior must not change.
repo: affaan-m/ECC
Popularity
- GitHub stars
- 280k
- Ranking position
- #377
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
accessibility
280kHelps your agent create interfaces that everyone can use. Ensures websites and apps work well for people with disabilities, like those who are blind or have reduced mobility.
agent-architecture-audit
280kMakes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
agent-eval
280kHelps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
agent-harness-construction
280kMakes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
Similar skills
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.