Chapter 8 Avoiding Hallucinations . A grounded QA template: extract the most relevant quote into <scratchpad , judge whether it answers the question, and only then write a brief nu
Chapter 8 Avoiding Hallucinations . A grounded QA template: extract the most relevant quote into <scratchpad , judge whether it answers the question, and only then write a brief nu
A prompt chaining pipeline that first pulls verbatim relevant quotes from a long document, then uses those quotes to generate a grounded answer to your question. Use it when you ne
The few shot variant of Anthropic's moderation cookbook. Demonstrates that, for short labels, well chosen positive and negative examples often beat chain of thought. Source: https:
From the same Anthropic prompt engineering guide. The canonical XML tagging recipe for any prompt that mixes instructions, context, examples, and variable inputs used throughout th
Chapter 7 Using Examples / Few Shot . Demonstrates how two worked examples of a paragraph structured individuals list train Claude to produce the same shape on a new paragraph, no
Reasoning model system prompt for catching inconsistencies in tabular data. Returns a tight JSON contract that downstream code can branch on. Source: https://cookbook.openai.com/ex
OpenAI's recommended pattern for summarizing an article into a fixed schema. Each field is described inline so the model knows exactly what the JSON shape means. Source: https://co
Guides you on enriching LLM prompts with database schemas, sample data, and table relationships to improve generated SQL quality. Use this when Claude is producing inaccurate or in
Named entity recognition prompt that locks the model to a single, closed label set. Pinning the categories is what makes the output safe to feed into a downstream parser. User turn
From misc/generate test cases.ipynb in the cookbook. A meta prompt that takes a prompt template with {{variables}} and generates synthetic test cases in a structured XML format the