Short Answer
Writing a detective story means building a fair mystery around an investigator whose method of solving it is as specific as the crime itself. Start with your solution and your key clues, then follow a 7-step structure from premise through revision. The genre succeeds when a careful reader could have solved it alongside your detective, using only what the story showed them.
Examples
1. Cozy mystery: a bakery owner solves a local theft
A small-town bakery owner notices her secret recipe has been stolen by a rival shop and turns amateur detective, using her intimate knowledge of the town's gossip network to identify the culprit before the annual bake-off.
Cozy mysteries promise a low-violence, community-centered puzzle with a charming amateur sleuth; grounding the crime in something as specific as a stolen recipe keeps the stakes personal and the tone light.
2. Hardboiled noir: a PI hired by the person who framed him
A cynical private investigator is hired anonymously to prove his own innocence in a decade-old case, and slowly realizes his mysterious client is the very person who framed him in the first place.
Noir promises moral ambiguity and a detective who is never fully in control; a client who is secretly the original antagonist keeps the genre's trademark distrust alive in every scene.
3. Police procedural: a detective's last case before retirement
A veteran homicide detective one week from retirement catches a case with striking similarities to her very first unsolved case decades earlier, and must decide whether to reopen old wounds to finally close both.
Procedurals promise institutional detail and methodical pacing; a case that echoes the detective's own unfinished history adds a personal deadline to the professional one.
4. Locked-room mystery: a killer among five trapped guests
Five guests snowed in at a remote lodge realize one of them murdered the host, and the amateur detective among them must solve the case using only what's inside the building before the killer strikes again.
The locked-room subgenre promises a contained, fair-play puzzle with a fixed suspect pool; the physical isolation forces the mystery to be solved through logic and observation rather than external investigation.
Step-by-Step Writing Guide
- Decide your solution before you draft a single scene — Detective fiction is one of the few genres where working backward pays off. Know who did it, why, and how before you write your opening chapter, so every clue you plant can be placed deliberately.
- Give your detective a method that is also a limitation — Decide what your investigator is uniquely good at -- memory, expertise, a personal connection -- and what that same trait costs them. A detective's method should shape how the mystery unfolds, not just who solves it.
- Choose your subgenre's core promise and keep it — Cozy mysteries promise low violence and community charm. Noir promises moral ambiguity and distrust. Procedurals promise institutional detail. Decide which promise your story is making to the reader in chapter one, and do not break it later without a very good reason.
- Plant every clue your solution depends on — List the two or three pieces of evidence the solution hinges on, and place each on the page before the reveal, even if their significance isn't obvious yet. Readers should be able to solve a fair mystery on a second read.
- Introduce at least one credible red herring — A mystery with only one suspect isn't a mystery. Give the reader at least one plausible alternate theory that fits the clues almost as well as the truth, so the real solution feels earned rather than obvious.
- Escalate what the case costs your detective personally — Raising the danger (another body, a closer deadline) is the easy version of escalation. The stronger version raises what solving the case costs your detective -- a relationship, a belief about someone they trusted, a piece of their own certainty.
- Reveal the solution through the detective's method, not a confession — Let your detective's specific skill or limitation from step 2 be what actually cracks the case in the final scenes, rather than having the culprit simply explain everything. That is what makes the mystery feel earned rather than delivered.
Common Mistakes
- Introducing the culprit's motive only in the final scene, with no earlier trace of it. Plant at least one visible clue to the true motive earlier in the story, even if its meaning is only clear in hindsight.
- Resolving the mystery through evidence or a confession the reader never saw coming from anywhere. Audit your solution against every scene and confirm the reader had access to the key clues, even if they didn't recognize their importance.
- Giving the detective no personal stake beyond professional duty. Add a specific personal reason the case matters to your detective -- a debt, a memory, a relationship -- so the investigation costs them something beyond time.
- Making every suspect equally plausible with no distinguishing detail, so the reveal feels arbitrary. Give each suspect a distinct, memorable motive and alibi, so the eventual reveal recontextualizes specific details instead of picking a name at random.
- Letting the detective solve the case through a lucky break instead of deduction. Make sure the final solution follows logically from clues already on the page, using the method you established for your detective in step 2.