You are headed to add a new piece of code. Unbeknownst to you, it already exists in the system. If you find out about the pre-existing code, you have had a HappyCollision. If you don't, duplication has stealthily propagated.
Follow the OneResponsibilityRule -- If every class has a clear responsibility, you'll know right where to go to add your current enhancement.
LotsOfShortMethods -- So that, when you go to add the method to the class it belongs in, you'll find out if someone else has already done it. If not, at least the next guy will.
Hold StandUpMeetings -- Tell everyone working on the codebase what you did the previous day. If you say, "I added this great BlizQuazzler class," someone else on the team might have the insight to ask you why you didn't just reuse the QazzleBlizzer class.
It is surprising how often this can bite you in the behind even in a one man project. On my path to building the HtagLanguage system for web development I came across a spurious problem (bug). It seemed to stem from the urlencoding routines. Strangely when logging code was added the routine was obviously not entered. Eventually it turned out that there were no less then 3 different sets of urlencode and urldecode both as methods and as functions. And each one could be called depending on scoping and location in the class hierarchy. The highest grade of duplication and code smell! So maybe it would be useful to have standup meetings with oneself as well.
Is there XP advice I can follow in very large one-man "team" efforts?