So to summarize, the dynamic of positive and negative thoughts is quite similar. Both distract from the work itself. Both types of thought can be accepted and summarily dismissed.
A negative thought might contain some useful information, if it is directly related to the work. So, for example, I might say, "that sentence doesn't say what I wanted it to say." But then, that negative thought is not really about my ego, or my ability as a writer, but just a useful observation. The same way, a positive thought might be, "yeah, that paragraph is done now" or "that sounds right."
So the opposition you should think about is: what thoughts are about the work itself, and which ones are irrelevant judgments that have to do with your ego? It is easy to see that a negative thought about the work itself, "gee, that sentence is not very clear" could lead to the thought: "I am a bad writer." The latter thought, though, does not lead to anything particularly productive.
If those ego thoughts are less prominent in your writing session, you will find that the writing will flow better. Afterwards, if you want to congratulate yourself on how smart you are, or worry whether you are good enough, that is fine. Well, it isn't ideal either, but it won't interrupt you as much.
I've found that trying to prevent those thoughts from occurring, or trying to make the positive ones outweigh the negative ones, is useless. I know I will have negative and positive thoughts related to my own abilities as I'm writing.
The entire academic process, after all, is built on judgment. We get grades from our earliest years for our school work. We are judged even as full professors, through systems of peer evaluation. We are called upon the grade students and to judge our own peers. It is surprising that anyone could sit down and write without a whole host of anxieties besetting her.