You have to think about it, preferably before you buy.
What do you actually eat ? and use....because mind the soap and toothpaste, etc., too.
Then think hard on what you can actually cook with if you are suddenly restricted to the contents of your pantry.
So, while it's all very well stocking up on stuff like pasta, but think about what else you need to make it edible simply from the pantry/store cupboard. Tomatoes (the tubes of puree seem to last best if you store them in a box so they don't get bashed and broken and are better value than jars of stuff unless you're growing your own and canning) mixed beans, tinned meat (or tofu if you're veggie)
Then again, I'm not that fond of pasta, but I can make a lot of meals with it from very little, so I do stash a good assortment away......besides, making pasta is hardly rocket science, just that dried pasta and noodles store well, while flour takes more care.
Same with rice. Same with instant potatoes.....which I do use, not so much as mash, but it makes great potato scones, thickens soups, makes all kind of stuff like gnocchi, 'smiley faces', etc., ...all from a packet of smash
Buying in bulk makes it even cheaper....and the stores own brands come in small mylar bags which literally help make it last for years.
I'm an old fashioned vegetarian, I learned to cook nutritious veggie meals from the old adages of mixing grains/beans/nuts to make complete proteins, so I still do that, and that's reflected in the stuff I stash in the pantry. I spend a lot on nuts, but we eat a lot of nuts, so I buy from folks like RealFoodSource where I get nuts with long use by dates, etc.,
The other thing that's worth stashing is stuff like Nido. Nido is dried milk in a really, really sound tin. It's a full fat dried milk, so it's fully nutritious, and it's tasty and the menfolks will drink it if there's no other milk, when they won't even considered the usual dried milks.
Nido is known to last ten years in the can.....I opened one that was seven years old, and it was perfect. It's good to drink, it's good to bake with, no complaints. You can also make yoghurt, a dairy spread and an assortment of cheeses from Nido that you'd can't easily do from low fat dried milk.
I also buy, and we use, a lot of dried fruit. From raisins to mangos and ginger, but I dry what I can of what grows here, apples, pears, quince, strawberries and the like. We don't eat a lot of sweets, or bought in biscuits, but we do eat a lot of fruit and I bake.
I think the only real advice is to think about it. Think hard on what you'd use, how best to store it, and quietly stock up.
Think about what kind of meals you like, and make up a list of what you could store that would make it from the pantry/cupboard. Maybe have enough in stock to do it a couple of times.
I admit I have stocked up on stuff that I'm pretty sure will go up in price,
I bake, so stuff like vanilla, saffron, spices, good chocolate, etc.,
and if I see an offer on stuff that I do know we use, like a 3 for 2, then I'll buy it twice and just store it away.
When lock down hit the only things we needed, and we shopped just once a week for were fresh saladings, fruit and vegetables and dairy. We'd have managed from the pantry, the freezer and the garden but it wouldn't be the same variety.
Everyone will have different likes, different dietary needs, think about what you actually use, and what you would like to be able to make, just from what is in the cupboard.
Then think hard on what you'd do if you got really unwell, or there was a blizzard that stopped you getting out for three weeks, and make sure you have enough stashed to cover for at least that long.
Me ? I grow and store in season, so I think ahead, and a year's a good think
M