Write instructions and knowledge files for an assistant
Key takeaway
Good instructions for an AI assistant describe role, task, input format, output format, limits and what to do when information is missing. Knowledge files should be short, current and clearly named, otherwise the assistant uses outdated or conflicting information.
Lessons in this path
What are the building blocks of good instructions?
Instructions are not a magic formula but a job description, like the one you would give a new assistant. The more precisely you describe a good result, the less you have to fix afterwards.
| Block | Question it answers | Sample wording |
|---|---|---|
| Role | Who are you for me? | You prepare replies to first inquiries for my photo studio. |
| Input | What do you receive? | I paste the text of an inquiry. |
| Output | What does the result look like? | Reply of max. 150 words, formal tone, three questions as a list. |
| Knowledge | What do you rely on? | Use only the file services.md for prices and packages. |
| Limits | What do you never do? | Never mention dates or discounts. |
| Gaps | What do you do when unsure? | Mark missing details with [OPEN] instead of guessing. |
How do you prepare knowledge files?
Knowledge files are the documents the assistant draws on. Technically, the provider searches these files and passes matching passages to the model (often called “retrieval”). It follows that long, unstructured PDFs with old versions produce worse matches than short, well-structured text files.
- One file per topic: services, prices and packages, process, FAQs, style samples.
- Clear headings and short paragraphs; tables for prices and packages.
- Put a “last updated” date in the first line of each file.
- Keep personal client data out of permanent knowledge files.
- Delete outdated files instead of adding new versions next to them.
If two files contradict each other, the assistant picks at random. One valid price list matters more than a complete archive.
Why are examples so effective?
Language models follow examples closely. Two or three real, anonymised replies you were happy with shape tone and length more reliably than any style description such as “friendly but professional”. Where possible, add a negative example and note what is wrong with it.
Make sure the examples cover the variety of your cases. If all examples are wedding inquiries, the reply to a corporate inquiry will sound like a wedding too.
In practice, a separate “examples” file with a short heading per case works well, for instance “inquiry with tight budget” or “inquiry outside my services”. The assistant can then find the matching pattern, and during maintenance you see immediately which case is still missing.
How do you test a new assistant?
Before going live, create five to ten test cases: three typical, two difficult and at least one where the assistant should decline or ask for more information. Save these cases, because you will need them again after every change to the instructions.
- Do all facts match the knowledge files?
- Does the assistant respect the limits (no dates, no discounts)?
- Does it mark missing details instead of inventing them?
- Do length and tone fit without rework?
Going deeper: version instructions and isolate failure sources
Keep your instructions in a separate text file with a date and a short change note. If quality suddenly drops, you can tell whether your change, a new knowledge file or a provider-side model update is the cause. Providers swap models in the background; a saved test set makes such shifts visible.
A common failure mode is instruction competition: the longer the system prompt, the more likely individual rules are ignored. Put hard limits at the beginning and end, phrase them positively (“only quote prices from the file”) and cut anything no test case checks. For files: when an answer is wrong, first check whether the right passage was retrieved at all – some interfaces show the passages used.
Example: a freelance bookkeeper sharpens an assistant
A fictional freelance bookkeeper uses an assistant for client queries. The first version occasionally invents deadlines. She adds the rule “Only mention deadlines listed in deadlines.md; otherwise write [CHECK DEADLINE]” and deletes two old checklists that contained conflicting information.
Using her eight saved test cases she checks the new version: seven pass immediately, one lacks the marker. She moves the deadline rule to the top of the instructions, tests again and records the change with a date.
Common mistakes
- Providing only a style description instead of real examples.
- Uploading old and new price lists side by side.
- Having no rule for missing information, so the assistant guesses.
- Changing instructions without rerunning the same test cases.
Frequently asked questions
How long can instructions be?
As short as possible, as long as necessary. One to two pages usually suffice; anything beyond that belongs in knowledge files.
Should I write instructions in English or German?
In the language the output should be in. Mixed languages easily lead to mixed replies.
Can the assistant learn from my corrections?
Not permanently by default. Deliberately transfer recurring corrections into the instructions or examples.
Try it yourself
For your first assistant, write the six building blocks from the table, prepare no more than five knowledge files and test with seven saved cases.
Check your result
At least six of seven test cases produce a usable result without rework, and missing details are flagged rather than invented.