techniques
Prompt Engineering
Prompt Engineering
The skill of talking to AI so it gives you better answers
Reading level
Prompt engineering encompasses techniques to elicit desired behavior from LLMs without modifying weights. Key patterns: zero-shot (direct instruction), few-shot (2–5 examples in context), chain-of-thought (ask the model to reason step-by-step), ReAct (reasoning+action interleaving), self-consistency (sample multiple reasoning paths, take majority), and structured output (JSON mode). System prompts configure model persona and constraints.
Real-world example
Instead of asking 'Is this email spam?', a prompt engineer writes: 'You are a spam detection expert. Analyze this email and respond with JSON: {is_spam: boolean, confidence: 0-1, reason: string}. Email: [email text]'. The structured prompt gives a reliable, parseable response every time.