refactor
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
- Read before changing — Never refactor code that has not been read and understood. Understand all callers and dependencies first.
- Test before and after — Run the full test suite before starting. Run it again after every incremental change. The results must match.
- Characterization tests first — If test coverage is insufficient for the target code, write characterization tests that capture current behavior BEFORE refactoring.
- Incremental changes — Make one small, verifiable change at a time. Never combine multiple refactoring steps into a single edit.
- No feature changes — Do not add features, fix bugs, or change behavior during refactoring. These are separate tasks.
More from mgiovani/cc-arsenal
find-skills
Discover and install third-party agent skills from the skills.sh ecosystem.
36agent-browser
Headless browser automation CLI optimized for AI agents. Uses snapshot + refs system for 93% less context overhead vs Playwright. Purpose-built for web testing, form automation, screenshots, and data extraction.
12jira-cli
Interactive CLI for Atlassian Jira issue, epic, and sprint management.
9git-commit
Generate conventional commits following conventionalcommits.org specification.
8inject-docs
Inject framework-specific best practices into CLAUDE.md. Supports Next.js
7implement-feature
Implement features with senior staff engineer best practices and parallel
7