subgraph Structured Output
subgraph Advanced Patterns
C --> D --> E --> F --> G --> H
K --> L --> M --> N --> O --> P --> Q
Q --> R --> S --> T --> U --> V --> W
style Foundation fill:#3b82f6,color:#fff
style Core Skills fill:#8b5cf6,color:#fff
style Structured Output fill:#06b6d4,color:#fff
style Advanced Patterns fill:#22c55e,color:#000
style Production fill:#f59e0b,color:#000
[INSTRUCTION] + [CONTEXT] + [INPUT] + [CONSTRAINTS] + [OUTPUT FORMAT] + [EXAMPLES]
Type Description When to Use System Base instructions Always User The actual request Every request Assistant Example responses Few-shot learning
Type # of Examples Best For Zero-shot 0 Simple tasks One-shot 1 Clear pattern tasks Few-shot 2-5 Complex or nuanced tasks
Pattern Key Idea Best For Chain of Thought Step-by-step reasoning Math, logic, complex problems Tree of Thought Multiple reasoning paths Open-ended problems, creativity ReAct Reason → Act → Observe Agent-based tasks Self-Consistency Multiple paths → majority vote High-stakes decisions Step-Back Abstract first → details Complex domain problems Meta Prompting Prompts that generate prompts Prompt optimization
Parameter Range Effect Temperature 0-1 Lower = more deterministic Top P 0-1 Lower = more focused Max Tokens Varies Response length limit Frequency Penalty 0-2 Reduce repetition Presence Penalty 0-2 Encourage new topics
Q1 -->|"Simple, factual"| ZERO["Zero-shot<br/>✓ Quick<br/>✓ Cheap"]
Q1 -->|"Needs examples"| FEW["Few-shot<br/>✓ Clear pattern<br/>✓ Consistent"]
Q1 -->|"Requires reasoning"| CoT{"Single or<br/>multiple paths?"}
Q1 -->|"Needs actions"| REACT["ReAct<br/>✓ Agents<br/>✓ Tool use"]
Q1 -->|"Creative/open"| ToT["Tree of Thought<br/>✓ Exploration<br/>✓ Creativity"]
CoT -->|Single| CHAIN["Chain of Thought<br/>✓ Step-by-step<br/>✓ Reliable"]
CoT -->|Multiple| SELF["Self-Consistency<br/>✓ High accuracy<br/>✓ Multiple runs"]
style ZERO fill:#3b82f6,color:#fff
style FEW fill:#8b5cf6,color:#fff
style CHAIN fill:#22c55e,color:#000
style ToT fill:#06b6d4,color:#fff
style REACT fill:#f59e0b,color:#000
style SELF fill:#ef4444,color:#fff
Term Definition Prompt The input text given to an LLM to guide its response System Prompt Base instructions that define the model’s behavior User Prompt The user’s actual request or query Assistant Prompt Example responses used for few-shot learning Temperature Controls randomness of output (0 = deterministic) Token The basic unit of text an LLM processes (~0.75 words) Context Window Maximum tokens an LLM can process in one request Chain of Thought Prompting technique that elicits step-by-step reasoning ReAct Reasoning + Acting pattern for agent-based tasks RAG Retrieval-Augmented Generation — combining prompts with retrieved context Structured Output Generating formatted output (JSON, XML, etc.) Prompt Injection Attack where malicious input overrides instructions Guardrails Safety constraints applied to LLM inputs and outputs LLM-as-a-Judge Using an LLM to evaluate outputs of another LLM Few-Shot Providing examples of expected behavior in the prompt
# Practice 1 Be specific and clear 2 Provide context before asking 3 Use examples for complex tasks 4 Specify output format explicitly 5 Break complex tasks into steps 6 Use role/persona for tone and expertise 7 Iterate based on evaluation
# Practice 1 Version all prompts 2 Test before deploying 3 Monitor latency, cost, quality 4 Implement fallbacks 5 A/B test changes 6 Secure against injection 7 Automate deployment pipeline
Mistake Why It’s Harmful Vague instructions Model fills gaps incorrectly Too much context Wastes tokens, dilutes focus No output format Inconsistent responses Skipping evaluation Can’t measure improvement No versioning Can’t roll back bad changes Over-engineering Simple prompts often work best Ignoring security Vulnerable to injection
- [ ] Tested on 10+ edge cases
- [ ] Evaluation score meets threshold
- [ ] No PII in system prompt
- [ ] Output format validated
- [ ] Prompt registered in registry
- [ ] Fallback configured
- [ ] Monitoring in place
- [ ] Input sanitization enabled
- [ ] Output validation configured
- [ ] Rate limiting active
- [ ] Injection tests passed
What is prompt engineering?
Name three prompt patterns
Difference between system and user prompts
When would you use few-shot over zero-shot?
How does Chain of Thought improve reasoning?
Design a prompt for a customer support bot
How would you evaluate prompt quality in production?
Design a prompt deployment pipeline
How do you handle prompt injection?
Design a prompt governance framework for 50 engineers
How do you balance cost, latency, and quality?
How would you version prompts across multiple models?
1. Understand the use case
2. Choose the right pattern
3. Design the prompt structure
5. Productionize with monitoring
A[Phase 5: Prompt Engineering] --> B[Phase 6: Retrieval Systems & RAG]
B --> C[Phase 7: AI Agents & Multi-Agent Systems]
C --> D[Phase 8: AI Frameworks & Ecosystem]
D --> E[Phase 9: Production AI Engineering]
E --> F[Phase 10: Real-World Projects]
style A fill:#8b5cf6,color:#fff
style F fill:#22c55e,color:#000
✓ What Prompt Engineering is — and why it exists
✓ How LLMs understand prompts — tokens, instructions, context
✓ Prompt anatomy — instruction, context, input, constraints, format, examples
✓ System, user, and assistant roles — how to use each effectively
✓ Zero-shot, one-shot, few-shot — when to use each
✓ Role and persona prompting — improving response quality
✓ Context engineering — giving models the right information
✓ Output formatting — Markdown, JSON, XML, YAML, and more
✓ JSON and structured outputs — reliable, parseable responses
✓ Prompt templates — reusable, parameterized prompts
✓ Prompt chaining — breaking complex tasks into steps
✓ Chain of Thought — step-by-step reasoning
✓ Tree of Thought — exploring multiple reasoning paths
✓ ReAct prompting — reasoning + action for agents
✓ Self-Consistency — majority voting for reliable answers
✓ Step-Back Prompting — abstract first, then details
✓ Meta Prompting — prompts that generate prompts
✓ Prompt optimization — compressing, refining, simplifying
✓ Prompt testing — unit tests, regression tests, golden datasets
✓ Prompt versioning — registries, history, rollbacks
✓ Prompt evaluation — LLM-as-a-Judge, metrics, quality gates
✓ Prompt security — PII, jailbreaks, guardrails
✓ Prompt injection — direct, indirect, leakage, defenses
✓ Production prompt engineering — scaling, monitoring, cost optimization
Next: Continue to Phase 6 — Retrieval Systems & Retrieval-Augmented Generation (RAG) where you’ll learn how prompts combine with external knowledge to build intelligent AI applications.