How do mystery writers compose and solve their crimes?

I am starting on a new writing effort, this time it’s a series of short stories about two brothers that solve crimes. One is free and easy and very creative while the other is analytical, left-brained, literal, and very socially awkward. They sort of dove-tail their skills and perspectives into a unique relationship that is greater than the sum of their parts.

Since it is their mission to solve crimes, as a writer I need to create those crimes. Therein lies the problem. I’ve never written a crime story. Ever. I love shows like CSI and Criminal Minds and have always wondered how the writers contrive their stories. Do they concoct the crime first and then figure out how the good guys solve it? Or do they focus entirely upon the good guys and unravel the mysteries of the crime as it unfolds without any internal prior knowledge of how the dastardly deed was perpetrated?