System Prompts That Actually Work: A Practical Guide
The system prompt is the brief you give the model before the conversation starts. Most poor LLM results come from a vague brief, not a weak model.
1. Give context, not just commands
Explain who the users are and why the task matters. A model that understands the goal makes better judgment calls.
Weak: You are a helpful assistant. Answer support questions.
Better: You answer customer questions for Acme Cloud, a hosting company.
Customers are developers, often in the middle of an outage, so
lead with the fix, then the explanation. If a question needs
account access, tell them to open a ticket at acme.dev/support.
2. Be explicit about format
Say exactly what the answer should look like: length, headings, bullet lists, code language, or a JSON shape.
Format every answer as:
1. A one-sentence summary.
2. The fix as a numbered list of commands.
3. A "Why this works" paragraph of at most 3 sentences.
3. Tell it what to do, not only what to avoid
"Don't be verbose" is weaker than "Answer in at most 120 words". Positive, measurable instructions are easier to follow.
4. Separate instructions from data with tags
When you paste documents or user input into a prompt, wrap them in clear delimiters such as XML-style tags. This reduces confusion between your instructions and the content being processed.
Summarise the contract below for a non-lawyer.
<contract>
...pasted contract text...
</contract>
List any clause about termination separately.
5. Show an example of a great answer
One or two examples of ideal output often beat a page of rules. Keep examples varied so the model doesn't copy one too literally.
6. Plan for the edge cases
- What should happen when the answer is unknown? ("Say you don't know and suggest where to look.")
- What is out of scope? ("Politely decline billing questions and link to the billing page.")
- How should conflicting user requests be handled?
Test like code
Keep a list of 20-50 real questions with the answers you expect, and re-run them whenever you change the prompt. Prompt changes that fix one case often break another.
Comments
No comments yet. Have a question or a tip? Be the first to share it.