Chapter 3 of 3
Advanced Prompting Patterns
1. Structured Output
Ask the AI to return data in a specific format — JSON, markdown tables, CSV. This is essential for integrating AI into applications.
Structured output prompttext
Extract the following information from this job posting and return it as JSON:
- Job title
- Company name
- Location
- Salary range
- Required skills (as an array)
Job posting: "Senior React Developer at TechCorp, Remote (US), $120k-$160k. Must know React, TypeScript, Node.js, and PostgreSQL."
→ {
"title": "Senior React Developer",
"company": "TechCorp",
"location": "Remote (US)",
"salary": "$120k-$160k",
"skills": ["React", "TypeScript", "Node.js", "PostgreSQL"]
}2. System Prompts
System prompts set the AI's behavior for an entire conversation. They define the persona, rules, and constraints that apply to every response.
System prompt exampletext
SYSTEM: You are a friendly, encouraging coding tutor for beginners.
Rules:
- Always explain concepts with real-world analogies
- Include code examples in every response
- If the user makes an error, explain why gently
- Never use jargon without defining it first
- Keep responses under 300 words3. Prompt Chaining
Break complex tasks into sequential steps, where the output of one prompt becomes the input for the next. This produces dramatically better results than trying to do everything in a single prompt.
Prompt Chain: Blog Post Generator
Step 1
Generate 5 blog post title ideas on 'React Hooks'
Step 2
Pick the best title and create an outline
Step 3
Write each section based on the outline
Step 4
Review and refine for tone and accuracy
Key Takeaway
Prompt engineering is a superpower. The techniques you've learned — zero-shot, few-shot, chain-of-thought, structured output, and prompt chaining — will make you 10x more effective with any AI tool.