App Store just ate all my mobile data trying to download Xcode. Is there a way to tell OS X that WiFi I'm currently using is expensive and it should not download its stuff without asking me first?
Xcode will not download automatically until you actually press the download button in the App Store.
The only way I can think of minimising the chance of using the WiFi extensively is to disable the installing available updates in the background.
Go to App Store->Preferences->uncheck Download newly available updates in the background
You could uncheck the automatic check for updates all together, but this increases the risk of not getting latest security updates - what is not really recommended.
All these modifications mean that you would need manually download updates.