The first rule of writing flashbacks is the same as most other literary rules: don't.
Of course, most experienced writers know there is always an exception, an example of some famous, popular, wealthy author who pulled off the perfect flashback (or whatever rule is today's flavor.)
Any writer that finds a tempting flashback would be wise to stop and consider if it could be cut, and if cutting would harm the story. That's the real first rule. And I've been trying to sort out the how and why of a good flashback; I don't have much so far.
I have a simple idea. The problem with flashbacks is that the forward momentum of the story stops for what is usually nothing more than information--an infodump, another word often led around by a "never". In that sense, a flashback is like pausing the story to take a trip down Telling Lane, all the way down to where it intersects with Backstory Road. Nobody wants to stand on that corner, right?
Now, I'm not saying flashbacks are back in style or anything, but I think the key to a successful one would be that it advances the story. It affects the story. It is part of the story.
Consider the story of Todd. One night, Todd witnessed a murder through a haze of alcohol and drugs. The scene was dark and the memories fragmented, but now someone is gunning for poor old Todd. So, predictably, while he eludes the mystery murderer, the story is punctuated with a series of flashbacks, each one revealing new clues, pushing Todd into action. As memories bubble to the surface and pieces come together, Todd is also driven along an internal arc--perhaps one involving a girl or his family. (I'm not trying to be original here. Can you tell?)
The point is that the flashbacks lead to action. Todd tracks people down. He asks questions. He digs for bodies. He draws inexorably closer to the murderer--someone who is closer than he ever imagined, or something like that. Right? (Spoiler alert: It was his mother all along.)
Given a technique like this and an otherwise skilled writer, sure--I think a flashback might work. I'm also sure there are better examples, but it illustrates my only positive thought regarding flashbacks.
What I'd really love is to find some examples of stories where a flashback worked very well.
Writer of speculative fiction. Current work in progress is an untitled dark fantasy novella.