Claude Skill MartBrowse skillsWhat is a Skill?
Back to list

Refactor (Intelligent Refactoring Pipeline)

A six-phase refactoring workflow that forces codemapping, coverage checks, and test verification after every single change.

Dev & CodingAdvanced67,5315,507AI score 7/10Last updated: Aug 9, 2026

What it does

This skill replaces blind search-and-replace refactoring with a disciplined, gated pipeline.

  • Phase 0 – Intent gate: vague requests like "clean this up" are blocked until target, scope, and success criteria are confirmed.
  • Phase 1–2 – Analysis & codemap: launches parallel explore agents plus LSP (goto definition, find references) and ast-grep to build a dependency graph and an impact-zone table with risk levels.
  • Phase 3 – Test assessment: detects the test runner, estimates coverage, and refuses aggressive refactors when coverage is low or absent.
  • Phase 4–5 – Plan & execute: a plan agent breaks work into atomic, reversible steps; each step must pass lsp_diagnostics → tests → type check before the next one starts, with an explicit revert-on-failure protocol and commit checkpoints.
  • Phase 6 – Final verification: full test suite, type check, lint, build, and a written change summary.
  • Team mode: when team_* tools exist, spins up a refactor-squad (2 quick + 2 unspecified-low workers) with a deep verifier running outside the team, plus mandatory teardown.

Who it's for

  • Developers touching legacy code who don't trust an AI to keep scope contained
  • Tech leads who want "no tests, no refactor" enforced structurally
  • TypeScript / Python / Go projects that already have LSP and test commands wired up
  • Existing oh-my-openagent (OMO) users — several phases depend on that toolchain

Examples

  1. /refactor src/auth/handler.ts --scope=file --strategy=safe — extract validation logic into its own function within one file, re-running tests after each atomic edit.
  2. /refactor "split AuthService into an interface-based design" --scope=module — map every consumer via find-references, migrate in dependency order, and commit at each checkpoint.
  3. /refactor "modernize all functions using the deprecated API" --scope=project — consult the librarian agent for the recommended replacement, preview the ast-grep rewrite, apply, then run the full test + build verification.

· · · Install guide · · ·

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download 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 /tmp/oh-my-openagent && cp -r /tmp/oh-my-openagent/packages/shared-skills/skills/refactor ~/.claude/skills/refactor

This is a third-party skill. Check the source repository before installing.

  1. Open a terminal.
  2. Clone the repository into a temp directory:
    git clone https://github.com/code-yeongyu/oh-my-openagent.git /tmp/oh-my-openagent
    
  3. Create the skills directory if needed:
    mkdir -p ~/.claude/skills
    
  4. Copy the refactor skill into place:
    cp -r /tmp/oh-my-openagent/packages/shared-skills/skills/refactor ~/.claude/skills/refactor
    
  5. Restart Claude Code and confirm refactor shows up in your skill list.
  6. From your project root, trigger it with the word refactor (e.g. "refactor this module to extract the validation logic").
  7. (Optional) The skill assumes LSP tools, ast-grep (sg CLI), and OMO-specific agent/team tools. Install ast-grep first (brew install ast-grep or cargo install ast-grep) so the pattern-rewrite steps work; the team_* sections are simply ignored outside an OMO environment.
View source on GitHubLicense: NOASSERTION