LLMs are extremely poor at following negative instructions, tell them what to do, not what not to do.
Or something similar that does not rely on negation.
I also try and get it to channel that energy into the doc strings, so it isn't buried in the source.
Besides, other models seems to handle negation correctly, not sure why it's so difficult for the Gemini family of models to understand.
Refractor this. Do not write any comments.
<code to refractor>
As a reminder your task is to refractor the above code and do not write any comments.
Literally both of those are negations.
If you think negations never work tell Gemini 2.5 to "write 10 sentences that do not include the word the" and see what happens.