Characterization Testing

Create characterization tests that document current legacy code behavior.

2|Updated Oct 16, 2025
One-click install
npx skills add https://github.com/spacholski1225/cc-config --skill characterization-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Characterization Testing
Source: https://github.com/spacholski1225/cc-config/tree/main/skills/refactoring/characterization-testing
Command: npx skills add https://github.com/spacholski1225/cc-config --skill characterization-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Characterization testing captures current behavior of legacy code, providing a safety net before refactoring by documenting what is actually happening rather than what should happen.

Core Features & Use Cases

  • Document current behavior: Create tests that lock in how code behaves today.
  • Safely guide refactoring: Use the captured behavior to validate changes and prevent regressions.
  • Edge-case coverage and known issues: Add tests for unusual inputs and annotate existing bugs to avoid surprises during future changes.

Quick Start

Identify a small, testable target in the legacy codebase; write a characterization test with unknown expectations; run tests to capture actual output; lock in current behavior; add edge cases and document known issues.

Frequently Asked Questions about Characterization Testing

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

FAQPage Schema
What is characterization testing and when should I use it for legacy code?

Characterization testing documents the current behavior of legacy code by capturing what it actually does, not what it should do. Use this approach before risky refactoring or major changes to establish a safety net when code has no tests or unclear behavior.

How do I create characterization tests to safely guide refactoring?

To create characterization tests, identify a small testable target in legacy code, write tests with unknown expectations, run them to capture actual output, lock in current behavior, and add edge cases to validate future changes and prevent regressions.

How do I handle edge cases and known bugs when documenting legacy behavior?

When documenting legacy behavior, you should add tests for unusual inputs to capture edge cases and annotate existing bugs. This preserves the exact behavior in dedicated tests to avoid surprises during future refactoring or major changes.

Can I use characterization tests if the codebase has no existing tests?

Yes, characterization testing is specifically designed for legacy code that has no tests or unclear behavior. It provides a safety net by capturing observed outputs and locking in the current behavior before you attempt any risky modifications.