Refactoring Plan for a Tangled Module
Break a messy module into safe, tested steps.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
Plan a refactor for this module: [CODE_OR_DESCRIPTION]. Language and framework: [STACK]. Existing tests: [TEST_STATUS]. Pain points: [PAIN_POINTS]. Time available: [TIME]. First propose characterisation tests to lock current behaviour before changing anything. Then break the work into small steps, each leaving the code working: rename for clarity, extract functions, remove duplication, isolate side effects, introduce interfaces where tests need them. Return a numbered plan with Step, Change, Risk, Test and Time estimate, the order that reduces risk first, a list of behaviours you are unsure about, and criteria for stopping. Do not change behaviour in a refactor; log suspected bugs separately for later. Add a short section on communicating the refactor: what reviewers should look for, how to keep pull requests small enough to read in fifteen minutes, and how to schedule the work around releases. Provide a sample commit message pattern and a list of refactoring moves ranked by risk, from renaming to changing data structures. Explain how to measure improvement honestly, for example by reduced time to add a feature or fewer files touched per change, rather than by lines of code.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.