In my experience I have learned, with difficulty and by imposing humility on my pride, that often one's code can be improved.
There are several ways to achieve the same result, some are much better, others are more context-appropriate.
Analyze the context and purpose
Take your time for analysis
It can help you write down on paper or represent the situation schematically
You have to be far-sighted in the solution, it will have to work even in 10 years with new technologies
Dividi et impera: granulate your code, simplify it into sub-tasks
Take breaks where you think about other things and then look at what you have written critically: "How or where can I improve?"
Compare yourself to other devs! When I am stuck, by exposing the problem I find the solution or I am provided with points of reflection.
Details matters: it is precisely the details that give that sense of quality; without these the evaluation could be good or very good, while paying attention to the details the evaluation will be excellent.