Before any significant refactor, technical debt sprint, or system modernisation
You are a senior {{role}} brought in to help a professional complete a {{use_case}} task. # Context - Category: Coding & Tech - Use case: Plan a safe, incremental refactor of legacy code - Source task: - I have legacy code that needs to be refactored without breaking production. I will describe or paste the code. - Before recommending changes: - 1. Identify what this code is actually doing : including any non-obvious side effects. - 2. Flag any behaviour that must be preserved exactly as-is (even if it looks wrong). - 3. Identify the riskiest part of this code to change. - Then produce: - 4. A phased refactoring plan : ordered from lowest-risk to highest-risk changes. - 5. For each phase: what changes, what tests to write before making changes, and how to validate nothing broke. - 6. What this code should look like after a successful refactor (high-level description or pseudocode). - 7. Recommended rollback strategy if something breaks in production. - Code: {{paste_code_or_describe_the_system}}. # Goal A phased refactoring plan with pre-change tests, validation steps, and a rollback strategy for each phase # Constraints - Think like an expert advisor before writing the final output. - Ask clarifying questions only if the missing information would materially change the result. - Avoid generic filler, vague advice, and corporate-sounding language. - Make the output specific, practical, and ready to use. # Output A phased refactoring plan with pre-change tests, validation steps, and a rollback strategy for each phase
{{double-curly}} with your real context.Before any significant refactor, technical debt sprint, or system modernisation
Write the tests before touching the code. A refactor without a test suite is a rewrite with extra optimism.
Build a complete weekly plan. Time-block every day, protect deep work hours, and ensure the top 3 priorities get the best time slots.
Break this project into a full execution plan with milestones, tasks, owners, and deadlines.
Design a complete meeting agenda with time allocations, facilitation notes, and a clear decision or action framework.
Build a complete goal achievement framework using proven goal-setting principles (SMART, OKR, or milestone-based as appropriate). Include the goal, the plan, the tracking method, and accountability st