> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

---
title: "Prompting & Context Engineering"
url: https://daily.dev/agentic-ai-hub/prompting-context-engineering/
description: "Prompting is the highest-leverage, lowest-cost skill in this whole handbook. Small changes in how you frame a request move quality more than most people expect."
lastUpdated: "2026-07-22"
---

Prompting is the highest-leverage, lowest-cost skill in this whole handbook. Small changes in how you frame a request move quality more than most people expect. This section is the *non-agent* version, covering single-shot and few-turn interactions. The agentic version, where prompts become skills, memory, and dynamically assembled context, is [Context, Skills & Memory](/agentic-ai-hub/context-skills-memory/). For worked examples, the provider prompt-engineering guides are the best reference ([Anthropic](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview) and [OpenAI](https://platform.openai.com/docs/guides/prompt-engineering)).

**System vs. user prompts.** The *system prompt* sets durable context: who the model is, what rules it follows, what format to output, what tools it has. The *user prompt* is the specific request. Keep role/constraints/format in the system prompt and the actual task in the user prompt. This separation makes behavior more consistent and, conveniently, lets the stable system prefix be cached (see prompt caching, [Core Concepts](/agentic-ai-hub/core-concepts/)). Put the most important instructions where they won't get lost, early and restated near the end for long inputs.

**Zero-shot vs. few-shot.** *Zero-shot* is just asking. *Few-shot* means showing a handful of input→output examples before the real query, which anchors format and style far more reliably than describing them in words. If you find yourself writing paragraphs explaining the exact output shape you want, stop and show two or three examples instead. Few-shot is the fastest fix for "the model *almost* does what I want."

**Chain-of-thought (CoT).** Asking the model to reason step by step before answering improves accuracy on math, logic, and multi-step tasks. This is the [foundational result](https://arxiv.org/abs/2201.11903) that reasoning models later industrialized. For non-reasoning models, an explicit "think through this step by step" still helps. For dedicated reasoning models, it's largely automatic and you can often just state the problem. One caveat is that the visible chain of thought is a *performance aid*, not a faithful audit log of the model's internal computation, so don't treat it as a guaranteed explanation of *why* it answered.

**Structured output & tool-use prompting.** To get clean JSON, use the provider's structured-output / tool-calling features rather than begging in prose, and supply the schema. For tool use, describe each tool's purpose and parameters precisely. The model decides when to call based largely on your descriptions, so a vague tool description is a bug. Give it an explicit "if you don't know, call the search tool rather than guessing" and you'll cut hallucinations.

**Context engineering: what goes in the window and why.** As tasks get serious, prompting becomes *context engineering*: deciding what information occupies the finite, quality-sensitive context window. The discipline is curation, not accumulation. Include what the model needs for *this* task (relevant retrieved documents, the necessary examples, current state) and ruthlessly exclude noise. Order matters (put critical material at the edges, not buried in the middle; recall the "lost in the middle" effect from [Core Concepts](/agentic-ai-hub/core-concepts/)). More context is not more better. Irrelevant filler measurably degrades performance and costs tokens.

**Common failure modes.**

- *Hallucination.* Confident fabrication. Mitigate with retrieval/tools and by explicitly permitting "I don't know."  
- *Instruction drift.* In long conversations, early instructions fade. Restate the important ones.  
- *Overstuffed context.* Dumping everything in and hoping. Curate instead.  
- *Ambiguity.* The model fills gaps with assumptions. Be specific about format, audience, and constraints.  
- *Sycophancy.* Models tend to agree with a confidently stated premise. Don't lead the witness if you want an honest check.

**Prompting cheat-sheet.**

| Goal | Technique | Quick note |
| :---- | :---- | :---- |
| Reliable format | Few-shot examples | Show 2-3, don't just describe |
| Better hard reasoning | Chain-of-thought / reasoning model | Let it think before answering |
| Parseable output | Structured output / JSON schema | Use the API feature, not prose |
| Fewer hallucinations | Tools + RAG + "say I don't know" | Ground it in sources |
| Consistent persona/rules | System prompt | Stable prefix, also cacheable |
| Steer style | Few-shot + explicit constraints | Examples beat adjectives |
| Complex task | Decompose into steps | One job per call when you can |
| Cheaper repeated calls | Prompt caching | Stable content first |

The meta-skill: **iterate**. Write a prompt, look at failures, fix the specific failure, repeat. Prompting is empirical, not theoretical.