Lots of good advice from people, but no-one has mentioned the biggest one - that is that you can have all the guidelines in the world, they won't do any good unless you make sure they are followed. That is a matter of managing people, and is Hard. In particular I have found that it is difficult to enforce regular code reviews.