First thought:
One of the software development teams I work with has been using xp-style iteration planning and velocity measuring, with cards and points and walls and such.
I was standing in front of the wall, talking with one of the coaches, when the following dawned on me:
I can tell a product owner that by investing x points into making legacy code more maintainable, the team could subtract 1 point from the estimate on each of the cards for stories in that code area.
So if there are, or will be, more than x cards of that type, then it might be worth it to invest the time to improve the code.
Second thought:
There are no a priori best practices
There are only the practices you are using now.
And practices that are better than the ones you are using now.
I’m always impressed by the simple revelations.