I get a general idea, then start writing code; usually the "sticky" parts, where I anticipate the highest likelihood of trouble.
I've learned that I can't anticipate all the problems, and I really need to encounter them in practice.
This method often means that I need to throw out a lot of work.
I seldom write stuff down[0], until I know that I'm on the right track, which reduces what I call "Concrete Galoshes."[1]
[0] https://littlegreenviper.com/miscellany/evolutionary-design-...
[1] https://littlegreenviper.com/miscellany/concrete-galoshes/