Skip to the workspace
Pebellslearn by building
Prompt Engineering  ›  Lesson

Show Examples, Then Test and Iterate

Use Examples in your Prompt 15 minFew-shot examples teach format and edge cases by demonstration, and prompts improve by scoring every change against a fixed set of test cases while changing one thing at a time.

ai agents / Show Examples, Then Test and Iterate

Explore each scene at your own pace.

01 · The rule

The rule

Show Examples, Then Test and Iterate

Tripmate has to turn messages like "need 2 seats blr→del sat morning" into clean search arguments. You describe the rules in the prompt, and it mostly works — until a user writes "day after tomorrow" or "Bengaluru" instead of "BLR". Two habits fix this: show the model examples, and test the prompt like code.

The rule

Show, don't just tell — then test on real cases and change one thing at a time.

Examples (often called few-shot prompting) teach by demonstration. A handful of input–output pairs shows the exact format, tone and edge-case handling faster than paragraphs of rules:

Convert the request into search arguments. Today is 2026-10-12 (Monday).

Request: 2 seats blr to del sat morning
Output: {"from": "SBC", "to": "NDLS", "date": "2026-10-17", "passengers": 2, "time": "morning"}

Request: going from Bengaluru to Mysuru day after tomorrow, just me
Output: {"from": "SBC", "to": "MYS", "date": "2026-10-14", "passengers": 1, "time": null}

Request: {user_message}
Output:

Choose examples that differ from each other — a city code and a full name, a weekday and a relative date — so the model learns the rule, not one surface pattern. Models copy what they see, including mistakes, so check each example is exactly right. Two to five good examples are usually enough; each one costs input tokens on every call.

Iteration is how a prompt gets good. Collect a set of real test messages, including awkward ones, and record what a correct output looks like for each. Run the prompt on all of them, look at the failures, change one thing, and run the whole set again.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.