First, I just ignored any huffing and puffing that wasn't actually directed at me. So 'ugh, this milk is off, this is so annoying' isn't necessarily directed at you and you don't need to take it on- he's perfectly able to buy milk and unless you agreed you are the milk monitor, there's no need to leap in and get all defensive. That cut out about half of the perceived criticism, as I was hyper-vigilant about being criticized so tended to be overly defensive and leap in and defend myself even when no actual criticism was being made.
Second, I treated some of it with humour. My husband wasn't always being nasty, but he is (still is!) a know-it-all and likes to tell you how to do stuff- so he'd say 'what you need to do is stack the dishwasher with the plates on top and then do the cutlery afterwards...' sometimes this was helpful, but a lot of the time, it felt like being ordered about, so I just made a joke of it 'thanks, imagine if I hadn't met you and I had gone through my entire life with all my plate and cutlery just piling up around me because I didn't know how to wash it...oh, hang on...' which diffused the situation but also drew attention to his know it all ways.
But, one point when he was down and we were struggling I just told him bluntly- I don't want to live with someone criticizing me all day, I just don't want to get up every day to be told I could do things better, differently, faster, I think I'm a nice person, and can live just fine, and if you don't agree, then please leave as I'd rather than than you live with me and pick holes in the way I do things all the time. And I meant it.
He doesn't do it so much now. I think it was a habit, and a product of him being very stressed at work. But it is very wearing to be constantly not quite good enough, especially when you are just fine as you are. Remember that, it may shift your thinking, perhaps he needs to change his ways if he's to keep you happy and this marriage on track.