refactor-code
Installation
SKILL.md
Refactor Code Workflow
This skill ensures you refactor code safely by verifying behavior before and after changes.
Workflow Steps
1. Pre-Check (Safety Net)
- Verify Current State: Run existing tests for the target module. They must pass before you touch anything.
- Backup: If no tests exist, strongly consider creating a "Snapshot Test" or backup file first.
2. Strategy
- Identify Goal: What are you improving? (Readability, DRY, Performance, Security).
- Plan: Decide which classes/methods will be extracted, renamed, or simplified.
3. Execution (Refactoring)
- Apply Changes: Perform the refactoring steps (Extract Method, Rename Variable, Introduce Value Object, etc.).
- Keep Logic: Do NOT change the business logic or external behavior.