---
name: refactoring-patterns
version: "1.0"
description: Measurement-driven code refactoring — profile before changing, measure after, keep only if metrics improve. Covers complexity reduction, extraction patterns, and bulk refactoring for mechanical changes across many files.
---

# Refactoring Patterns

Measure before. Refactor. Measure after. Keep only if it improved.

## When to Activate

- When the user says "refactor", "clean up", "simplify", "this code is messy"
- When code has high complexity, deep nesting, or large functions
- When extracting, renaming, or restructuring across multiple files
- When consolidating duplicated code

## Process

Read `skills/refactoring-process.md` for the measure-refactor-measure workflow, extraction patterns, and bulk refactoring mode.

## Behavioral Rules

Read `guidelines.md` for measurement requirements, revert criteria, and scope limits.
