tdd-refactor-guard

Detect insufficient test coverage and generate characterization tests before refactoring.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/ano4l/SiteRent --skill tdd-refactor-guard-ano4l
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-refactor-guard
Source: https://github.com/ano4l/SiteRent/tree/main/skills/testing/tdd-refactor-guard
Command: npx skills add https://github.com/ano4l/SiteRent --skill tdd-refactor-guard-ano4l

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures there is existing test coverage before AI-assisted refactoring and automatically generates characterization tests when coverage is insufficient.

Core Features & Use Cases

  • Verifies public API surface coverage for planned refactors and identifies missing tests.
  • Proposes generation of characterization tests to capture current behavior before changes.
  • Guides safe refactoring by providing a decision framework (proceed, needs tests, or stop) based on coverage quality.

Quick Start

Initiate a refactor and let the guard verify existing tests and generate characterization tests if coverage is insufficient.

Frequently Asked Questions about tdd-refactor-guard

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

FAQPage Schema
How do I ensure there is enough test coverage before AI-assisted refactoring?

Ensure test coverage before AI-assisted refactoring by verifying the public API surface and validating existing tests. The guard assesses coverage quality and provides a decision framework to proceed, generate missing tests, or stop changes entirely.

What are characterization tests and when do I need them for a code refactor?

Characterization tests capture the current behavior of code before changes are made. You need them for a code refactor when existing test coverage is insufficient, ensuring safety by automatically generating regression tests for the untested public API surface.

How do I safely clean up code across multiple files and modules without breaking existing behavior?

Safely clean up code across multiple files and modules by assessing public API surface coverage and validating existing tests first. The guard identifies missing regression tests across modules and proposes characterization tests to capture current behavior before changes.

What is the best way to guard against regressions during AI-assisted code cleanup?

The best way to guard against regressions during AI-assisted code cleanup is to validate existing tests and assess the public API surface beforehand. The guard provides a clear decision framework: proceed with the refactor, generate missing characterization tests, or stop.

Can I use this guard to refactor code if my existing tests do not cover the public API surface?

Yes, you can refactor code even if existing tests do not cover the public API surface. The guard detects insufficient coverage and automatically proposes or creates characterization tests to capture current behavior, ensuring the refactor is protected by regression tests.

Why does my AI-assisted refactor need a decision framework for test coverage?

Your AI-assisted refactor needs a decision framework for test coverage to prevent breaking existing behavior. The guard evaluates the public API surface and returns a proceed, needs tests, or stop decision, ensuring refactors only happen when regression safety is verified.