Legacy Code Refactoring Roadmap
Create a safe, step-by-step refactoring plan for messy legacy code without breaking production.
Migrating frameworks? This prompt creates a step-by-step migration plan with zero downtime.
You are a software migration specialist who has led 50+ major framework and language migrations without downtime or data loss. Plan my migration. From: [CURRENT FRAMEWORK/LANGUAGE/VERSION] To: [TARGET FRAMEWORK/LANGUAGE/VERSION] Project size: [ROUGH LOC COUNT OR DESCRIPTION — small/medium/large] Team size: [HOW MANY DEVELOPERS?] Can we freeze features during migration? [YES / NO / PARTIALLY] Must-not-break: [CRITICAL FEATURES THAT CANNOT HAVE DOWNTIME] Create a complete migration playbook: 1. COMPATIBILITY AUDIT — What breaks immediately? List every breaking change between source and target with severity. 2. MIGRATION STRATEGY — Recommend one: - Big Bang (rewrite everything at once) - Strangler Fig (gradually replace piece by piece) - Parallel Run (run both, compare, switch) Explain WHY this strategy fits my situation. 3. PHASE PLAN — Break the migration into ordered phases: Phase 1: [scope] — [estimated days] — [risk level] Phase 2: [scope] — [estimated days] — [risk level] 4. AUTOMATED CODEMODS — List any existing migration tools, codemods, or scripts that automate parts of the migration. Include exact commands. 5. TESTING STRATEGY — How to verify the migration works: - Unit test migration approach - Integration test critical paths - Regression test checklist - Performance comparison baseline 6. ROLLBACK PLAN — Exact steps to revert if things go wrong at each phase. 7. GOTCHAS — Non-obvious things that WILL bite you during this specific migration.
MIGRATION: Express.js → Fastify STRATEGY: Strangler Fig — recommended because your API has 47 endpoints and you can't freeze features. PHASE 1 (3 days, Low risk): Set up Fastify alongside Express, route /health and /status to Fastify PHASE 2 (5 days, Medium): Migrate stateless GET endpoints GOTCHA: Fastify's plugin system is different from Express middleware — you can't just copy-paste app.use() calls.
Framework migrations fail when attempted as big-bang rewrites. This prompt creates an incremental migration plan using proven patterns like the strangler fig approach, ensuring your application stays functional throughout the transition with zero downtime.
Use when migrating between frameworks (Angular to React, Express to Fastify), when upgrading major versions with breaking changes, or when you need to move from one database, cloud provider, or architecture pattern to another safely.
You'll get a phased migration playbook with dependency analysis, compatibility layers, parallel running strategies, feature flag approaches, rollback procedures for each phase, and a testing strategy to verify correctness at every step.
Create a safe, step-by-step refactoring plan for messy legacy code without breaking production.
Not just syntax conversion — idiomatic rewrite with pitfall warnings and dependency mapping
Stop forgetting why you made that technical decision 6 months ago. This prompt creates a complete ADR in 2 minutes.
Plan your monorepo structure, tooling, CI/CD, and dependency management before writing a single line of code.
Design a complete CI/CD pipeline — build, test, deploy, monitor — with config files ready to use.