TDD is particularly valuable (I'd even say unavoidable) when writing modules, libraries and so on. It's extremely helpful on some tough program parts that aren't enough defined in behaviour by the spec. Writing tests first in these case will avoid you countless traps, particularly in "the other 90%" as mentioned in the Cargill's law:
"The first 90 percent of the code accounts for the first
90 percent of the development time. The remaining 10 percent
of the code accounts for the other 90 percent of the
development time."
—Tom Cargill, Bell Labs