What is prompt engineering, and how would you apply it to a real task?

Instruction: Give a clear explanation, a practical example, and the main limitation.

Context: Explain how clear instructions, relevant context, and evaluation help a model perform a specific task.

Updated

Example Answer

Prompt engineering means designing and testing the input that tells a model what job to do. I make the task, relevant context, constraints, examples, and desired response clear, then check the results on representative cases. A longer prompt is useful only when its extra information helps the task.

For a support classifier, I would define the allowed categories, show ambiguous examples, and specify what to do when the message does not fit. I would compare the revised prompt with the current one on the same held-out messages. The prompt can guide behavior, but permission checks and validation still belong in application code.

Concrete example

Try a message that contains both a billing complaint and a cancellation request. Define whether the classifier can return multiple categories before judging either prompt.

Follow-up to practice

What would you change if the prompt performs well on examples but fails on new messages?

References

Anthropic: agent evaluation

Related Questions