refactorlisted
Install: claude install-skill boshu2/agentops
# Refactor Skill
> **Quick Ref:** Safe, incremental refactoring with test verification at every step. One transformation, one test run, one commit. Never batch.
**YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.**
## Modes
### 1. Target Mode (default)
```
$refactor <file-or-function>
```
Refactor a specific file, function, or class. You identify what needs improving, plan the steps, and execute them one at a time with test verification.
### 2. Sweep Mode
```
$refactor --sweep <scope>
```
Find and fix complexity hotspots across a directory, package, or entire project. Runs `$complexity` first to identify targets, then works through them in priority order (highest complexity first).
`<scope>` can be:
- A directory path (`cli/internal/`)
- A package name (`goals`)
- `all` (entire project -- use with caution)
### 3. Extract Mode
```
$refactor --extract <pattern>
```
Extract method, class, or module from a target. The `<pattern>` describes what to extract:
- `method:<function-name>` -- extract a section of a long function into a named helper
- `module:<file>` -- split a god file into focused modules
- `class:<class-name>` -- extract a class into its own file
## Core Principle
**Every refactoring step must be verified by running tests before proceeding to the next step.**
No batching. No "I'll run tests after all changes." Each transformation is atomic:
```
Transform -> Test -> Pass? -> Commit -> Next
|
No -> R