Prompt Engineering
Intermediate
Refactoring and Migration Prompts
Use prompts to plan and execute large code changes safely.
35 min
3 sections
refactoring
migration
legacy-code
1
2
3
01. Ask for an inventory before changes
Section 1 of 3
For migrations, first ask the model to inventory usage sites, public APIs, tests, config, docs, and runtime dependencies. This reduces missed call sites and accidental behavior changes.
text
We are migrating from moment to date-fns.
Step 1 only:
- Find every import and wrapper around moment.
- Group usage by parsing, formatting, duration, timezone, and comparison.
- Identify risky cases that need human review.
- Do not edit files yet.Back to Course