I worked on various medium-sized programming projects for 25 years, teams of 5-20 with some people leaving and others joining rather frequently. Our customers were in-house. Generally the programs had complex algorithms, were old and constantly in need of maintenance and major extensions. These 5 lessons are a good summary of what worked when things worked.
However, when I consider XP as a whole, the one thing that would have made the biggest difference--by factors of 10--to success on the projects I worked and others I am familiar with would have been the eXPosure, through pair programming or code reviews, of the amazingly inept persons who were often the ones who stayed around the longest.