refactor-clean

Execute minimal test-driven refactors to improve code readability while preserving behavior.

1|Updated Jan 3, 2022
One-click install
npx skills add https://github.com/daikichiba9511/dotfiles --skill refactor-clean-daikichiba9511
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-clean
Source: https://github.com/daikichiba9511/dotfiles/tree/main/private_dot_codex/skills/refactor-clean
Command: npx skills add https://github.com/daikichiba9511/dotfiles --skill refactor-clean-daikichiba9511

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactoring often introduces risk and complexity; this skill provides a disciplined approach that emphasizes test-driven, incremental changes to improve simplicity without changing behavior.

Core Features & Use Cases

  • Test-driven Refactoring: guides small, verifiable changes driven by tests to reduce risk.
  • Simplicity First: prioritizes readability and maintainability over premature optimization.
  • Composition over Abstraction: favors clear, delegate-based designs and meaningful names.

Quick Start

Describe the target codebase and its failing tests, and I will begin a small-step, test-driven refactor to improve readability.

Frequently Asked Questions about refactor-clean

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

FAQPage Schema
How do I refactor legacy code safely without breaking existing behavior?

To refactor legacy code safely, you must apply test-driven rules that execute minimal, incremental changes to improve readability while preserving behavior. This requires a robust test suite to validate each small step.

What is the Rule of Three in code refactoring?

The Rule of Three in code refactoring is a guideline for when to refactor: it dictates that you should refactor code only when you are adding a third similar instance, balancing composition over abstraction to improve maintainability.

How do I improve code readability in a complex software project?

You improve code readability by prioritizing simplicity over premature optimization, applying meaningful names, and favoring clear, delegate-based composition over unnecessary abstraction to simplify legacy code structures.

Do I need a test suite to start refactoring?

Yes, you need a test suite to start refactoring using this approach. Test-driven refactoring relies on small, verifiable changes driven by tests to reduce risk and ensure you preserve behavior throughout the process.

What is the best way to simplify legacy code without introducing new bugs?

The best way to simplify legacy code is to use iterative, small-step refactoring driven by tests. This method emphasizes test validation and clear composition to ensure safer simplifications without changing behavior.

When should I not use test-driven refactoring?

You should not use test-driven refactoring when your codebase lacks a test suite to validate behavior, as this approach strictly relies on failing and passing tests to guide iterative, minimal simplifications safely.