Prompt Engineering  

Prompt Engineering Guide: Templates, Fixes & Best Practices

Prompt Engineering

🧠 Case Study: Improving Customer Support with Prompt Engineering

Goal

A SaaS company wants to use GPT-4 to automate Tier 1 customer support, answering FAQs accurately and politely without escalating unnecessarily.

Initial Prompt

"Answer customer questions about our product."

Problem

  • Too vague: inconsistent tone and irrelevant responses.

  • No context: lacks grounding in product info.

  • No constraints: may hallucinate or over-answer.

Iteration 1: Role Prompting

"You are a Tier 1 support agent for a B2B SaaS company. Your job is to answer customer questions clearly and politely using the knowledge provided."

Results

  • Tone improves.

  • Still hallucinates some features.

Iteration 2: Context Injection

"Use only the following product knowledge to answer questions. If uncertain, say 'Let me escalate that for you.' [Insert FAQ]"

Results

  • Accurate answers.

  • Handles uncertainty gracefully.

Iteration 3: Chain-of-Thought

"Think step by step. First, check if the question is covered. If not, escalate. Then respond."

Results

  • Near-zero hallucinations.

  • Output is more precise.

Outcome

Metric Before After
Hallucination Rate 38% 4%
Avg. Response Time 3.2s 2.6s
Customer Satisfaction 72% 91%

Takeaways

  • Role + context + reasoning = reliability.

  • Clear structure beats length.

  • Escalation logic reduces risk.

📚 Prompt Template Gallery: Copy, Paste, Modify

1. Writing Assistant

"You are a professional copywriter. Write a [tone] article on [topic] for a [audience]. Use [#] key points. Stay under [word count]. Format with [style]."

2. Coding Companion

"Write [language] code that [goal]. Include inline comments and a short explanation. Assume the reader is junior."

3. Tutor or Explainer

"Explain [topic] like I’m [audience]. Use analogies. Stay under [word count]. Include a simple quiz."

4. Customer Support Agent

"Use this knowledge base to answer. If unsure, escalate. [Insert docs]
Customer Question: {{QUESTION}}"

5. Prompt Debugger

"Here's a weak prompt: [insert]. Suggest 3 better versions. Explain each one."

6. Strategy Designer

"Act as a consultant. Given [scenario], recommend top 3 actions with pros, cons, and outcomes."

🚫 Prompt Pitfalls to Avoid (and Fixes)

1. Vague Prompts

❌ "Write a blog post about AI."
✅ "Write a 600-word blog post in a friendly tone for startup founders about AI tools for marketing."

2. Overloaded Prompts

❌ "Write a tweet thread, blog, and SEO plan."
✅ Break into steps: tweet → post → plan.

3. No Role or POV

❌ "Summarize this article."
✅ "You are a financial journalist. Summarize for The Economist readers."

4. No Constraints

❌ "Write code to auto-reply to emails."
✅ "Write code to reply only to tracking requests. No attachments. Keep under 50 words."

5. No Feedback Loop

❌ "Why is this verbose?"
✅ "Here’s my result. It's too long and jargony. Rewrite it shorter and punchier."

6. One-Size-Fits-All

❌ "Answer like ChatGPT."
✅ "This is for GPT-4. Follow OpenAI output behavior."

Rule of Thumb:

Bad output = bad prompt. Tweak. Test. Improve.

Here’s a concept for a PDF prompt engineering cheatsheet — tight, skimmable, and useful at a glance. It’s organized into clear blocks with bold headings, minimal text, and a visual-friendly layout. You can export this as a 2-page PDF for workshops, desks, or internal docs.

✅ Prompt Engineering Cheatsheet

Smarter Prompts. Better Results.

🧱 Prompt Structure Formula

[ROLE] + [TASK] + [CONTEXT] + [CONSTRAINTS] + [FORMAT]

Example:

You are a marketing strategist. Write a casual 500-word email for Gen Z founders about AI branding trends. Use bullet points and end with a CTA.

🔧 Prompt Templates by Use Case

✍️ Writing

"You are a copywriter. Write a [tone] blog post on [topic] for [audience] using [#] key points. Keep it under [word count]."

💻 Coding

"Write [language] code that does [goal]. Add inline comments and explain the logic. Assume a junior developer."

🧠 Explaining

"Explain [topic] like I’m [audience type]. Use analogies. Keep it short. Add a quiz with 2–3 questions."

🎧 Support

"Use only the info below to answer. If uncertain, escalate. [Insert docs]  \nCustomer: {{QUESTION}}"

🔍 Debugging

"Here’s a weak prompt: [insert]. Suggest 3 better versions. Explain your reasoning."

📈 Strategy

"Act as a consultant. Given [scenario], recommend 3 actions with pros/cons/outcomes."

⚠️ Prompt Pitfalls to Avoid

Mistake Why It Fails Fix Example
Too Vague No direction, generic output Add tone, audience, structure: "Write a friendly 600-word post for founders"
Overloaded Prompt Tries to do too much in one step Break into smaller, sequential prompts
No Role GPT guesses tone and perspective Assign a voice: "You are a journalist for The Economist…"
No Constraints Hallucinations or long output Add limits: "Only reply using this source. Keep it under 50 words."
No Feedback Loop No learning from bad outputs Re-prompt with: "Make this shorter and punchier. Avoid jargon."
Assumes All Models Work the Same Output varies between models Tailor prompts for GPT-4, Claude, etc.

🧩 Bonus Tools & Tricks

  • Smart variables: [tone], [audience], [word count], [format], [goal]

  • Prompt logic: Use Chain-of-Thought → "First, check for X. Then Y. If not, do Z."

  • Testing strategy: One prompt, multiple models. Or multiple prompt tweaks, one goal.

🛠 Use This Checklist Before You Run a Prompt

✅ Did you define the role of the AI?

✅ Did you add the goal, audience, and tone?

✅ Did you include constraints (length, style, sources)?

✅ Did you specify the output format?

✅ Do you have a feedback loop for improving results?