Honest question: Would a sci-fi show with the same premise of NCIS or JAG actually work? Do these courtroom Trek episodes work because we have many more episodes with other things going on?
Lary Niven was written some good scifi detective stories but the difficulty is that the mystery has to be solvable for it to be a good detective piece and it has to be leaning on things that don't exist in our world for it to be scifi. To make a mystery solvable and not feel like the answer is pulled out of nowhere the "rules" of the scifi part have to be clear and firm and we'll established. Unfortunately this is very difficult to pull off; Lary Niven is a top of the line scifi author but even he only managed to make about half of his scifi detective stories really work. It would be a moments undertaking to squeeze enough creative juice out for even a handful of scifi mysteries in a series I think. It would be fucking awesome though.
Possibly the worst part of a bad detective story is relying on information not knowable to the reader until the big reveal at the end. I, for one, love stories that are puzzle-boxes that are solvable by the reader (in a way). Remove all familiarity to the story's setting, as you do in sci-fi, and you now have to thread world-building alongside the mystery while not giving the whole plot away. And therein lies the temptation to toss out the puzzle-box premise and just drag the reader passively along for a ride; it sounds really hard to do. I'd give full credit to Mr. Niven: a 50% success rate sounds impressive, all things considered.
I'm glad to see that my point was so well understood! You and I are on the exact same page. I think Lary Niven did very well all things considered and I hope that the next generation of great writers will do even better.