In the story of Moses Israelites were told to paint lamb blood over their door frames. The spirit of death took the first born son of all who didn’t. Including the pharaohs son.
I think that the commandment provide us with ways to be better and to follow god and as long as we keep those commandments we can fully follow god. Of course we all sin but he has already forgiven us.