Refactoring Safely

Community

Refactor with confidence, never break working code.

Authorbarrydobson
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill prevents accidental introduction of bugs during code improvements by enforcing strict rules: tests first, one change at a time, and never mixing refactoring with bug fixes or new features. It ensures structural changes don't alter behavior, making refactoring a low-risk activity.

Core Features & Use Cases

  • Tests-First Mandate: Requires passing automated tests before any refactoring begins, guaranteeing behavior preservation.
  • Atomic Changes: Enforces making only one structural change (e.g., extract one method, rename one variable) per test-and-commit cycle.
  • Separation of Concerns: Strictly forbids combining refactoring (changing HOW) with bug fixes or feature additions (changing WHAT) in the same commit.
  • Use Case: When you find a bug while extracting a method from a large function, this skill guides you to git stash your refactoring, fix the bug in a separate commit with its own test, then git stash pop and continue refactoring.

Quick Start

I need to refactor a complex Python function. Guide me through the safe refactoring process, ensuring I have tests, make one change at a time, and know what to do if I discover a bug.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: Refactoring Safely
Download link: https://github.com/barrydobson/dotfiles_extra/archive/main.zip#refactoring-safely

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.