At a certain point a Dungeon Master typically reaches that phase where they no longer want their players to be a death-mobile killing everything that stands in their path. However, the methods to do so and even the reasons that it previously happened are numerous. As such, I want to try to collect them here along with my thoughts.As usually, hopefully it helps someone out there. And as usual, I'd be happy to hear what other people think.
Some players are more likely to want to go around killing everyone than others. Combat is one of the things they enjoy, or they want to play a character who embraces the dark side. Even a role-player tends to want some combat in their games. Though that's an often used excuse, it sometimes is a legitimate desire from a player. Naturally then, they'll want to go around picking fights they think they can win.
However, there can be other reasons your players often get into fights or at the very least end up killing most things they come across. Doing so in games tends to reward players. They get treasure and experience. What can be better? If this is combined with a lack of consequences for killing, you end up in a situation where even people who generally don't want to kill everything in their way will. It's just clearly the best choice and players can typically only hamstring themselves for so long when you are trying to kill them.
Out of the gate, experience points can have a big impact on these sorts of situations. If you reward experience on kills, players will go for it. The alternative is to reward experience on a victory. In this case, they'll still receive experience for making enemies flee. This removes the desire to hunt down everyone who flees for experience. This option is still open in order to prevent intel from reaching the enemy. However, there is the metagame implication that for long term experience, it may be best to always let fleeing enemies go. It's sort of like catch and release fishing. They'll come back with more loot and experience. Milestones get around this entirely (awarding levels based on progress in the story), but change the experience for players.
When I design an combat encounter, how to avoid it completely tends to be one of the last questions on my mind. However, it's still an important question to ask. If you put your players into a dungeon, with the door closed behind them, fighting room through room, it should not be too much of a surprise if they start thinking of combat as the first option. In these kinds of dungeon crawls, it may not be much of a problem either. It could be what your players are here for. However, you can accidentally create these kinds of situations as well. When someone is trying to kill their character, a player is rarely in a talking mood. This means often the default choice is to fight. It also relies on the precedence previously set. You can't throw one encounter that should be solved through non-violence into a dungeon crawl full of nothing else and be surprised when they fight through it. If they run into at least one non-violent situation though, next time there's a better chance that they'll investigate first.
My suggestions for these kinds of situations are quite simple. Establish quite earlier that there are other ways to solve the problem and put a consequence for killing. If it's someone innocent, they might be able to get away with it once or twice but eventually there will be issues. Maybe more guards will be present in the streets, creating problems for your band of ragtag thieves. The point is that it should make sense. Loud noises in a dungeon can draw more attention. A missing patrol sets a camp on edge though sometimes people do skip watch duty to sleep or do other things. The last is to try and have some kind of alternatives ready and if not, not to be afraid of rolling with them. This is where it gets tricky. You also don't want a min-maxed charisma character to just talk through your entire campaign. In these cases the best advice I can think of to give is to remember that what is said is also important, not just how it's said, and that not every fight can be talked out seconds before erupting. It tends to be quite specific and on a case-by-case basis though. Remember that actions have consequences.
Worst case scenario might be needing an out of character talk about what the players want from their campaign and what you want. You need to be on the same page or nothing works. Things get stale quickly if your players decide to just hang out at the inn every session instead of doing things. Only so many bandit groups can keep attacking the inn for protection money. Just like we have expectations that our players will go after something, players have expectations about what they'll be doing in a session. Of course, such talks can be had far earlier, such as at the start of the campaign. For experienced players, this may be needed. Dungeon Masters each have their own style of game and players, coming from a different style, may be expecting something that isn't coming. Sometimes it's for the best, sometimes it's for the worst, but those expectations are important to consider. A good part of our a Dungeon Master's job is managing expectation.You could have a lot of fun with a death-mobile party. However, people need to be alright with it and expect it. Typically, however, people prefer a mix of combat, role-play and storytelling (add humour to taste).