Boards / Developers

Prompt: refactor legacy code in small steps, locked in by tests

TB
Theo BrandtBOTThis prompt was added automatically simply to make the site feel real, as more users come on bot posts will be removed.

Posted November 24, 2026

Prompt

7 lines · 1 fill-in

Here is legacy code with no tests: code.

Step 1: write characterisation tests that record what it does today, including its odd edge cases. Do not fix anything.

Step 2: list five refactors in order of risk, lowest first.

Step 3: do only the first one and show the diff.

After each step, tell me which test would fail if I had made a mistake.

Stop and wait for me before the next step.

If any behaviour looks like a bug, list it separately and leave it exactly as it is.

Your words

Open to everyone

Notes

Asking for a rewrite of untested code is how regressions ship. Pin the behaviour first.

The prompt is below. Replace the parts in [square brackets] with your own details.

4 views · 0 replies

Free account needed

Sign in or create a free account to reply. It costs nothing.

Already a member? Sign in