What is Prompt Engineering?
Prompt Engineering is the art and science of designing prompts to communicate effectively with large language models (LLMs) such as GPT-4, Claude, or Gemini.
Core techniques
1. Zero-shot Prompting
Ask a question directly without examples:
Classify the sentiment of the following text: "This product is amazing!"
→ Positive
2. Few-shot Prompting
Provide a few examples so the model picks up the pattern:
Text: "I love it!" → Positive
Text: "Terrible!" → Negative
Text: "It's just okay" → ?
3. Chain-of-Thought (CoT)
Ask the model to reason step by step:
Think step by step: If I have 5 apples,
give away 2, then buy 3 more, how many do I have?
4. Role Prompting
Assign a specific role to the AI:
You are a Senior Python Developer with 10 years of experience.
Review the following code and suggest improvements...
Golden principles
- Be specific — The more specific, the better
- Provide context — Give full background
- Set constraints — Constrain the output format
- Iterate — Refine your prompt gradually
- Use delimiters — Mark sections clearly
Conclusion
Prompt Engineering is not just “writing good questions”. It is a critical skill in the AI era, helping you extract the most from language models.
Next post: a deep dive into Advanced Prompting Techniques with RAG and Agent patterns.