---
name: refactor-assist
description: Guide safe, incremental refactoring of existing code. Identify refactoring opportunities, suggest patterns, and ensure behavior is preserved through the process.
---

# Refactor Assist

Safe, step-by-step refactoring with behavior preservation guarantees.

## Refactoring Patterns

- Extract function / extract method
- Introduce parameter object
- Replace conditional with polymorphism
- Decompose large classes
- Remove dead code
- Inline temporary variables

## Usage

```
Refactor src/services/user.ts:
- Goal: reduce function length below 30 lines
- Constraint: don't change the public API
- Verify: run existing tests after each step
```

```
Find refactoring opportunities in the auth package
Priority: complexity reduction
```
