Skip to main content
Bring your team and maximize your impact at Dreamforce. Register three or more to unlock $999 passes.

Write Better Prompts

Learning Objectives

After completing this unit, you'll be able to:

  • Apply a six-step framework to write effective prompts.
  • Organize complex prompts using triple-quote formatting.
  • Outline best practices for prompt writing.
  • Write prompts that produce consistent, reliable results.

Organizing Complex Prompts with Triple Quotes

When a prompt mixes your instructions with the information the model should use, the model can treat that information as extra instructions. Use triple quotes (""") as a fence around the data. Everything outside the fence is what you want the model to do. Everything inside is the information it should work with.

This is different from regular quotation marks. Regular quotes mark spoken words. Triple quotes mark a block of input data, such as a case record, an email thread, or merge field values.

Before:

You are a customer service representative. Review this case and write a response email.
The customer said: "I've been waiting 3 weeks for my refund. I'm very frustrated."
Include an apology, explain the refund process, and offer a timeline. Keep it under 100 words.

After (organized with triple quotes):

You are a customer service representative.
Task: Write a response email to this customer
Instructions:
- Start with a sincere apology
- Explain our refund process
- Provide a specific timeline for resolution
- Keep the response under 100 words
- Use a professional but empathetic tone
Case Details:
"""
Case Number: 00012345
Issue: Refund delay
Wait time: 3 weeks
Customer message:
I've been waiting 3 weeks for my refund. I'm very frustrated.
"""

The triple quotes don’t quote the customer. They tell the model: this block is data to use, not instructions to follow. That keeps the customer’s words from being treated as extra commands, and it makes the prompt easier to scan and update.

Five Best Practices for Better Prompts

  1. Be specific. Instead of “Write a good email”, try “Write a professional email apologizing for a 3-week refund delay, explaining the refund process, and promising resolution within 5 business days.”
  1. Use the reference-once principle. Repeating the same data in a single prompt can lead to unexpected or inconsistent results. This is especially important in Prompt Builder where multiple merge fields may reference overlapping data.
  1. Use consistent formatting. Format your prompts the same way every time. This helps you reuse prompts and makes them easier to update later.
  1. Test and iterate. Always test your prompt with real data. If the output isn't what you expected, refine your prompt and try again.
  1. Document your prompts. Keep notes on what works and what doesn't. This helps you build better prompts faster.

The Tranquil Trails example below shows all of these in action.

Real-World Example: Tranquil Trails Resort

Here's a complete, well-structured prompt for a business:

Role: You are a guest services manager for Tranquil Trails Resort
Context: Tranquil Trails is a luxury mountain resort known for hiking, spa services, and farm-to-table dining. This guest has just completed their stay.
Task: Write a thank-you email to send after a guest checks out
Instructions:
- Thank them for their stay
- Mention specific activities they enjoyed
- Reference something personal from their comment
- Include a special offer for their next visit
- Keep a warm, personal tone
- Close with an invitation to return
Format:
- Professional email format
- Subject line included
- Body text only (no HTML)
Constraints:
- Keep the email under 200 words
- Make it feel personal, not generic
"""
Guest Details:
- Name: Sarah Martinez
- Stayed: 3 nights (March 10-13)
- Room: Mountain View Suite
- Activities: Spa treatments, guided hiking tour, farm-to-table dinner
- Comment: "Best vacation ever. Can't wait to come back!"
"""

A well-structured prompt doesn't just produce a better output, it produces a repeatable output. That's what makes prompts useful in a business context.

Next Up

In the next unit, you learn four design patterns that give you a head start on the most common prompting tasks.

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기