Oh man.
I moved to the US to work for Pivotal. I spent my first 6 months thinking: they're going to sack me. They realise they made a mistake. I am useless.
Slowly it faded.
Every once in a while I will be in a situation where I am thrashing. Guess what I start thinking? Right: they're going to sack me. They realise they made a mistake. I am useless.
I've worked on about a dozen products now with various languages, user-facing-ness, technical novelty and so on. Every. Freaking. Time. I join a team I flail and I feel like I'm a drag on all of these brilliant people and that I am going to be fired ...
The difficulty with mental health is that you cannot find an objective yardstick that your emotional self will accept. The brain is just not made that way. It's the ultimate clusterfuck spaghetti code, hacked together over billions of years with multiple competing subsystems that flop into temporary control of things before oozing away again. You are unaware of how totally everything is in your head because the man is behind the curtain and you're paying no attention to him.
This Is The World, the you that thinks it's you thinks. I Have Always Been An Impartial Observer, continues the part of you that is anything but impartial and about as observant as a drunken brick tumbling down a hill.
These are terrible struggles. Anxious me is convinced all the awful things will happen. Depressed me is convinced that none of the good things will ever happen. Feeling-kinda-OK me knows, of course, that everything is going to be fine and wow would you look at that sunset, what a beauty...
The various flavours of my self which seize custody of my life at various times are all equally, totally convinced that they are the keepers of the true truth, that the other truths are false.
It helps to see that you cannot get out of yourself. That's the secret. When you know that you are not a single unitary thing, you get a tiny bit of perspective, a tiny bit of leverage over any of yourselves. You can say to the anxious self: yes, fine, doom and gloom, but for the moment let's just suspend our disbelief. You can say to the depressed self: yes, fine, it's pointless and even breathing is a muffled insult to your suffering, but let's go see the therapist and psychiatrist anyway. Because we've been here before, we'll be here again, and we can manage it.
One last thing: start getting treatment. You aren't alone, anxiety and depression are treatable and seeking treatment is important. Especially since, because you are smart, you will be able to invert anything positive anyone says to you -- other than a seasoned professional who understands the deep dynamics that conceal you from yourself.