How to Create twig template files in drupal 8 for customizing user login,profile edit and forget password forms? Earlier we use the below code for creating custom template of user login ,user profile edit and forget password forms: 

 function Yourtheme_theme($existing, $type, $theme, $path){
 return array(
 'user_register' =&gt; array(
 'render element' =&gt; 'form',
 'template' =&gt; 'templates/user-register',
),



'user_pass' =&gt; array(
  'render element' =&gt; 'form',
  'template' =&gt; 'templates/user-pass',
),

'user_profile_form' =&gt; array(
  // Forms always take the form argument.
  'arguments' =&gt; array('form' =&gt; NULL),
  'render element' =&gt; 'form',
  'template' =&gt; 'templates/user-profile-edit',
),
);
}

function Yourtheme_preprocess_user_register(&amp;$variables) {

$variables['rendered'] = drupal_render_children($variables['form']);
}

function Yourtheme_preprocess_user_login(&amp;$variables) {

$variables['rendered'] = drupal_render_children($variables['form']);
}


How to Create same twig template files in drupal 8 for customizing user login,user profile edit and forget password forms?
Using hook_theme_suggestions_alter, you can create whatever template suggestions you like.  For example, based on the form id.  Just remember, the suggestion has underscores ("_"), but the template file has hyphens ("-").

function Yourtheme_theme_suggestions_alter(array &amp;$suggestions, array $variables, $hook) {

  if ($hook == 'form' &amp; !empty($variables['element']['#id'])) {
    $suggestions[] = 'form__' . str_replace('-', '_', $variables['element']['#id']);
  }
}


then you would create templates in your theme, such as 

form--user-register-form.html.twig

and

form--user-login-form.html.twig

You are doing some non-standard and unnecessary things by rendering the form in a preprocess hook and registering custom theme hooks for your forms.  You don't need to create new hooks in hook_theme, you can just use the suggestions, and it will do the rest, after you clear cache.

You can render your elements within the template.

For example, for form--user-login.html.twig:

&lt;div class="login-form login-form__wrapper"&gt;
    &lt;form{{ attributes }}&gt;
        &lt;div class="login-form__top"&gt;
            &lt;h3&gt;hello world&lt;/h3&gt;
            &lt;div id="error_messages"&gt;&lt;/div&gt;
            {{ element.messages }}
            {{ element.name }} {# username element #}
            {{ element.pass }} {# password element #}
            &lt;div class="login-form__help_actions"&gt;
                &lt;input id="show_password" class="show_password" type="checkbox" /&gt;
                &lt;label class="password-toggle" for="show_password"&gt;Show password&lt;/label&gt;
                &lt;a href="/user/password" class="forgot-password"&gt;Forgot Password?&lt;/a&gt;
            &lt;/div&gt;
            {{ element.form_build_id }} {# required #}
            {{ element.form_id }} {# required #}
            &lt;div class="login-form__submit"&gt;
                {{ element.actions.submit }}
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/form&gt;
&lt;/div&gt;