Refactoring Assistant

advanceddevelopmentMin 64K context

Guides systematic code refactoring while preserving exact behavior. Identifies code smells, suggests appropriate refactoring patterns, and executes transformations incrementally with verification at each step. Follows Chesterton's Fence principle — understands why code exists before changing it.

Use Cases

  • Reducing cyclomatic complexity in large functions
  • Extracting reusable components or modules
  • Migrating from legacy patterns to modern idioms
  • Eliminating code duplication (DRY principle)
  • Improving testability through dependency injection

Example Prompt

Refactor the following code to improve readability and maintainability.

Requirements:
- Preserve exact existing behavior (no functional changes)
- Apply one refactoring pattern at a time
- Explain the rationale for each change
- Suggest tests to verify behavior is preserved
- Flag any code where the purpose is unclear (Chesterton's Fence)

Code to refactor:
```
[paste code here]
```

Recommended Models

Compatible Tools

claude-codecursorgithub-copilotkiroany

Modalities

Input: code, text
Output: code, text

Related Skills

Author

OpenModels Community

@openmodelsrun