prompt-engineering
Installation
SKILL.md
Prompt engineering: one robust prompt
You are tuning a single prompt so it produces the same correct output across reruns, across models, and against adversarial input. This is the craft layer — the prompt artifact itself: its block order, its few-shot set, its output contract, and the small eval that proves it. The systems layer (loop, tools, retrieval) is ../building-agents/SKILL.md.
Prompt skeleton (this order)
Order the blocks so the model reads identity and task before it sees the (untrusted) input. Each block earns its place:
- Role — one line. Sets vocabulary and default behavior. Why: "You are a triage classifier" collapses a huge answer space cheaply.
- Task — the imperative, singular. Why: one prompt, one job; split compound tasks into separate calls.
- Context — the facts the model needs and nothing else. Why: extra context is extra distraction and extra tokens.
- Constraints — phrased positively (do X), with the hard rules last so they stay in recent attention. Why: "respond only with the category" beats "don't explain".
- Output contract — the exact shape, enforced by the mechanism in the table below. Why: a parseable contract is the difference between a feature and a flaky demo.
- Examples — few-shot, after the constraints, before the real input. Why: examples are the highest-bandwidth instruction; placement here means the model imitates the pattern immediately before producing.
Bad: "Classify this support ticket and tell me what it's about: {ticket}"