15+ Battle‑Tested ChatGPT Prompt Templates (From Andrew Ng’s OpenAI Course)
Published: June 24, 2026 • ChatGPT Prompts
If you have ever built with GPT‑3.5‑Turbo or GPT‑4, you have probably heard of ChatGPT Prompt Engineering for Developers — the famous course by Andrew Ng, created in partnership with OpenAI and DeepLearning.AI. It is the gold standard for learning how to write prompts that actually work in production.
But knowing the concepts is one thing. Turning them into reusable, copy‑paste‑ready code is another. That is exactly why I compiled this list. Every template below comes directly from the official course materials, adjusted slightly for real‑world use. They are already formatted for the OpenAI API — just plug in your content and run them.
No fluff. No academic theory. Just prompts that I use daily for summarisation, classification, transformation, and chatbot building.
Quick Setup – The get_completion() Function
All templates rely on this simple helper function. Keep it in your utils.py or just copy it into every notebook.
import openai
import os
openai.api_key = os.getenv("OPENAI_API_KEY")
def get_completion(prompt, model="gpt-3.5-turbo", temperature=0):
messages = [{"role": "user", "content": prompt}]
response = openai.ChatCompletion.create(
model=model,
messages=messages,
temperature=temperature,
)
return response.choices[0].message["content"]
For chatbot‑style prompts you will also need the messages version:
def get_completion_from_messages(messages, model="gpt-3.5-turbo", temperature=0):
response = openai.ChatCompletion.create(
model=model,
messages=messages,
temperature=temperature,
)
return response.choices[0].message["content"]
1. Universal Foundation Templates
Use these when you do not know where to start. They work for almost any task.
Standard Instruction Template
Your task is to [CLEARLY STATE THE OBJECTIVE].
Requirements:
1. [SPECIFIC CONSTRAINT 1]
2. [SPECIFIC CONSTRAINT 2]
3. [SPECIFIC CONSTRAINT 3]
Output format: [JSON / Markdown / Plain text / Bullet points]
Input text:
"""
[TEXT TO PROCESS]
"""
Few‑Shot Learning Template
Best for complex tasks where the model needs examples to get your style or logic.
Your task is to [TASK OBJECTIVE].
Here are a few examples:
Example 1:
Input: [EXAMPLE INPUT 1]
Output: [EXAMPLE OUTPUT 1]
Example 2:
Input: [EXAMPLE INPUT 2]
Output: [EXAMPLE OUTPUT 2]
Now process the following input:
"""
[TEXT TO PROCESS]
"""
Step‑by‑Step Reasoning Template
Critical for logic problems, math, or multi‑step decisions.
Solve the following problem by following these exact steps:
Step 1: [DESCRIBE FIRST STEP]
Step 2: [DESCRIBE SECOND STEP]
Step 3: [DESCRIBE THIRD STEP]
Finally, output the final result.
Problem:
"""
[PROBLEM DESCRIPTION]
"""
2. Text Summarisation Templates
Perfect for long documents, customer reviews, meeting notes, and news articles.
Standard Length Summary
Your task is to generate a concise summary.
Summarise the text enclosed in triple backticks in [MAXIMUM NUMBER] words or less.
"""
[TEXT TO SUMMARISE]
"""
Angle‑Specific Summary
Your task is to summarise the following content from the perspective of [SPECIFIC ANGLE, e.g., "product durability" or "customer service experience"].
Keep the summary under [MAXIMUM NUMBER] words.
"""
[TEXT TO SUMMARISE]
"""
Key Information Extraction
Extract all key information points from the following text.
Output only the explicitly stated facts as a bulleted list.
Do not add any explanations or interpretations.
"""
[TEXT TO ANALYSE]
"""
Batch Review Summary
Below are [NUMBER] customer reviews for [PRODUCT NAME].
Summarise the main points across all reviews into 3 key takeaways.
[REVIEW 1]
[REVIEW 2]
[REVIEW 3]
3. Text Inference Templates
Extract insights, sentiment, entities, and user intent from unstructured text.
Sentiment Classification
Analyse the sentiment of the following text.
Output only one word: Positive, Negative, or Neutral.
Do not add any additional content.
"""
[TEXT TO ANALYSE]
"""
Multi‑Dimensional Emotion Detection
Identify all emotions expressed in the following text.
Choose only from this list: [Anger, Disappointment, Satisfaction, Surprise, Concern, Joy, Frustration]
Output a comma‑separated list of emotions.
"""
[TEXT TO ANALYSE]
"""
Multi‑Label Classification
Classify the following text into one or more predefined categories.
Predefined categories: [CATEGORY 1, CATEGORY 2, CATEGORY 3, CATEGORY 4]
Output a comma‑separated list of relevant categories.
"""
[TEXT TO CLASSIFY]
"""
Entity Extraction
Extract all [ENTITY TYPE, e.g., "product names", "company names", "dates", "email addresses"] from the following text.
Output a comma‑separated list. If no entities are found, output "None".
"""
[TEXT TO ANALYSE]
"""
User Intent Recognition
Identify the primary intent of the following user input.
Choose only from this list: [Order inquiry, Refund request, Product question, Complaint, Technical support]
Output only the intent name.
"""
[USER INPUT]
"""
4. Text Transformation Templates
Convert text between languages, tones, formats, or fix errors.
Multi‑Language Translation
Translate the following text into [TARGET LANGUAGE, e.g., "Spanish", "French", "Japanese"].
"""
[TEXT TO TRANSLATE]
"""
Tone Adjustment
Rewrite the following text in a [TARGET TONE, e.g., "formal business tone", "casual conversational tone", "friendly customer service tone"].
"""
[TEXT TO REWRITE]
"""
Format Conversion (JSON → Markdown)
Convert the following JSON data into a well‑formatted Markdown table.
"""
[JSON DATA]
"""
Spelling & Grammar Correction
Check and correct all spelling and grammar errors in the following text.
Output only the corrected text. Do not add any explanations.
"""
[TEXT TO CORRECT]
"""
Code Explanation (Beginner‑Friendly)
Explain what the following Python code does.
Break down the explanation into clear, step‑by‑step instructions.
Use simple language that a beginner developer can understand.
```python
[CODE TO EXPLAIN]
```
5. Text Expansion Templates
Generate original content from outlines or short notes.
Professional Email Writing
You are a [YOUR ROLE, e.g., "marketing manager", "customer support representative"].
Write a [EMAIL TYPE, e.g., "follow‑up email", "apology email", "invitation email"] to [RECIPIENT NAME/ROLE].
Key points to include:
• [POINT 1]
• [POINT 2]
• [POINT 3]
Requirements:
1. Tone: [Professional / Friendly / Formal]
2. Length: [100-200] words
3. Include a clear call to action
Marketing Copy Generation
Write a [COPY TYPE, e.g., "social media post", "product description", "tagline"] for [PRODUCT/SERVICE NAME].
Product features:
• [FEATURE 1]
• [FEATURE 2]
• [FEATURE 3]
Target audience: [TARGET DEMOGRAPHIC, e.g., "busy professionals", "parents of young children"]
Style: [Concise / Warm / Humorous]
Word count: [MAXIMUM NUMBER] words
Customer Inquiry Response
You are a customer support representative.
Respond to the following customer inquiry.
Customer question:
"""
[CUSTOMER QUESTION]
"""
Response requirements:
1. Start with empathy or appreciation
2. Provide a clear, direct answer
3. Offer further assistance
4. Maintain a friendly and professional tone
6. Chatbot System Prompt Templates
Use these with get_completion_from_messages() to build context‑aware assistants.
General Customer Support Bot
You are a friendly and knowledgeable customer support bot for [COMPANY NAME].
Your responsibilities include answering questions about our [PRODUCTS/SERVICES], assisting with order inquiries, and processing returns.
Rules:
• Only answer questions related to [COMPANY NAME] and our products/services
• If you don't know the answer, politely explain and suggest contacting human support
• Always maintain a patient and helpful tone
Domain‑Specific Expert Assistant
You are an expert [DOMAIN, e.g., "Python developer", "data analyst", "English tutor"].
Your task is to help users solve problems related to [DOMAIN].
Guidelines:
• Explain concepts in simple, easy‑to‑understand language
• For coding questions, provide complete, runnable code examples
• Clearly state if you are unsure about any information
Task‑Specific Assistant
You are a dedicated [TASK, e.g., "meeting note taker", "email writer", "code reviewer"] assistant.
Your only job is to help users complete [TASK] efficiently.
Do not answer any unrelated questions.
Strictly follow the user's instructions and output results in the specified format.
Critical Usage Tips (From Real Production Work)
Temperature tuning
- temperature = 0 – Factual tasks: summarisation, classification, translation. Consistency is everything.
- temperature = 0.7 – Creative tasks: email generation, marketing copy, brainstorming.
- temperature = 1.0 – Only for highly creative, low‑accuracy‑need scenarios.
Prevent prompt injection
Always wrap user input with triple backticks ("""). This stops malicious or accidental input from overriding your instructions.
Control output length
If responses are too long, add a hard limit: “Keep your response under 150 words” or “Answer in 3 sentences or less”.
Iterate, do not guess
No prompt is perfect on the first try. If the output is off:
- Make instructions more specific
- Add constraints
- Show examples of what you want (and what you do NOT want)
- Break complex tasks into smaller, separate prompts
Frequently Asked Questions
Will these templates work with other LLMs like Claude or Llama 3?
Yes. The underlying principles are model‑agnostic. You may need small adjustments for model‑specific quirks, but they work out of the box with Claude, Gemini, and Mistral.
How do I handle long inputs that exceed the context window?
Split long documents into smaller chunks and process them sequentially. For summarisation, use a recursive approach: summarise each chunk, then summarise the summaries.
System prompt vs user prompt – what is the difference?
System prompt sets the overall behaviour (e.g., “You are a helpful assistant”). User prompt contains the specific task or question. System prompt is sent once at the beginning; user prompt is sent with every new message.
How can I make my prompts more robust?
Add explicit negative constraints: “Do not include any personal opinions” or “Do not make up information that is not present in the input text”.
Final Word
Prompt engineering is the single fastest way to unlock real value from LLMs. These templates are not theoretical – they are pulled straight from Andrew Ng’s OpenAI course and refined through hundreds of production calls.
Start with the template that matches your use case. Test it with real data. Then tweak. Within a few iterations you will develop an intuition for what works with GPT‑3.5, GPT‑4, and beyond.
Happy prompting.