orch-refine-code
Makes your agent restructure code without changing its behavior. It ensures tests keep passing after changes.
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.
Example of what to ask your AI
“Refactor the NWS HTTP client code out of the poller.py file”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
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.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add affaan-m/ECC --skill orch-refine-codeOr download just the file:
curl -L https://raw.githubusercontent.com/affaan-m/ECC/main/skills/orch-refine-code/SKILL.md -o SKILL.mdTechnical 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
- #252
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
accessibility
Helps 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.
affaan-m/ECC
agent-architecture-audit
Makes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
affaan-m/ECC
agent-eval
Helps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
affaan-m/ECC
agent-harness-construction
Makes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
affaan-m/ECC
Similar skills
git-workflow-and-versioning
Organizes code work using Git. Helps save progress, manage different versions, and avoid conflicts when working in a team.
addyosmani/agent-skills
observability-and-instrumentation
Adds tools to monitor what the code does in production. Helps understand if something went wrong and why, making fixes easier.
addyosmani/agent-skills
github-pr-workflow
Prepares GitHub pull requests, ensuring code quality and documentation.
paperclipai/paperclip