Simple way to add a class to the body when creating/editing an entity
You can use hook_preprocess_page and check the current route:

function mymodule_preprocess_page(&amp;$vars) {

  $route_name = \Drupal::routeMatch()-&gt;getRouteName();

  // This would add a class based on the route.  You'd need the 
  // pathauto module enabled.
  $vars['page_classes'][] = \Drupal::service('pathauto.alias_cleaner')-&gt;cleanString($route_name);

  // This would add the classes asked for in the question.
  if ($route_name == 'entity.node.edit_form') {
    $vars['page_classes'][] = 'entity-edit';
  }
  elseif ($route_name == 'node.add') {
    $vars['page_classes'][] = 'entity-create';
  }
}