Building habits: requesting advice on installing mental software

I’d like to figure out how to create habits more effectively and systematically, especially mental habits.

For example I might want to develop habits like
  • Noticing when I’m getting distracted and thinking about what I could do to reduce it

  • Noticing when I’m procrastinating and thinking about what I could do to reduce it

  • Doing Fermi calculations to estimate how much I should pay attention to a topic

Is there relevant research on how to build habits? Anyone have notable success at systematically building habits? I’m also interested in hearing about destroying habits, does it seem any different than creating habits?
My current (1.5 week old) approach to building habits is to use Anki to remind myself to do specific exercises.
I create a short exercise on a card that tells me to run through a sequence of thoughts or actions that constitute the habit I want to build, preferably using real examples. For example: the card might tell me to get into the frame of mind of getting distracted and then brainstorm ways to get less distracted in the future. When I see this card, I might try to get into the frame of mind of getting distracted by the thought of checking my email while coding and then try to think of ways to make myself less distracted by email.
I have been creating cards in one of two formats:
  1. One half of the exercise on the front and one half on the back

  2. The whole exercise on the front and a verbal reward on the back which I try to say out lout to myself.

My hope is to make an association with specific mental or external feelings and a particular thought process. This seems to be working a little bit, but it’s too early to tell if it’s working well.
Does anyone know of better software for doing exercises semi-regularly? I doubt Anki is ideal for this because I expect the frequency should decay more slowly to really make these things habits and probably should not continue decaying indefinitely.