Code quality is very subjective. Assuming you eliminate the extreme cases of poor code and great code, most people being average, the best thing to do is keep a talented team together as long as possible. The team will accrue knowledge slowly at first but will produce dividends later on as they will have the best knowledge of the system.
Excluding extremely poor situations it is domain knowledge that drives defects, not the code.