These are the patterns I reach for first when a prompt is not doing what I want. None of them are clever; they work because they remove ambiguity.
Say what the answer must look like before describing the task. The model then reads the task with the format in mind.
Answer with a JSON object {"verdict": "yes" | "no", "reason": string}.
Question: does this function mutate its input?On my tasks, one realistic input/output example is often clearer than a paragraph of rules. More examples can help, but repetitive examples can also encourage the model to copy surface details, so measure the smallest set that works.
Wrap pasted content in labelled blocks and refer to the labels. This reduces ambiguity, but it does not create a security boundary or prevent prompt injection. Treat external text as untrusted data, restrict available tools and validate sensitive actions outside the model.
Put the short answer first and the reasoning after it. It makes answers easier to parse and compare across runs.
If the model keeps doing something wrong, say so explicitly: "Do not invent function names that are not in the file."
Key takeaway
Most prompt fixes are about removing ambiguity, not adding cleverness.