There are certain blocks that mobs cannot spawn on in Minecraft. There are a few exceptions with one being monster spawners. These naturally allow mobs that spawn from these spawners to spawn on any block including spawning in the air.
Only certain mobs can spawn on water. These are drowned, fish, guardians, squid and dolphins. As these are water-based mobs these are the only ones that can spawn on water. So you don’t have to worry about skeletons, zombies, creepers and spiders because these cannot spawn on water.
It’s worth mentioning that mobs cannot also spawn on half blocks which include slabs and stairs as well as on bedrock or in lava. So if you’re looking to mob proof your house then using half slabs or stairs for your roof and pathways is a good way to stop mobs from spawning.