In 1929 Ronald Knox codified the ten rules that all detective fiction should follow.
Remember Ronald Knox, the author of the Broadcasting the Barricades radio play hoax that terrified 1926 England? Knox was an Anglican priest, and then a Catholic priest, a translator of the Bible, and an author of detective fiction during that genre’s golden age. In that last role, in 1929, he set out ten rules that all good whodunits should follow.
The Ten Commandments of Detective Fiction had one purpose in mind: make it a fair fight between the cunning of the author and the wits of the reader. This is the full list, from his introduction to The Best Detective Stories of 1928:
1. The criminal must be mentioned in the early part of the story, but must not be anyone whose thoughts the reader has been allowed to know.
2. All supernatural or preternatural agencies are ruled out as a matter of course.
3. Not more than one secret room or passage is allowable.
4. No hitherto undiscovered poisons may be used, nor any appliance which will need a long scientific explanation at the end.
5. No Chinaman must figure in the story.
6. No accident must ever help the detective, nor must he ever have an unaccountable intuition which proves to be right.
7. The detective himself must not commit the crime.
8. The detective is bound to declare any clues which he may discover.
9. The ‘sidekick’ of the detective, the Watson, must not conceal from the reader any thoughts which pass through his mind: his intelligence must be slightly, but very slightly, below that of the average reader.
10. Twin brothers, and doubles generally, must not appear unless we have been duly prepared for them.Source
I should probably clarify Rule Number 5: Knox was responding to the anti-Asian racism prevalent throughout the world at the time, today described as the “Yellow Peril.” He freely admitted that detective fiction was not actually spoiled by the introduction of Asian characters… just that they were pretty much always a racist stereotype and so should be avoided.
Rule Number 6 reminds me of a piece of writing advice I got many years ago. Luck should not be used to get your protagonist out of trouble, only to get them into trouble.