Plan a major dependency upgrade
Prepare for a major library or framework upgrade: breaking changes, code to update and a safe rollout order.
Plan a refactor as small, reversible steps that keep tests green, instead of a risky big rewrite.
Create a refactoring plan for the {{language}} code below.
Goal of the refactor: {{goal}}
Constraints: {{constraints}}
Test coverage today: {{coverage}}
Code:
{{code}}
Produce:
1. Diagnosis: the 3-5 concrete problems in this code (name the specific functions, classes or lines) and how each one blocks the goal. No generic advice.
2. Target shape: a short description or sketch of the structure after the refactor (modules, key function signatures, data flow).
3. Ordered steps: each step must be small enough to ship on its own, leave the behavior unchanged, and be verifiable. For each step give what changes, how to verify it, and the risk level.
4. Safety net: if coverage is weak, the characterization tests to write first, and exactly which behaviors they should pin down.
5. What not to touch: related cleanups that are tempting but out of scope.
6. Stop points: where the work could pause and still leave the code better than before.
If the goal and constraints conflict, say so and offer the two best tradeoffs.Ordering the work as shippable steps with verification keeps the plan useful in a real team. Naming what not to touch prevents scope creep.
Licensed CC0 (public domain) Version 1 · history
Prepare for a major library or framework upgrade: breaking changes, code to update and a safe rollout order.
Plan a database, framework or infrastructure migration with phases, rollback points and verification at each step.
Make tangled code easier to read and change without altering behavior, with every edit explained.
Draft a design doc with goals, options, a recommendation and risks, ready for team review.
Port code to another language so it reads like native code, with notes on behavior differences and gotchas.
Review an API design for consistency, evolvability, error handling and security before you ship it.
Comments (0)
Sign in to join the discussion.
No comments yet. Be the first to share how it worked.