refactor

Executes codebase-aware refactoring with test verification and step-by-step rollback.

1|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/UtsavBalar1231/oh-my-claudeagent --skill refactor-utsavbalar1231
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/UtsavBalar1231/oh-my-claudeagent/tree/main/skills/refactor
Command: npx skills add https://github.com/UtsavBalar1231/oh-my-claudeagent --skill refactor-utsavbalar1231

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Refactoring code across a large codebase is risky: hidden dependencies break, tests are skipped, and changes are hard to roll back. This Skill turns refactoring into a deterministic, verified pipeline that maps impact, checks test coverage, and validates every change before moving on. ## Core Features & Use Cases - Codebase Impact Analysis: Spawns parallel explore agents to find all usages, dependents, similar patterns, and tests for the refactoring target, then builds a codemap with risk-zoned impact areas. - Coverage-Gated Execution: Assesses test coverage before starting and blocks aggressive refactoring when coverage is missing, refusing to proceed without a safety net. - Verified Step-by-Step Execution: Delegates planning to the prometheus agent, applies changes with ast-grep structural tools, and runs typecheck, tests, lint, and build after each step with evidence logging. - Use Case: Ask to extract validation logic from an auth handler into a separate module; the Skill maps every consumer, plans atomic steps, applies each change, and reverts automatically if any verification fails. ## Quick Start Ask the assistant to refactor a specific file, class, or pattern, for example: refactor the AuthService class to extract validation logic into a separate module with safe strategy.

Frequently Asked Questions about refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor code safely across a large codebase?

Use the refactor command with a target file, symbol, or pattern. It maps all dependents with parallel explore agents, builds an impact codemap, plans atomic steps, and runs typecheck plus tests after every change, reverting automatically on failure.

How to rename a class or function across an entire project?

Provide the symbol name as the refactoring target with project scope. The Skill finds all occurrences and imports, then applies structural replacement via ast-grep MCP tools or lsp_rename when available, verifying each step with tests.

What happens if test coverage is too low for refactoring?

With coverage below 50 percent the Skill pauses and proposes adding tests first. With no tests at all it blocks aggressive refactoring entirely, refusing to proceed without a verification safety net.

Can it migrate deprecated APIs or libraries automatically?

It consults the librarian agent for a recommended modern alternative but never auto-upgrades unless you explicitly request migration. When migration is requested, it fetches the latest API documentation before changing code.

What happens when a refactoring step fails verification?

If typecheck, tests, lint, or build fail after any step, the Skill stops immediately, reverts the change, and diagnoses the failure. It never proceeds with failing tests or deletes tests to make them pass.