refactor

Installation
SKILL.md
Contains Hooks

This skill uses Claude hooks which can execute code automatically in response to events. Review carefully before installing.

Refactor

Refactor code safely using characterization tests, incremental changes, and continuous verification. Every change preserves existing behavior while improving code structure, readability, and maintainability.

Refactoring Goal

$ARGUMENTS

Core Principle: Behavior Preservation

CRITICAL: Refactoring changes code structure WITHOUT changing behavior. Every step must be verified against existing tests. If tests break, the refactoring introduced a bug — revert and retry.

Anti-Hallucination Guidelines

  1. Read before changing — Never refactor code that has not been read and understood. Understand all callers and dependencies first.
  2. Test before and after — Run the full test suite before starting. Run it again after every incremental change. The results must match.
  3. Characterization tests first — If test coverage is insufficient for the target code, write characterization tests that capture current behavior BEFORE refactoring.
  4. Incremental changes — Make one small, verifiable change at a time. Never combine multiple refactoring steps into a single edit.
  5. No feature changes — Do not add features, fix bugs, or change behavior during refactoring. These are separate tasks.
Related skills
Installs
7
GitHub Stars
4
First Seen
Mar 26, 2026