legacy-code-first-contact

Builds characterization-test safety nets around untested legacy code before modification.

1|Updated Jul 3, 2026
One-click install
npx skills add https://github.com/Nandansai08/skillz --skill legacy-code-first-contact-nandansai08
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: legacy-code-first-contact
Source: https://github.com/Nandansai08/skillz/tree/main/skills/software-engineering/legacy-code-first-contact
Command: npx skills add https://github.com/Nandansai08/skillz --skill legacy-code-first-contact-nandansai08

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Changing unfamiliar, untested legacy code risks silently breaking hidden behavior that downstream consumers depend on. This Skill builds a characterization-test safety net that freezes what the code actually does — not what it should do — so modifications become deliberate engineering decisions instead of gambles. ## Core Features & Use Cases - Seam Tracing: Trace from an entry point (route handler, CLI arg, cron job) inward to the change target, verifying behavior by execution rather than trusting names or comments. - Characterization Testing: Capture actual outputs from real production inputs (logs, recorded requests, DB samples) and freeze them as assertions, including surprising behaviors. - Minimal Dependency Breaking: Use extract-and-override or parameterize-constructor techniques to get code under test without risky pre-refactoring. - Use Case: You inherit a 12-year-old billing module with zero tests and must change its rounding logic. Trace the seam, write characterization tests from 50 real invoices, freeze two surprising behaviors, then make the change — only the 3 intended tests fail, confirming no collateral damage. ## Quick Start Use the legacy-code-first-contact skill to build a characterization test suite around this untested module before I change its fee calculation logic.

Frequently Asked Questions about legacy-code-first-contact

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

FAQPage Schema
How do I safely change legacy code with no tests?▼

Write characterization tests first: feed the target real inputs from production logs, capture actual outputs, and freeze them as assertions. This safety net detects any behavior change when you modify the code, letting you decide consciously whether each change is intended.

What is a characterization test and how is it different from a unit test?▼

A characterization test asserts what code currently does, not what it should do. Unlike unit tests that verify correctness, characterization tests freeze existing behavior — including bugs — so changes to untested code reveal unintended side effects.

How do I test legacy code with hard-coded dependencies?▼

Use two minimal dependency-breaking techniques: extract-and-override (subclass and override the method hitting the database) or parameterize-constructor (pass the dependency in, defaulting to the old one). Avoid large DI refactors before tests exist.

When should I not use characterization testing?▼

Skip it for greenfield code or code with a healthy test suite — just change it and run the tests. For freezing a specific reported bug, use a regression test that asserts correct behavior instead of current behavior.

Why do my characterization tests all pass without surprises?▼

Zero surprising assertions usually means the test inputs were too tame or imagined rather than real. Harvest inputs from production logs, recorded requests, or database samples — legacy behavior lives in edge cases like empty strings and legacy enum values.