This is something I've been training and forcing myself to do. If I spend 10 - 15 minutes thinking about some piece of code or infrastructure to understand why it's here and what it does... add whatever you learned and found out as a comment. Even, or especially if it wasn't fruitful, and your only answer is "the system is being weird here in the following way, and this mess is here to fix it, kind of, in most cases - and since you're here, I guess not in this case".