book-legacy-code

Use when the user explicitly asks for the Working Effectively with Legacy Code lens, book-legacy-code, or this skill by name.

gaofeng21cn/opl-skills10 installsApache-2.0Synced Aug 22

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI

Agent Skills format with YAML frontmatter. Claude Code reads it as-is.

---
name: "book-legacy-code"
description: "Use when the user explicitly asks for the Working Effectively with Legacy Code lens, book-legacy-code, or this skill by name."
license: "Apache-2.0"
---

# Apply The Legacy Code Lens

Gain control before redesigning:

1. State the requested behavior change and behavior that must remain.
2. Identify the change point and the nearest observable effect.
3. Characterize uncertain behavior with the smallest reliable test or observation path.
4. Create the smallest seam needed for sensing or substitution.
5. Break only the dependency that blocks feedback: construction, global state, time, environment, framework object, I/O, or hard collaborator.
6. Make the behavior change, verify it, then refactor locally.

Keep behavior changes separate from broad cleanup. Use sprout/wrap or extraction techniques only as temporary change-enabling moves, and remove test-only or subclass tricks when safer structure exists.

Do not launch a rewrite merely because the current design is unpleasant.

More Refactoring skills

← All Refactoring skills

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY