Should I refactor code that will run only once?
My answer for this is a solid yes. We humans are habits beings, so, the only way to do something when needed effortless is by turning that into a habit. That means that you need to refactor your code always, even when the code is intended to be run only once. Otherwise, you run into the risk of breaking the habit. We are good at that. Just remember when you started to run everyday and for some reason you missed a couple of days. It was hard to start running again. The same thing happens to whatever habit we want to instill. Even if you always write code that will run only once. Do your job and refactor it and turn it into a library. Chances are that some of it could be reused sometime in the future.