We all have faced it. Bugs are a part of the software development lifecycle. However, we sometimes miss some small things. For example: adding that null check where required or repopulating that cache after clearing it.
TDD is an answer but I feel that it does not always help.