refactoring

Apply behavior-preserving refactorings to restructure code during TDD phases.

26|Updated Feb 5, 2022
One-click install
npx skills add https://github.com/atusy/dotfiles --skill refactoring-atusy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring
Source: https://github.com/atusy/dotfiles/tree/main/dot_claude/skills/refactoring
Command: npx skills add https://github.com/atusy/dotfiles --skill refactoring-atusy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guide engineering teams to safely transform codebases by applying behavior-preserving refactorings without altering observable behavior.

Core Features & Use Cases

  • Identify code smells and select appropriate refactoring patterns from Fowler's catalog.
  • Incrementally improve structure through small, auditable steps aligned with a TDD workflow.
  • Maintain tests and behavior while restructuring for readability, maintainability, and future extensibility.

Quick Start

Start a targeted refactor by selecting one code smell, applying one behavior-preserving pattern, and running the test suite after each step.

Frequently Asked Questions about refactoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely refactor code without changing its external behavior?

To safely refactor code, you identify code smells and apply behavior-preserving transformations from Fowler's catalog incrementally. You apply one pattern at a time and run the test suite after each step to ensure external behavior remains unchanged.

What is the best way to handle code smells like duplication and long methods during a TDD workflow?

Handling code smells like duplication and long methods during a TDD workflow involves selecting appropriate refactoring patterns and incrementally improving code structure. You maintain tests and behavior by applying small, auditable steps during the REFACTOR phase.

Can I use this refactoring approach across any programming language project?

Yes, this refactoring approach applies to codebases across any language project. It guides you to restructure code for readability and maintainability by selecting one code smell, applying one pattern, and running tests to verify behavior.

When do I commit changes while restructuring code to improve maintainability?

You should commit changes only when all tests pass during a refactoring session. This ensures that each behavior-preserving transformation maintains robust software structure without altering observable behavior or introducing regressions.

What are the limitations of applying multiple refactoring patterns at once?

Applying multiple refactoring patterns at once limits auditability and increases the risk of altering external behavior. The process requires applying one behavior-preserving pattern at a time and running tests after each step to guarantee safety.