There is a mitzva to build a guardrail on your roof to make sure nobody falls off. As it says, “When you build a new house, you shall make a parapet for your roof, so that you do not bring bloodguilt on your house if anyone should fall from it” (Deuteronomy 22:8). The roofs which require railings are flat ones where people sometimes walk, so there is a real danger of falling. Similarly, a railing is required for someone’s pit or well which is ten tefaĥim deep (76 centimeters), for a split-level yard where more than 10 tefaĥim separate the levels, and for a flight of stairs more than 10 tefaĥim high. In public areas, we must be even more careful to ensure safety.