The courts are required to judge cases concerning stationary hazards that people set up, such as open pits. As with the case of animals, a pit is not the only thing for which one might be liable, but we derive certain details from the example of the pit, such as the depth a hole needs to be in order to be considered a hazard to safety. (See Baba Kama 50b.)
There are legal differences depending on the circumstances of the case. For example, digging a pit on one’s own property is very different from digging a pit on public property. (The liability in the latter case would obviously be greater than in the former.) Digging on one’s own property immediately next to a public thoroughfare is a negative factor; if he’s digging a foundation for a house, it mitigates things.
One isn’t responsible just for digging a pit, but even for uncovering an existing pit. In that circumstance, the relevant details include what the hole is covered with (a manhole cover is sturdier than a door mat), what kind of foot traffic the area typically hosts (a cover that holds a man might not bear the weight of a horse), and more.
In the course of discussing this mitzvah, the gemara (Baba Kama 50b) relates a now-familiar story: a landowner was clearing his field by tossing rocks into the adjacent public thoroughfare. A passerby chided him by asking, “Why are you moving rocks from property that isn’t yours into property that is?” The landowner thought this criticism was ridiculous, so he ignored the pedestrian. Later, financial reversals forced the man to sell his field. While walking in the road, he tripped over one of the very rocks that he himself had thrown there. Through this, he finally understood that public property means just that: it belongs to all of us and we are all obligated in its upkeep.
This mitzvah applies to the courts rather than to individuals. Its laws are discussed in the third and fifth chapters of the Talmudic tractate of Baba Kama starting on page 49b. In the Shulchan Aruch, it is found in Choshen Mishpat 410. It is #238 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos.