how civicrm class prepared on body tag
Some of it is added via javascript, e.g. https://github.com/civicrm/civicrm-core/blob/5.15.2/js/crm.menubar.js#L104

But as this ticket notes the rest depends a bit on the CMS and the theme and is inconsistent:   https://lab.civicrm.org/dev/core/issues/300