Probably the most defining traits of the Mary Sue is her personality.
Mary Sues can be sweet, kind, bubbly, and perfect. They can be any extreme of personality, in truth, although most of them tends toward sweet and naive to be honest. They're the type of person most people hate. Although there are people out there who are sweet, kind, or bubbly, they also have flaws, which Mary Sue does not.
Think about the people you know, in general, you could probably list three things you like and three things you don't like about them. You could also find a mutual friend to make a similar list, but with completely different results. People react to each other differently, and it's the same thing with characters.
To avoid the Mary Sue, the truly dedicated could seek out advice from someone who they are familiar with, although a friend or relative is not recommended. Provide them with a concise character description and ask if they find the character to be too perfect.
For the less dedicated, another way to do this would be to consider your character, and what purpose you have for them. Sometimes, the character is a "self-insertion" character, that is, it is either the author themselves in the book or a person intended to represent the author's idealized self-image.
Now, I confess, I've written two short stories featuring a self-insertion. Both times, the stories were well received, and I didn't get called on it even though I admitted up front that I had done so. Why? Because I didn't over use my character-self. Instead, my pov was the vehicle of the story. It's an outsider's view of an inside world. There was nothing earth shattering about it. It was simply a young woman doing her job and encountering crazy people doing stupid things.
On the other hand, I do have a character that could be called a Mary Sue, believe me, she ticks a hell of a lot of boxes there in. In part it was because my muse abandoned me half way through and in part because I didn't plan things out when I came up with the story.
That's a part of the Mary Sue that I'll be getting to in another article. Back to personality.
Mary Sues are considered perfect. If they have flaws, it only makes them more attractive to other characters.
This is not real life.
In real life everyone has aspects of themselves that someone dislikes and things they don't like about themselves. Think of your own doubts, worries, and fears. Think of the times you've lost your temper. These are what make you human. A Mary Sue doesn't have these.
It's ok for a character to trip and fall or make mistakes. It's ok for a character to NOT be universally loved, because that makes them beloved to readers.
Don't think this means that you have to spend pages telling people about whatever phobias or character flaws your character has. Although it's a good idea to have those pages for your own reference. Instead, find ways to make that a part of the plot. Character afraid of stairs? Imply that their goal is at the top of a flight of stairs. Spiders give your character the shakes? Insert a moment of laughter on the subject.
A character shouldn't be taken too seriously, because then they become dull. It's just like people. You need to be able to laugh at your character, but only when your character deserves to be laughed at. There are characters out there that are known for being pompous, dull, or otherwise uninteresting that are still favored by fans, because they are written into rolls that take advantage of their nature.
A suggestion on working out a personality issue is to try writing shorts about the character, picture them in different scenarios and see how they react. Just take it slowly, and try to make sure that each layer of your character reacts well with each other layer, with the world you are building, and the other characters.
In fact, that's our next subject.
Mary Sue: Interpersonal Relationships