how would I go about creating a filter for the body_class()
tag that allows me to add the the parent pages slug name as a class to the body whenever visiting a subpage or post?

3 Answers
here:
add_filter('body_class','body_class_slugs');
function body_class_slugs($classes) {
global $posts,$post;
if(is_single() || is_page()){ //only on a single post or page
if (isset($posts)){
$classes[] = $post[0]->post_name; //posts is an array of posts so we use the first one by calling [0]
}
elseif (isset($post)){
$classes[] = $post->post_name;
}
}
return $classes;
}