Incremental Legacy Module Refactor
Refactor a hard-to-maintain module incrementally without changing behavior, with checkpoints per step.
Prompt
Style:
Interactive Fill-in (Auto replaces below)
I need to refactor this module incrementally (each PR mergeable alone, behavior unchanged).
**Module path**: {path}
**Pain points**: {e.g. long functions, tight coupling, no tests}
**Constraints**: {e.g. public API frozen, Node 18}
Provide:
1. Current-state diagnosis (3–5 bullets)
2. Target architecture (prose)
3. Step-by-step plan; each step: work, verification, risk
4. Concrete first-step change list
Prefer extract-function → add tests → restructure. No big-bang rewrite.Copy & open AI model directly:
Recommended companions
Install these MCP servers or Skills so the AI can pull repo, docs, or browser context automatically.