refactor-deep
Iteratively refactors code by running subagents, applying automated fixes, and verifying results against tests.
Install
mkdir -p .claude/skills/refactor-deep && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19432" && unzip -o skill.zip -d .claude/skills/refactor-deep && rm skill.zipInstalls to .claude/skills/refactor-deep
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Iterative refactoring of the feature-branch diff (full project when no diff exists) — runs `/optimus:refactor` in a fresh subagent context per iteration, applies fixes, runs tests, bisects failures, and continues until convergence or the iteration cap (default 8, hard cap 20). Supports `testability` or `guidelines` focus to prioritize finding categories. Fixes are applied automatically without per-change approval; for a single supervised pass, use /optimus:refactor. Creates a git checkpoint commit after each iteration (skip with --no-commit). Requires a test command in .claude/CLAUDE.md. Use for thorough guideline alignment or testability cleanup before /optimus:unit-test.Key capabilities
- →Execute iterative refactoring in fresh subagent contexts
- →Apply code fixes and run test suites automatically
- →Bisect failures to isolate issues
- →Create git checkpoint commits per iteration
- →Support testability or guideline-focused refactoring
How it works
The orchestrator runs a loop of refactoring passes, spawning fresh subagents to apply changes and verify them against the project's test suite until convergence or iteration limits are reached.
Inputs & outputs
When to use refactor-deep
- →Clean up feature branch code before merging
- →Improve testability of legacy modules
- →Enforce coding guidelines across a project
- →Automate repetitive code improvement tasks
About refactor-deep
Runs a series of refactoring iterations in fresh subagent contexts. It applies code changes, executes test suites, identifies failures, and continues until reaching a convergence point or iteration limit.
Iterative refactoring of the feature-branch diff (full project when no diff exists) — runs `/optimus:refactor` in a fresh subagent context per iteration, applies fixes, runs tests, bisects failures, and continues until convergence or the iteration cap (default 8, hard cap 20). Supports `testability`
When not to use it
- →Running deep mode inside another deep mode session
- →Projects lacking a documented test command
Prerequisites
Limitations
- →Default iteration limit of 8, hard cap of 20
- →Requires uncommitted changes to be committed or skipped
How it compares
This approach automates multi-pass iterative cleanup and verification, whereas standard refactoring typically requires manual intervention per change.
Compared to similar skills
refactor-deep side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| refactor-deep (this skill) | 0 | 2mo | Review | Advanced |
| migrate | 1 | 6mo | Review | Intermediate |
| tdd-workflows-tdd-refactor | 1 | 4mo | No flags | Intermediate |
| tdd-migrate | 1 | 7mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
migrate
alirezarezvani
Migrate from Cypress or Selenium to Playwright. Use when user mentions "cypress", "selenium", "migrate tests", "convert tests", "switch to playwright", "move from cypress", or "replace selenium".
tdd-workflows-tdd-refactor
sickn33
Use when working with tdd workflows tdd refactor
tdd-migrate
parcadei
TDD workflow for migrations - orchestrate agents, zero main context growth
webapp-testing
anthropics
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
dev-browser
SawyerHood
Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.
playwright-browser-automation
lackeyjb
Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.