Workflow Refactoring

Modernize Legacy Code

Incremental workflow for updating old code to modern patterns

refactoringlegacymodernization
CLAUDE.md

When modernizing legacy code:

  1. Add tests for the current behavior first. You need a safety net before changing anything.
  2. Make one type of modernization at a time: don’t mix syntax updates with logic changes.
  3. Start with low-risk changes: var to const/let, callbacks to async/await, require to import.
  4. Progress to structural improvements: extract classes, add types, improve error handling.
  5. Run the full test suite after each change.
  6. Don’t modernize code that’s scheduled for removal or rewrite. Focus effort on code that will live.
  7. Ship modernization changes separately from feature work — never in the same PR.

Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.

get crystl