A twist on step 2: write code about it.
When you teach, you can take the paths you're comfortable with and gloss over the fuzzier concepts. When you code, you have to take every path, and get it right.
I write about German taxes and bureaucracy. A few years ago, I wrote a detailed guide about German health insurance. It went through several rounds of revisions with help from a few different experts.
Yet building a health insurance calculator exposed big gaps in my understanding. This happened again with two more calculators I wrote. I had to revise so much content after the unit tests passed!