System Prompt Builder: Draft, Test, and Improve

Build a system prompt that works by starting with goals and constraints, adding examples for edge cases, testing on real tasks, and refining from what you learn.

Updated 5 min read

Building a system prompt is a four-step loop: draft the goals and constraints, add examples for the cases that need them, test on your real tasks, and revise what failed. One iteration rarely produces a finished prompt; three or four usually does.

Most system prompts fail because they describe the desired behavior without covering the edge cases or the refusal case. Tools like fenbs let you store tested prompts as reusable skills and record the lessons from failed iterations, so you do not have to rediscover the same problems each time.

Start with goals and constraints

A system prompt does not need to be long to work. It needs to be specific. Before you write a single word of the prompt, answer four questions: What role should the AI take? What should it always do? What should it never do? What should it do when a request is unclear or falls outside its scope?

Write those four answers in plain sentences. That is your first draft. The role gives the AI a consistent frame for every response. The always-do rules define the floor. The never-do rules define the ceiling. The fallback instruction prevents the AI from guessing when it should ask instead.

Avoid adjectives that leave interpretation to the model. "Be professional" means different things to a corporate lawyer and a food blogger. "Write in a direct, neutral tone, no contractions, under 150 words per response" leaves nothing to interpret.

Add examples for the hard cases

Once you have the basic four, identify the cases that general instructions will not cover well. These are usually the edge cases: requests that are just inside or just outside scope, ambiguous inputs, and situations where the tone needs to shift.

For each hard case, add a short example directly in the prompt. Show the input and the correct response, or just describe the situation and the expected behavior. Examples do more work than general rules for behavior that is hard to describe abstractly.

Do not add examples for every possible case; add them for the cases where a general instruction fails in testing. Keep the prompt short enough to read in one pass. See system prompt examples for a set of complete prompts you can compare against your own.

Test against your real tasks

Run the draft against the inputs your AI will actually receive, not made-up examples that happen to work. Prepare at least ten real or realistic inputs: a mix of typical requests, edge cases, and out-of-scope requests.

  • Does the AI stay in the role you defined, even on inputs you did not mention in the prompt?
  • Does it handle ambiguous requests the way you intended, or does it guess?
  • Does it decline out-of-scope requests clearly and without producing a poor attempt first?
  • Does the output format stay consistent across different input types?
  • Does it stay in character over a long exchange, or does the persona drift?

For each failure, note the exact input and what went wrong. That log becomes the revision list. See context engineering vs prompt engineering for when a system prompt alone is not enough and broader context management is the better answer.

Revise and record what you learned

For each failure in your test log, make one targeted change. Add a specific rule for a case the general instructions missed. Add an example for a case where the model kept misinterpreting the input. Revise a vague instruction to be precise.

After each revision, run the full test set again, not just the case you fixed. A targeted change sometimes produces unexpected behavior elsewhere. Repeat until every test case passes.

Record what you changed and why. A system prompt with a note explaining each rule is much easier to maintain than one where the rules seem arbitrary. When circumstances change, you can revise the rules whose reasons no longer apply and leave the others intact.

Common mistakes when building system prompts

  • Writing for the average case and ignoring the edge cases. Edge cases are where prompts break in production.
  • Adding more rules without removing old ones. A prompt that grew by accretion is hard to reason about. Clean up rules that no longer apply.
  • Not testing the out-of-scope case. If you never test what happens when a user sends a request outside the AI's intended role, you will not know what it produces until a real user finds out.
  • Storing only the final version. Keep the revision history, or at least a note on what you changed and why. It saves time when something breaks later.
  • Using the same prompt unchanged across model updates. Different model versions can behave differently on the same prompt. Test after any model change.
How fenbs helps

Turn test failures into lessons for next time

In fenbs, a Lesson records what happened, what you learned, and what to do differently. Add a lesson for each significant revision to your system prompt: what failed, what you added to fix it, and how you verified the fix. The next time you build a prompt for a similar role, those lessons come up in context before you start.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

How to do this with fenbs

  1. Create a free account and add a project for the AI app you are building the prompt for.
  2. Draft the prompt: role, always-do rules, never-do rules, fallback. Start short and add only what testing shows you need.
  3. Run the draft against at least ten real or realistic inputs. Log every failure.
  4. Revise the prompt for each failure. Rerun the full test set after each revision.
  5. Add the tested prompt as a skill in fenbs. Record each rule's reasoning as a Decision.
  6. Add a Lesson for any significant failure you hit during testing, so future prompts start from what you already know.

Connect your AI app over MCP from Integrations to make the stored skill available without copying it into each new conversation. ChatGPT prompts for work shows examples of user-turn prompts that complement a good system prompt.

Questions people ask.

What should a system prompt include?

The role the AI should take, the things it should always do, the things it should never do, and what it should do when a request is unclear or out of scope. Add examples for any case where a general rule is not specific enough.

How long should a system prompt be?

As short as it can be while still covering your core cases, edge cases and refusal handling. A prompt you can read in one pass is easier to maintain than a long one. Add length only when testing shows a shorter version fails.

How do I know when a system prompt is finished?

When it passes every test case in your test set without producing a failure. In practice that means it handles your typical inputs, your edge cases, and your out-of-scope requests correctly and consistently.

Should I keep old versions of my system prompt?

Yes, or at least a note on what you changed and why. When something breaks after an update, knowing what changed is the fastest way to diagnose the problem and revert if needed.

Can the same system prompt work across different AI models?

Often, with testing. Different models interpret instructions differently, especially for tone, format and refusal handling. Test the prompt on each model you plan to use and note any differences. Record the tested version for each model separately.

More in Prompts and skills for AI work

All Prompts and skills for AI work articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.