working-with-legacy-code
SolidSafely change and test untested codebases using Michael C. Feathers' "Working Effectively with Legacy Code". Use when the user mentions "legacy code", "no tests", "untested codebase", "how do I test this", "seams", "characterization tests", "sprout method", "afraid to change this code", "monster method", or "dependency breaking". Also trigger when modifying code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy code change algorithm, seams, characterization tests, sprout/wrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.
Install
Quality Score: 96/100
Skill Content
Details
- Author
- wondelai
- Repository
- wondelai/skills
- Created
- 4 months ago
- Last Updated
- yesterday
- Language
- Shell
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
legacy-code-testing
Adds tests to legacy code that has none, safely: characterization tests that pin current behavior (including bugs) before any refactoring, seam identification for breaking untestable dependencies, and a risk-ranked coverage strategy. Use for untested or inherited codebases. Triggers on: "add tests to legacy code", "this code has no tests", "characterization tests", "make this testable", "safe to refactor?", "pin down current behavior", "test this old module before we change it".
legacy-code-expert
Use this agent when you need to safely modify legacy code that lacks tests. It applies Michael Feathers' dependency-breaking techniques from "Working Effectively with Legacy Code" to identify seams, plan characterization tests, and recommend safe transformation paths.
refactoring
Use for refactoring, behavior-preserving change, tests, and safe rewrites.