How to add class to all forms automatically?
You can do something like this:

function MYMODULE_OR_THEME_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['#attributes']['class'][] = 'MY_CLASS';
}