In order to automatically add post name to the body class, all you have to do is to copy the following theme and paste it on your theme functions.php file.

Snippet source/Credit: WPProgrammer.com