Agent Wranglers

Prompts as code Recommended

Show the model worked examples

Include two to five worked examples of input and the expected output in prompts where format or tone matters. Keep them in the prompt file and out of the eval set.

How to do it

Pick examples that cover the common case, one edge case and one case where the right answer is "I don't know". Keep them short and in the exact output format. Never copy eval cases into the prompt, because the eval then measures memory, not skill. A test can compare the two sets.

Example

const overlap = promptExamples.filter(example => evalCases.some(c => c.input.trim() === example.input.trim()));
expect(overlap).toEqual([]);
overlap = {e.input.strip() for e in prompt_examples} & {c.input.strip() for c in eval_cases}
assert not overlap, f"eval cases leaked into the prompt: {overlap}"

How to check

A test confirms no example input in any prompt file also appears in that feature's eval set.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers ai features playbook: https://agentwranglers.se/playbook/ai-features/prompts-as-code/worked-examples.