My general flow is “do it, teach it, automate it” where the middle step is explaining it to someone else who then also does it then (hopefully) helps, or at least consults, on the automation. This way you can iterate a bit before codifying it and help flush out any bad ideas or assumptions.