1) Go from Negative to Neutral first, then work on Neutral to Positive.
In my experience, athletes struggle with shifting from a negative mindset to a positive mindset during competition - it's just too big of a jump to make in the moment, especially with emotions running high. Instead, focus on having neutral reactions first. Going from negative to neutral is a much easier transition to make than negative to positive. Work on limiting your emotional responses, especially when you are feeling frustrated or angry. In limiting your negative reactions and displaying a neutral response, eventually you will learn to limit the negativity in your thoughts and reactions. Once you learn to have a neutral response after errors/mistakes, making the jump from neutral to positive will be much more attainable.
Skill Execution: Routines, routines, routines! Practice neutral responses each day, along with neutral thoughts. Focus on keeping a plain face, shoulders back, and a simple thought immediately after the point/play is over ("Next one", "Reset").
2) Be your own coach when competing and limit the voice in your head.
If you were to transcribe all of the thoughts you have during competition, 1) how long would that transcript be, and 2) what types of statements would you see? In general, athletes are overly critical of their performances, which leads to flooding the brain with useless, negative statements. For example, after missing an easy layup a basketball player might respond with negative affirmations: "I am terrible. How did I miss that? A 3 year old could have made that shot." And what tends to happen next? That's right, another mistake and another negative reaction/thought. Additionally, players tend to have a running dialogue in their heads, with very little instructional comments being made. The influx of thoughts and statements slow down the physical reactions and prevent the athlete's training from kicking in. In essence, the player gets in his/her own way.
Skill Execution: Work on limiting the emotional and critical comments you make to yourself during training and competition. Give yourself a goal of having less than 10 negative comments each game/match, and then work on having fewer than 5, etc. Additionally, after each negative comment, give yourself a piece of coaching advice. For instance, what would your coach tell you after missing the easy layup? "Great effort, you will get the next one. Now get back on defense and play team ball." Ultimately, you want to remove most of the emotional/critical comments and have more instructional statements, which are process-focused and forward-thinking. Remember, you are trying to alter your thinking habits, so it will take some time (stay accountable by setting thinking goals each day).