Let's be really clear - I come at this from a lay perspective and my rules are based in that, not in years of gun-fighting, training, brawling or any of that other fun. I've been largely content to observe and learn from those who HAVE had those experiences, and the below is based on THAT and my own eccentric system of ethics and goals.
1) Be where the trouble isn't.
2) Failing #1, RUN AWAY! RUN AWAY!
If, having failed at #1 and #2 being impractical for
medical/moral/practical reasons - swiftly prepare to open fire at the
center of what you can hit.
4) Repeat as needed until threat abates.
Saying bad words with greater or lesser vigor at any point in this ritual is entirely your choice.
Often #1 is fouled by other considerations ranging from "the only decent cheese shop in town is in the middle of the hood!" on up to "I'll be damned if I'll be intimidated out of my own city." How rational those motivates may be is a question left for the reader.
If one MUST violate #1, try to avoid playing Lady Godiva. Don't go skipping naked through the crime zone with a bag of gold in one hand while singing "tra-la-le, please victimize me." Either be the visually baddest of the badasses on the block (and able and willing to back that up), or strive to fade into the background or as C/W singer Ray Stevens puts it "I just lead a quiet little life, sing my little songs, and don't do anyone harm" as you do your thing and get the hell out.
Option 2 is fairly self-explanatory. Running away doesn't work terribly well if you are medically fouled up, aged or are entangled with mini-humans (or other critters) you cannot morally abandon. Using offspring and elders as bear food ("you don't have to the fastest - you just have to be faster than the next one the bear is chasing") is frowned on in most societies.
The third option is best employed when things have gone thoroughly to hell, quite possibly to the point where survival is no longer a likely option. At this point, MANY considerations go right out the window as the goal shifts from de-escalation and conflict avoidance to conflict termination and acquisition of a sufficient honor guard. *
A gun isn't a magic wand. Some folks take a whole lot of persuading when you are trying to educate them on the virtues of non-aggression and require repeated high velocity lessons. Sometimes hostiles bring their friends, who ALSO require additional education. Thus is the lesson of GC's rule #4.
*The notion that ones status in hell is determined by the number of enemies that one slays in ones final battle - your "honor guard." Often attributed to Robert A. Heinlein.