tdd-workflows-tdd-refactor

Use when working with tdd workflows tdd refactor

Author

Install

Hot:1

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-tdd-workflows-tdd-refactor&locale=en&source=copy

TDD Refactor - Test-Driven Secure Code Refactoring Tool

Skills Overview


TDD Refactor is a refactoring tool built on the Test-Driven Development (TDD) philosophy. With the help of the intelligent agent from tdd-orchestrator, it enables developers to refactor safely under full test protection—ensuring that all tests remain green while improving overall code quality.

Use Cases


  • Eliminating Code Smells - When the code shows smells such as duplication, overly long methods, large classes, etc., this skill can systematically detect and remove these smells: extract methods and classes, and apply appropriate design patterns.

  • Improving Architecture Quality - When applying SOLID principles, design patterns, or optimizing performance, this skill provides a complete refactoring workflow—from analysis to verification—supporting gradual architectural evolution.

  • Modernizing Legacy Code - For legacy code lacking tests, this skill uses an incremental refactoring strategy to help establish a test safety net, enabling modernized changes afterward.
  • Core Features


  • Intelligent Code Analysis - Automatically detect code smells (e.g., duplicated code, long methods, large classes, etc.) and architectural issues. Provide an incremental refactoring plan and compare performance metrics before and after refactoring.

  • Test-Protected Refactoring - While refactoring, continuously run the test suite to ensure all tests pass after every change. Support fast recovery and rollback when tests fail.

  • Design Pattern Application - Recommend and apply suitable design patterns (creational, structural, behavioral, and domain patterns) based on the code context, following SOLID principles to improve maintainability.
  • FAQs

    What’s the difference between TDD refactoring and regular refactoring?


    TDD refactoring emphasizes refactoring under a complete test safety net. After each change, tests are run immediately to verify that functionality isn’t broken. Regular refactoring may lack test protection and can easily introduce hidden bugs. TDD Refactor uses a dedicated orchestrator agent to continuously monitor test status during the refactoring process and provides a recovery mechanism when failures occur.

    What should I do if tests fail during refactoring?


    TDD Refactor provides a clear recovery protocol: if tests fail, immediately roll back the last change, identify the refactoring action that caused the failure, and then try again using smaller incremental changes. The skill recommends using version control for safe experiments and committing code after every successful refactoring so you can always roll back to a stable state.

    What scale of code refactoring is this skill suitable for?


    TDD Refactor supports refactoring everything from small code snippets to large projects. For small changes, it can quickly apply a single refactoring technique. For large-scale legacy code modernization, it supports incremental strategies (e.g., Strangler Fig pattern, Branch by Abstraction), breaking a big refactoring into multiple safe incremental steps. The skill suggests establishing a test baseline before refactoring and choosing an appropriate refactoring pattern based on code complexity.