How can I add a special classes to all block of custom kind? Is there any hook_preprocess_block or any other way to I can add my custom classes to all blocks of a custom kind?Or in the other words:
How can I target all blocks of custom kind?

For example I want to add search class to all search blocks (or target all search blocks in my theme by using default auto-generated classes by Drupal core if it be available), or add user-login class to all user login blocks and so forth in my theme without any need to create a template for every block.
It's no problem to add classes in a block preprocess hook:

use Drupal\Component\Utility\Html;

  function mytheme_preprocess_block(&amp;$variables) {
    $variables['attributes']['class'][] = Html::getClass('block-id-' . $variables['elements']['#id']);
    $variables['attributes']['class'][] = Html::getClass('block-plugin-' . $variables['elements']['#base_plugin_id']);
    $variables['attributes']['class'][] = Html::getClass('block-provider-' . $variables['elements']['#configuration']['provider']);
  }


This example simply adds the available information to all blocks. You can start with this and narrow it down to what you want.