I was in Rojales, Alicante last weekend where lots of the caves have been turned into craft workshops. Yesterday I was in Guadix, Granada where there are supposed to be over 2,000 caves used as homes. Indeed in the museum there, dedicated to cave dwelling, to troglodytism, there was an information board to say that in 2002 there were 5,838 caves in Granada province which were the principal home for just short of 15,000 people.
It's not a complicated idea. You find some rock that's easy to dig. Usually that's clay. You start with a vertical cut to produce the façade of the house. In the centre of that façade you cut the arched door and from that door you excavate the first room generally with a square base and a vaulted roof and then work backwards into the hillside cutting galleries and rooms. The work is done with picks and shovels. The actual distribution of the rooms depends on how much money you have to pay the people who dig the galleries and rooms but also on the general topography of the land. The expert digger has the experience to determine the best shape.
Many of the caves are given a frontage of more typical building materials and sometimes, in the style of building a conservatory onto your house, an extension is built away from the rock face to give some extra room.
It can be quite odd sometimes, driving around Spain, to see a chimney sprouting out of the ground and to realise that someone is living below ground as people have done for thousands of years.