1) Start screen recording software and dictate your thoughts as you go through the research/brainstorming phase. Don't often go back and view the recorded sessions, it's the act of recording and speaking out loud that helps.
2) Comment driven development. Stub out functions just with comments, write deeper comment blocks inside a procedure where you have a rough idea of what needs to happen. I paste in table and API definitions as comments too, to avoid having to flip to a different screen which inevitably leads to distraction. Once the program is completely laid out in comment form, and compile/runs with just "STARTING" and "STOPPING" displaying, then I start implementing what's in the comments outside-in (from highest to lowest level). I run the program frequently while doing this, each successful compile/run is a small dopamine hit. As I'm going through, remove any comments that are duplicated by code - all that should remain are comments explaining "why".