There is one rule of writing fiction that is the key rule, the Pendragon of rules. I will illustrate it with the genre of Historical Fiction, the easiest genre in which to find this rule broken. There are many shades and subtleties that refract from the rule, but it boils down this: Do not lie to your reader! The positive form is equally important: Tell your reader the truth! (Which, of course, is not quite the same thing.)
Taking the example of historical fiction, and the excellent negative example of The Da Vinci Code we start. The Da Vinci Code is perhaps the most egregious example of a filthy, lying, novel. (It piles on the fables another layer of deceit with mostly fraudulent footnotes too, but that is another topic entirely.) Let us consider one major thesis of the ‘history’ that Dan Brown tells his reader.
Remember, the goal of writing a good novel is to never lie to your reader (and to tell the truth). That means especially for historical fiction that the historical narratives and the events around your fictional events are accurate to history. This also means that when building up your knowledge of history you follow the gold standard of believable sources. This is, briefly, that primary sources trump secondary sources which indeed trump tertiary sources, and anything beyond that deserves to be laughed at as a source. Also, sources whose potential bias is known are more valuable than sources of unknown biases. Lastly, when hostile sources and friendly sources agree, and they are both primary in nature, you can be fairly confident that this is the historical truth.
Returning to Dan Brown, therefore, we investigate his claims that, for instance, the council of Nicaea only excluded the gnostic ‘gospels’ because they undermined the churches authority etc. as well as the related claim that these gnostic ‘gospels’ are of equal or greater value in determining the events of Jesus of Nazareth’s life. I put these assertions together because they fall to the same criticism. The Council of Nicaea on AD 325 knew quite well what historical scholars know today, that the gnostic ‘gospels’ were written later by at least 100 years than the gospels of Matthew, Mark, Luke and John, and were written by people who could never have even met of known Jesus, nor even known people who know him. (Which would constitute a secondary source.) This information means that for all intents and purposes, either Dan Brown did no research, or he lied to his audience, breaking this rule.
(On an interesting side note, he also got the teaching of Gnosticism wrong. Orthodox Christianity teaches that Jesus is the Messiah, and that His nature is true God and true man, together. There are, and were for most of the Church’s history, heresies that taught that Jesus was only a man, which is what Dan Brown claims the Gnostic gospels prove. However the alternate heresy, that Jesus appeared as a man but His essence was only that of God, is actually what Gnostics believed.)
So ultimately, this means that authors must write about what they know, or research and come to know what they wish to write about. If the author wishes a character to go crazy, he needs to know in decent detail, about craziness. The flip side of the coin, the one that tells the author to tell the truth, I describe to some extent in ‘The Right Story told True’ and will likely revisit again as it interests me.