There is this misconception that software engineering comprises of several people getting together and writing code to meet an end goal but that is not what it is about. You will never see a car manufacturer building a car without some kind of plan, they have an entire dedicated team to the research and development of their next car.
Software engineering is the same process, whenever I try to develop something. I first close my IDE and do not even think of the code as the code is merely an implementation detail. In my document, I write what approaches I want to take when doing something or what it is that I am trying to achieve and from there, I start to flesh out the smaller implementation details of the project.
I would much rather write out the possible unit test cases as this is more important than the code itself. The code can be ugly, and it can be messy but as long as the unit tests pass and we have accounted for all the edge cases that we can identify upfront then I am happy with whatever is needed to achieve the desired goal.
You will often find that important decisions get lost if they are not tracked properly. This can lead to a lack of accountability in the team and unintentional forms of gaslighting where people cannot remember that they agreed to something and when you raise it as a concern then it becomes a problem or it does not get taken seriously.
I try my best now to ensure that any decision that is made by the team is tracked and acknowledged in writing before moving on to the next step, this will save you in the long run.