Intelligent Refactor Conductor
A 6-phase refactoring protocol: clarify intent, build a codemap, gauge test coverage, plan atomic steps, and verify after every change.
Dev & CodingAdvanced★ 67,531⑂ 5,507AI score 8/10Last updated: Aug 9, 2026
What it does
When you ask to "refactor", "clean up", "extract" or "modernize" code, this skill stops the model from editing blindly and forces it through six phases.
- PHASE 0 – Intent gate: vague requests like "improve this" must trigger a clarifying question; target, scope and success criteria are pinned down first.
- PHASE 1~2 – Codemap: parallel explore agents plus LSP (goto definition, find references), ast-grep and grep produce a dependency graph, impact zones and a risk table.
- PHASE 3 – Test assessment: detects the test runner and branches on coverage (>80% / 50–80% / <50% / none), pausing or refusing aggressive refactors when coverage is thin.
- PHASE 4~5 – Plan & execute: a plan agent emits atomic, reversible steps; each step must pass lsp_diagnostics → tests → typecheck before the next one starts, with commit checkpoints and a failure-recovery protocol.
- PHASE 6 – Final verification: full test suite, typecheck, lint, build, then a change summary report.
- Team mode addendum: when
team_*tools exist, it spins up a 4-worker parallel squad (2 mechanical + 2 reasoning) with a verifier running outside the team, plus mandatory teardown.
Who it's for
- Developers restructuring medium-to-large codebases that already have tests
- Teams burned by AI-introduced regressions during refactors
- Users of the oh-my-openagent (omo) runtime, or anyone with LSP + ast-grep tooling
Examples
/refactor src/auth/handler.ts --scope=module— maps consumers, splits work into verified steps, runs tests between each."Extract validation logic out of AuthService into its own module"— surveys existing conventions, previews with ast-grep, then applies."Modernize all functions using the deprecated API" --strategy=safe— consults the librarian agent for current replacements and proposes adding tests first if coverage is low.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/HEAD/packages/shared-skills/skills/refactor/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the packages/shared-skills/skills/refactor folder from the GitHub repo code-yeongyu/oh-my-openagent into my ~/.claude/skills/refactor/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/code-yeongyu/oh-my-openagent.git && mkdir -p ~/.claude/skills/refactor && cp oh-my-openagent/packages/shared-skills/skills/refactor/SKILL.md ~/.claude/skills/refactor/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal and clone the repo:
git clone https://github.com/code-yeongyu/oh-my-openagent.git - Create the skill folder:
mkdir -p ~/.claude/skills/refactor - Copy the file:
cp oh-my-openagent/packages/shared-skills/skills/refactor/SKILL.md ~/.claude/skills/refactor/ - Open the file — the body is wrapped in a TypeScript template literal (
export const REFACTOR_TEMPLATE = ...). Strip theexport constlines and backticks so only the Markdown instructions remain. - Install supporting tooling: the ast-grep CLI (
sg), and confirm your project's test / typecheck / lint commands. - omo-specific calls (
call_omo_agent,team_*,~/.omo/teams/...) do not exist in plain Claude Code — replace them with Task subagent calls or sequential execution, or skip the team-mode addendum entirely. - Restart Claude Code and try "refactor this module" to confirm the skill triggers.
View source on GitHub ↗License: NOASSERTION