Get a good feedback loop for yourself. Find someone to review your code, especially someone who is picky about good standards and has been coding, and had their own code reviewed for a while. (If their answer is "what's a code review?" or "hmm, I've never reviewed code before", I'd pass on that person.)
Basically it's like any other profession & skill, you get better when you get constructive feedback regularly. Surround yourself with people better at the skill than you, if possible.