Know where you are going and what you are going to do.
Draw out a plan for you code before you start writing software for your next commit. This way, you’ll have a much stronger idea of what tests need to be written, what objects and methods will be involved, and what you need to integrate with.
Having a plan is called software architecture. Always know where you are going. Coding aimlessly and randomly will lead to trouble, rework, and delays.
It is good to enlist help in designing your plan. If you can easily explain your plan to another person, then you know it is a good plan. If they squint and furrow their brows and can’t follow your line of thought, then you need to improve or simplify your plan.