Skip to content

Prompt Engineering Techniques

Overview Prompt engineering is the art of crafting inputs that get the best outputs from LLMs. Small changes in prompts can dramatically improve results. Basic Techniques Zero-Shot Prompting Classify the sentiment of this review as positive, negative, or neutral: "The product arrived late but works great." Sentiment: Few-Shot Prompting Classify the sentiment: Review: "Amazing quality, fast shipping!" → Positive Review: "Broken on arrival, terrible." → Negative Review: "It's okay, nothing special." → Neutral Review: "The product arrived late but works great." → Chain-of-Thought (CoT) Q: A store has 23 apples. They sell 8 and receive 15 more. How many apples? Let me think step by step: 1. Start with 23 apples 2. Sell 8: 23 - 8 = 15 apples 3. Receive 15: 15 + 15 = 30 apples Answer: 30 apples Role Prompting You are an expert Python developer with 15 years of experience. Review this code for bugs, performance issues, and best practices: ```python def process(data): result = [] for i in range(len(data)): result.append(data[i] * 2) return result ## Structured Output Extract information from this text and return as JSON: ...

December 1, 2025 · 2 min · 360 words · BlogIA Team