tdd-refactor-guard

Verify test coverage before AI-assisted code refactors.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/jtvaris/sunday-night-dynasty --skill tdd-refactor-guard-jtvaris
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-refactor-guard
Source: https://github.com/jtvaris/sunday-night-dynasty/tree/main/.agents/skills/testing/tdd-refactor-guard
Command: npx skills add https://github.com/jtvaris/sunday-night-dynasty --skill tdd-refactor-guard-jtvaris

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pre-refactor safety ensures AI does not modify code without verifying test coverage, reducing risk of regressions during automated refactors and providing a guardrail for change.

Core Features & Use Cases

  • Verifies existing test coverage before any AI-assisted refactor.
  • Assesses public API surface, dependencies, and side effects to scope refactors safely.
  • Generates characterization tests when coverage is insufficient to preserve current behavior.

Quick Start

Run the Refactor Guard to validate test coverage for the targeted code before refactoring

Frequently Asked Questions about tdd-refactor-guard

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

FAQPage Schema
How do I verify test coverage before an AI-assisted code refactor?

To verify test coverage before an AI-assisted code refactor, evaluate the public API surface, dependencies, and side effects. This process checks existing tests to ensure adequate coverage and prevents regressions during automated modifications.

What are characterization tests and when do I need them for refactoring?

Characterization tests capture and lock in the current behavior of existing code. You need them for refactoring when current test coverage is insufficient, allowing you to safely modify code without altering its original outputs.

How do I safeguard my codebase against regressions during automated refactoring?

Safeguard your codebase against refactoring regressions by enforcing a pre-refactor safety check. This validates that existing tests cover the targeted code, assessing API boundaries and side effects before any AI modifications are applied.

Can I generate missing tests automatically before modifying code?

Yes, you can generate missing tests automatically before modifying code. When pre-refactor analysis reveals insufficient test coverage, characterization tests are generated to preserve current behavior before proceeding with changes.

Do I need existing tests to use TDD refactor guard?

You need existing tests to initiate a safe AI-assisted refactor. If the evaluation finds the current test coverage insufficient for the targeted code, the guard can generate characterization tests before proceeding.

What is the best way to scope refactors safely in a large codebase?

The best way to scope refactors safely is to assess the public API surface, dependencies, and side effects of the targeted code. This ensures modifications are contained and covered by adequate test verification.