Use your positive outlook to rise above the crabs in the bucket
Crab mentality is derived from the metaphor crabs in a bucket, wherein an individual or a group will always try to pull others down from prospering or being successful. It stems from the fear that others might move ahead in life or in their professional pursuit, while they remain at the bottom of the perennial organisational hierarchy bucket. A trait which is very common in workspaces world-over, it exemplifies a corrupt human nature - if I can't have it, neither can you.
If you happen to have an ill-fated encounter with people with crab mentality, here's what you can do.
Let your accomplishments do the talking
First and foremost, maintain a distance from individuals or groups who entertain crab mentality, as you stand to lose a lot more than gain in their company. A common trait such people run is their distaste for hardworking and enterprising individuals, so rather than entangling yourself in a battle of words just let your work do the talking.
Ones for nagging and complaining, an encounter with such "crabs" can often cause anxiety and self-doubt. However, don't let their sour mood ruin yours too. Fight back with your optimism. Look back and remember why you started a certain project and how far you have reached and let your progress motivate you to do even better.
Realize it's a mentality
Crab mentality is nothing but a state of mind. It's not necessary that the person is bad, maybe he/she is going through a rough patch in life. Give the opposite person the benefit of the doubt before you jump to conclusions. When you show empathy and compassion, you might just win them over to your side.
Set an example
Don't hurl rocks at people who have been aggressively throwing stones at you. Set an example by countering negativity with your optimism. Even if you know that a certain person wants you to fail, don't out them in front of everyone. Be a great example for those lost in their insecurities and teach them how to overcome their crab mentality.
Learn to let go
Forgive people who have hurt you but never forget the lessons they have taught you in the process. Be the bigger person and just let it slide. Just like failure, view these "crabs" in life's bucket as part of the process. Let them do their job and learn to let go.
If rivers can redirect their routes over time, surely you can find your way around such bunch. You can't change the way the world functions, so view these encounters as life lessons for developing a temperament where you can keep the negativity at bay.