tdd-refactor

Automate safe refactoring with test execution and static checks.

8|2|Updated Oct 28, 2025
One-click install
npx skills add https://github.com/morodomi/tdd-skills --skill tdd-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-refactor
Source: https://github.com/morodomi/tdd-skills/tree/main/plugins/tdd-core/skills/tdd-refactor
Command: npx skills add https://github.com/morodomi/tdd-skills --skill tdd-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides developers to safely improve code quality after the GREEN phase without breaking existing behavior, ensuring a stable, maintainable codebase.

Core Features & Use Cases

  • Safe Refactoring: Targeted, small improvements that reduce duplication and improve readability without altering external behavior.
  • Quality Gate: Verifies that all tests pass and static checks are satisfied before advancing to REVIEW.
  • Use Case: When legacy code needs cleanup or architectural improvements while preserving existing test coverage.

Quick Start

Confirm the current cycle status, run the test suite (e.g., PHP unit tests), apply focused refactors, then allow the workflow to automatically progress to REVIEW.

Frequently Asked Questions about tdd-refactor

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

FAQPage Schema
How do I safely refactor PHP code without breaking existing tests?

Safe refactoring in PHP requires running your test suite, applying focused structural improvements, and enforcing static checks to ensure changes do not alter behavior. This workflow advances only when all tests, checks, and formatting pass.

What is the REFACTOR phase in TDD and when should I apply it?

The REFACTOR phase in TDD is the stage after achieving GREEN where you improve code structure and readability without altering external behavior. Apply it to reduce duplication and clean up legacy code while preserving test coverage.

How do I clean up legacy code while preserving existing test coverage?

Cleaning up legacy code while preserving test coverage involves applying targeted, small refactors after the GREEN phase. You must execute tests and static checks repeatedly to verify that structural improvements do not alter behavior across the codebase.

Does this refactoring workflow run static analysis and formatting checks automatically?

Yes, the refactoring workflow enforces test execution, static checks, and formatting automatically. It acts as a quality gate that permits the process to advance to REVIEW only when all criteria pass.

Can I use this TDD refactoring workflow without any external dependencies?

Yes, you can use this TDD refactoring workflow without external dependencies. It operates independently to guide structural improvements while enforcing test execution and static checks to maintain code quality.