Sifrei Mitzvot sur Le Deutéronome 22:8

כִּ֤י תִבְנֶה֙ בַּ֣יִת חָדָ֔שׁ וְעָשִׂ֥יתָ מַעֲקֶ֖ה לְגַגֶּ֑ךָ וְלֹֽא־תָשִׂ֤ים דָּמִים֙ בְּבֵיתֶ֔ךָ כִּֽי־יִפֹּ֥ל הַנֹּפֵ֖ל מִמֶּֽנּוּ׃ (ס)

Quand tu bâtiras une maison neuve, tu établiras un appui autour du toit, pour éviter que ta maison soit cause d’une mort, si quelqu’un venait à en tomber.

Sefer Hamitzvot of Rasag

Samech To prevent the remnant from falling, place a fence [on a roof]