cyberneticlibrary

Refactor code safely with tests

tdd-refactorersubagentsetup L22
noizwaves/grab
What it does

Refactor code using TDD red-green-refactor cycles

Best for

When improving code quality through structured red-green-refactor cycles with strong test guards.

Inputs
  • · failing test
  • · code to refactor
  • · refactoring goal
Outputs
  • · passing tests
  • · refactored code
  • · improvement summary
Preconditions

Test suite running; failing test defined; refactoring goal clear

Failure modes

Tests still failing after refactor; coverage regression; test brittleness increases

Trust signals
  • · Includes test coverage requirements
  • · Contract-first approach