you could consider to use post_class()
http://codex.wordpress.org/Function_Reference/post_class which would, in your case, output class="category-beans"
plus a lot of other categories;
or you could build on get_the_category()
http://codex.wordpress.org/Function_Reference/get_the_category to make your own output.
using just the category slug might lead to problems, if the slug by chance equals one of the existing css classes.