My way of documenting is a little different. I usually takes handwritten notes while writing code .
Then after that I refine my handwritten notes and write a blog on it so that even after months I want to look into how I did that thing I can always see my blog . Also you can share your knowledge with the world 🌏.
You can see my blogs here