Re: Can some of that knowledge be codified?
I have been known, when trying to fix code, to document crap code to the best of my understanding. There are a couple of times when I might have gone to extremes (the comments documenting the fix were at least a screenful in length), but at least whoever comes after has the benefit of what I managed to decipher.
"Beware of bugs in the above code; I have only proved it correct, not tried it."
-- Donald Knuth