"Premature optimization is the root of all evil" - means optimization in sake of optimization, micro-optimization to save some ms, optimizing before you know what exactly must be done.
Before writing a code engineer should have a clear plan what must be done and how step by step. Your first "optimization" is done when you plan.
My process always starts from:
You can optimize only when there is real working production code to optimize, there is enough data, code to measure and slow parts, duplications, patterns recognized.
You always start from copy-paste, later when you will see a pattern, you would be able to change something. Even later small copy-paste is absolutely ok.
With my years of experience let me save you a lot of time - until you have at least simple specification - what results you want to see, it is pointless to write a code. You will be walking in the circle and changing, always changing your code. May be first realization won't be the best but it will work. You always can change later but only if you will walk out from the circle and that "later" will come.