A habit is a routine your brain runs automatically, so you spend less effort on things you do every day.
Every habit has three parts: a cue that triggers it, the routine itself, and a reward you get at the end.
To change a habit, keep the same cue and reward, but replace the routine in the middle with a better one.