LLMs aren't perfect and they have problems, but often they write better code than humans. At least this human.
It seems they run into problems with larger concepts and general organization and need guidance at the moment but for a single code file they often do better then I would have.