Sub topic 13
Prompt design best practices and common pitfalls
This chapter assumes you have read the earlier chapters on template anatomy, grounding with merge fields, and the four template types (Sales Email, Field Generation, Record Summary and Flex). You should know how a template is previewed, versioned and activated. Here the focus is on writing prompts that work reliably, and on the mistakes that cause most failed templates.
Why prompt design decides template quality
A prompt template is a fixed instruction that runs many times against different records. A prompt that works for one record in a preview can fail on the next hundred. Sparse accounts, long case descriptions and odd data all expose weaknesses in the wording.
The model only sees the text that remains after merge fields are replaced. So the quality of the output depends on two things: how clear your instructions are, and how good the data behind the merge fields is. Most pitfalls fall into one of these two groups.
Core practices
State the task, the audience and the output
A good prompt answers three questions:
- What should the model produce?
- Who will read it?
- What shape should it take?
"Summarize this case" leaves all three open. The template below answers them.
Summarize this case for a support manager in three bullet points: the problem, what has been tried, and the next step.
Subject: {!$Input:Case.Subject}
Description: {!$Input:Case.Description}It names the reader (a support manager), the format (three bullet points) and the content of each bullet. Output from a prompt like this is much easier to compare across records.
Ground the prompt in data instead of memory
The model has no knowledge of your customer, your products or your pricing unless you supply it. If a fact matters, put it in the prompt through a merge field or another resource. Do not rely on the model to know it.
Ground only on what the task needs. Every extra field adds length and noise, and it also sends more data to the model. A Field Generation template that describes an account in one sentence does not need the account's full history.
Say what to do when data is missing
Merge fields resolve to empty text when a field has no value. The model then sees a sentence with a gap in it, and it may fill the gap with a plausible guess. Give an explicit rule:
Using the information below, write a one-sentence description of this account for a sales rep.
Account name: {!$Input:Account.Name}
Industry: {!$Input:Account.Industry}
Annual revenue: {!$Input:Account.AnnualRevenue}
If a value is empty, leave it out instead of guessing.The last line is the important one. Without it, a blank Industry field can turn into an invented industry.
Set limits on length, tone and claims
Models are verbose by default. State limits in numbers where you can: "under 120 words", "exactly three bullets", "one sentence". Name the tone in plain terms, such as "friendly and professional". For anything customer-facing, also say what the model must not do, for example "do not invent product details" or "do not promise discounts".
Write a short, friendly follow-up email to {!$Input:Contact.FirstName} {!$Input:Contact.LastName}, who works at {!$Input:Contact.Account.Name}.
Mention that we met recently and offer to schedule a call.
Keep it under 120 words and do not invent product details.Each instruction in this prompt can be checked in a preview. You can count the words, see whether the call is offered, and look for any product claims. If an instruction cannot be checked, rewrite it so it can.
Prefer short, separate instructions
One long paragraph that mixes the task, the data and the rules is hard for the model to follow, and hard for the next admin to edit. Put the task first, then the data lines, then the rules. Use one rule per line.
A before-and-after example
Suppose a team wants a Record Summary template for open cases. The first draft is this:
Tell me about this case: {!$Input:Case.Subject} {!$Input:Case.Description}The draft has three problems. The merge fields run together with no labels. The output format is undefined. And it never says who the reader is. A revised version:
You are helping a support manager review open cases.
Summarize the case below in three bullet points: the problem, what has been tried, and the next step.
If the description does not say what has been tried, write "Not recorded" for that bullet.
Do not suggest refunds or commitments.
Subject: {!$Input:Case.Subject}
Description: {!$Input:Case.Description}The labeled fields tell the model what each piece of data is. The "Not recorded" rule stops it from inventing work that nobody did. The last rule limits what the summary can promise.
Common pitfalls
| Pitfall | What happens | Fix |
|---|---|---|
| Vague task | Output length, tone and structure vary from record to record | State audience, format and length |
| Unlabeled merge fields | The model confuses one value for another | Put a label before each merge field |
| No rule for empty values | The model guesses to fill gaps | Add "leave it out" or "write Not recorded" |
| Too many fields | Long prompts, more noise, more data sent | Include only fields the task needs |
| Wrong merge field syntax | Text like `{!$Input:...}` appears unresolved in the output | Check the input name and the object, and test in preview |
| Testing on one record | A prompt works on a rich record and fails on sparse ones | Preview several records, including poor ones |
| Wrong template type | You work around the type's limits with extra instructions | Revisit the type choice before rewriting the text |
| Skipping review | Wrong text reaches a customer | Keep a person in the loop for external messages |
Merge field mistakes
Merge field syntax depends on the template type and the input name. In an object-bound template the input is the record the template is based on. In a Flex template, the name you give each input sets the syntax. If you rename a Flex input, update every merge field that uses it. A mismatch usually shows up in the preview as unresolved text or as an empty value.
Testing only the happy path
A preview on your best account proves little. Pick at least one record with many empty fields, one with unusually long text, and one with unexpected content, such as a case description in another language or one that pastes an email thread. Those records show whether your missing-data rules and length limits hold up.
Limitations to design around
Prompt design cannot remove the limits of the technology. Plan for these:
- Output can be wrong. A model can state something false in fluent language. Treat generated text as a draft. For emails, a rep should read and edit before sending.
- Output is not identical each time. Running the same prompt twice on the same record can give different wording. Do not write downstream logic that expects exact text.
- The prompt sees only what you give it. Data that is not in a merge field or resource is not available to the model, however obvious it may be to a person.
- Data access matters. Grounding data depends on what the running user and the template's setup can read. A template that works for you as an admin may show empty values for another user. Test with a user who has typical permissions.
- Trust Layer protections do not fix a weak prompt. The Einstein Trust Layer applies safeguards when prompts go to the model, but it does not check whether your instructions are sensible or whether the answer is correct.
- Each template type has a purpose. A Sales Email template is for email text, a Field Generation template fills a field, and a Record Summary template summarizes a record. Flex is for cases where inputs do not fit a single record. Picking the closest fit saves effort.
An iteration loop
Good templates come from short cycles of change and test, not from a perfect first draft. Because versions are kept, you can compare a new draft with the old one on the same records.
Change one thing per version. If you change the tone, the length limit and the field list at once, you cannot tell which change helped.
A short design checklist
Before you activate a version, check each item:
- The prompt names the task, the reader and the output format.
- Every merge field has a label, and its syntax resolves in preview.
- Missing values have an explicit rule.
- Length, tone and forbidden claims are stated.
- The prompt includes only the fields the task needs.
- You previewed rich, sparse and unusual records.
- You tested with a user who has normal permissions.
- A person reviews any output that goes to a customer.
Exercise
A Field Generation template that writes an account description sometimes says "a leading manufacturing company" for accounts where Industry is blank. The prompt contains the line "Industry: {!$Input:Account.Industry}". What is the cause, and what is the smallest change that fixes it?
Show answer
The merge field resolves to empty text for those accounts, and the model fills the gap with a guess. Add a rule such as "If a value is empty, leave it out instead of guessing." Then preview on an account with a blank Industry to confirm the fix.
Exercise
You change a Sales Email template to be shorter, to sound more formal, and to mention a new offer, all in one edit. The previews look worse. Why is this hard to debug, and what should you do next?
Show answer
Three changes were made at once, so you cannot tell which one caused the drop in quality. Go back to the previous version, then apply one change per new version. Preview each on the same records and compare.
Exercise
A prompt works in your preview but a sales rep reports that the generated text is missing the account name. Give two likely causes.
Show answer
First, the rep's permissions may not allow reading the data behind the merge field, so it resolves empty. Second, the merge field syntax or input name may not match the template's input. Preview as a user with typical permissions and check the merge field against the input name.