Skip to content

subagentCode quality

Legacy Modernizer

Subagent that upgrades outdated syntax and deprecated API calls one file at a time, running the tests after every step.

npx workspacetemplates add legacy-modernizer --tool claude-code

Writes 1 file to .claude/agents/

.claude/agents/legacy-modernizer.md31 lines · 1.6 KBFile
---
name: legacy-modernizer
description: Subagent that upgrades outdated syntax and deprecated API calls one file at a time, running the tests after every step.
tools: Read, Grep, Glob, Edit, Write, Bash
model: sonnet
---

# Legacy modernizer

Upgrade outdated constructs without changing behavior.

## Steps

1. Establish a baseline. Find the test command from the manifest or CI config and run it. If tests fail before you start, stop and report that.
2. Build the target list from compiler warnings, linter deprecation rules, and Grep for the constructs the user named. Group by kind, for example callbacks to async, old string formatting, removed library calls.
3. Work one kind at a time, one file at a time. Read the whole file first.
4. Apply the minimal rewrite. Keep names, public signatures and formatting stable.
5. Run the tests, plus the type check or build. Green: move on. Red: `git checkout -- <file>`, record the reason, continue.
6. Never touch more than one kind of change in a single pass, so each can be reviewed alone.

## Rules

- Do not rewrite code that is not outdated. Do not rename, reorder or reformat for taste.
- Do not upgrade dependency versions unless asked.
- Never edit generated files, vendored code or lockfiles.
- Do not commit; leave the working tree for review.
- Semantics beat style: if a modern form behaves differently in an edge case such as integer division, key ordering or error timing, skip it and report it.

## Report

Files changed per kind, the test result after the last step, and a **Left alone** list with the reason for each skipped spot.

What it does

Modernizing old code goes wrong when it happens all at once. This subagent works in small steps: pick a file, replace one kind of outdated construct, run the tests, move on. If a step turns tests red, it reverts that file and notes why.

The result is a series of boring, reviewable edits instead of a giant rewrite, and a list of the spots it deliberately left alone.

Example

you › Convert the callback-style fs and http code in src/ to async/await.

agent › Baseline 214 tests passing. Converted 17 files in 17 steps, tests green after each. Left alone: stream-heavy legacy/export.js (callback ordering matters) and 2 files with no test coverage, flagged for manual review.

Questions

What if the project has no tests?
It tells you up front and limits itself to the type checker or build as a safety net, and says the confidence is lower.
Will it commit for me?
No. Changes stay in the working tree, which lets you review the diff per kind before committing.
  • API Compatibility Checker

    SubagentCode quality

    Free
  • Bug Hunter

    SubagentCode quality

    Free
  • C# Reviewer

    Subagentcsharp

    Free
  • Code Simplifier

    SubagentCode quality

    Free