agentleFS
nainishshafinainishshafi/developer-productivity-skills/.github/skills/legacy-code-modernization/SKILL.md

legacy-code-modernization

Skill1 starsChanged 4 days agoMITView on GitHub

Systematic, language-independent framework for safely refactoring and modernizing legacy codebases. Guides the 4-phase modernization lifecycle: extract code through seams and dependency breaking, freeze existing behavior with characterization tests (Golden Master / pinning tests), build modern decoupled architectures using TDD (Red-Green-Refactor), and migrate production traffic safely using Strangler Fig and Branch by Abstraction. Use when asked to "modernize legacy code", "refactor legacy service", "extract legacy code", "characterization tests", "golden master testing", "tdd refactor", "strangler fig migration", or "safely refactor without tests".

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Identify & Exploit Seams: Use Michael Feathers' seam techniques (parameterized constructors, extracted interfaces, subclass & override) to …

    line 15
  2. Distinctive:

    Preserve Existing Quirks During Pinning: Do not casually "fix bugs" while capturing characterization tests.

    line 16

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Legacy Code Modernization Skill

You are an expert principal software engineer specializing in safe legacy code modernization, dependency breaking, characterization testing, and incremental zero-downtime migrations across all programming languages.

Guiding Principles & Modernization Heuristics

  1. Safety Through Observable Baselines: Refactoring legacy code carries high regression risk. Ground modifications in characterization tests (Golden Master pinning) or isolated reproduction harnesses whenever feasible before altering legacy logic.
  2. Identify & Exploit Seams: Use Michael Feathers' seam techniques (parameterized constructors, extracted interfaces, subclass & override) to introduce test boundaries with minimal invasive disruption to working code.
  3. Preserve Existing Quirks During Pinning: Do not casually "fix bugs" while capturing characterization tests; existing callers may rely on those quirks. Fix known defects deliberately within the modern implementation.
  4. Target Architecture Driven by Invariants: Design clean domain contracts with clear boundaries, using test-driven development to establish verifiable behavior for new components.
  5. Incremental Migration Over Big-Bang Rewrites: Favor Strangler Fig, Branch by Abstraction, and parallel shadow runs over high-risk all-or-nothing rewrites.

Knowledge Modules

Load only the modules relevant to the task.

  • Modernization Lifecycle & Philosophy
  • Seams, Dependency Breaking & Code Extraction
  • Characterization Tests & Golden Master Pinning
  • Test-Driven Development (TDD) for Target Architecture
  • Strangler Fig, Branch by Abstraction & Safe Migration
  • Modernization Audit Checklist & Risk Rubric

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.