What do I do once I have the thought?

So when I have a negative feeling I can get the thought triggering it but then what do I do?
T: I totally fucked up
F: shame

I felt the feeling but still have the thought going through my mind. Do I work on changing my thought now?