1,249. When Someone Dies
194:4 When a person is on the verge of dying, we are not allowed to leave him so that he shouldn't be alone when his soul departs. This is because a soul is confused when it leaves the body. It is a mitzvah to stand by a person when his soul departs as per Psalms 49:10-11, "so that he might live forever and not see the pit. When he sees wise men die...." It's appropriate to gather a minyan to be present when the soul departs. They should not engage in idle chatter. Rather, they should occupy themselves with Torah, Tehillim and other prayers as found in the book Maavar Yavak. The practice is to light candles in the presence of a goseis.
194:5 After one's soul has departed, we place a feather by his nostrils; if it doesn't move, we know for sure that he has died. We then open the windows and the mourners recite the prayer "Tzidduk HaDin." When they reach the bracha "Dayan Ha'Emes," that G-d is the True Judge, they recite it including G-d's Name and the mention of His sovereignty. The mourners tear their garments in accordance with the law, as will be explained in chapter 195.