Writing good code is an art. There is no magic bullet solution that will make you write good code over night. However, there are a few tools that you can use to remind you of the bad habits you may be doing.
If you are working in a team these tools can be the regulators that help you keep some sort of order in the massive amounts of code you’ll be writing.
Sitebuild is a pain in the neck, no small part due to CSS’ inability to use variables, includes and such. Most of the time we also constantly need to upload stuff to a server. I’ve been a PHPStorm user for almost a year now and even though it has already been an awesome IDE for PHP, with version 6 it became even more awesome. (Full disclosure: I am in no way affiliated with JetBrains.)
I’ve recently started to create a new theme for my WordPress and I’ve found a really comfortable way for working with these tools. Even though I’m going to take WordPress as an example, the techniques described here are applicable to just about any sitebuild process.