Minecraft wiki entry for Defense, associated text: Walls are not effective against spiders and cave spiders, as they can move vertically. However, the addition of protrusions and overhangs on the wall will prevent the spiders from climbing further. A fence as the center block of a wall also prevents spiders while providing no shade for skeletons. Make this high enough for the fall to deal damage on the spider, unless if low on resources.