I've had similar problems in the past. My husband has said that its hard to be around me cos I was always depressed and really critical of him. Same sorts of things as you...
A few things have helped: getting good meds that get rid of my depression has helped the most but also T to help me be able to be part of a good relationship - mostly accepting that my hubby loves me and not be so reactive over everything and to stop sabotaging the relationship
If you want to change you just have to start small - start by noticing when you are nasty and then apologise then eventually you will be able to stop before you say it. Also give yourself a break and stop beating yourself up. You are human, you are allowed to make mistakes - apologise, try to do better and get some good sleep rather than being harsh to yourself. Maybe it would be good to have a talk with your T about why you do these things. Lots of