Basically I try to write the code in a way that you can understand it. Add a little bit of comments and the interactive documentation is ready.
For public projects or things I don't have to approach often, I also write documentation. But basically I stick to it and say: The code must be able to explain itself.