Prompt engineering has matured from guesswork to a set of evidence-backed techniques. Here's what consistently improves LLM output quality.
❌ "Write a summary of this article"
✅ "Write a 3-sentence summary of this article.
First sentence: main topic.
Second sentence: key finding.
Third sentence: practical implication.
Do not include opinions."
Specificity dramatically reduces variation in output.
Convert these descriptions to JSON:
"Active user in Delhi" → {"status": "active", "city": "Delhi"}
"Inactive user in Mumbai" → {"status": "inactive", "city": "Mumbai"}
Now convert: "Premium user in Bangalore"
A few examples are worth pages of instructions.
❌ "What's wrong with this code?"
✅ "Review this code. First, identify what it's supposed to do.
Then, trace through the logic step by step.
Finally, identify any bugs or issues."
Making the model reason before concluding dramatically improves accuracy.
You are a senior security engineer reviewing code for vulnerabilities.
Your approach: methodical, specific, cite exact line numbers.
<task>Refactor the following function for readability</task>
<code>
function p(a,b,c){return a?b:c;}
</code>
<constraints>
- Do not change functionality
- Add JSDoc comment
- Use descriptive names
</constraints>Claude especially responds well to XML structure.
You are a technical writer creating documentation for junior developers.
Constraints: No jargon, max 200 words per section, include one code example.
Format: Heading > Explanation > Code Example > When to use it.
If you want better output, tell the model what good output looks like:
"Here is an example of excellent output for this task:
[insert example]
Now produce similar output for: [your actual task]"
Prompt engineering is a skill. Practice it. Good prompts are worth as much as the model you're using.