Prompt and context engineering
Giving a model the instructions and information it needs for a bounded task.
Define the outcome, constraints, examples and output format, then supply relevant context within a finite budget. Keep instructions separate from untrusted documents and tool results. Version the configuration and compare changes on representative cases instead of judging a single convincing response.
Why it matters for a product engineer
A model can only use what is in its context: the instructions, the examples and the documents you give it. The context is limited, and models get worse when it fills with things that do not matter. Prompt and context engineering is the work of choosing what goes in. Product engineers do it every time they build an AI feature, and it decides quality and cost more than the choice of model.
How to do it
- Write the outcome, the constraints and the output format before anything else.
- Add a few examples of good results, including a difficult one.
- Give the smallest set of information that answers the task. Load the rest only when needed.
- Keep instructions apart from untrusted text such as documents, emails and tool results.
- Version prompts with the code.
- Compare changes on a fixed set of real cases, not on one convincing answer.
Common mistakes
- Putting everything into the context “in case”.
- Instructions mixed with user content, so a document can give orders.
- Judging a prompt change by one example.
- Prompts edited in production with no record of what changed.
Example
Mamitsu is built for agents with limited context. Through its MCP server, an agent gets back only the fields it asked for, “so a ten-minute video costs a few lines of context instead of a full transcript”. The agent decides what it needs; the tool sends nothing else. (Mamitsu in In practice)
What reaches an agent's context from one video
| A full transcript | Mamitsu, through MCP | |
|---|---|---|
| What the agent gets | Everything said in the video | Only the fields it asked for |
| Who chooses | The tool | The agent, with its question or schema |
| Context used, ten-minute video | A full transcript | A few lines |
Less context, chosen for the task, leaves room for the work and costs less.
Reportedusemamitsu.com and the call with its maker, Nov 2026
Sources: Effective context engineering for AI agents (Anthropic) ↗ · Prompt engineering overview (Claude docs) ↗
Technical leverage
Version prompts with code, assemble context from authorized sources and run comparisons automatically when instructions or models change.
Evidence of mastery
Put it into practice- Practice
- Compare two context strategies on a fixed set of representative tasks, including irrelevant and adversarial documents.
- Artifact
- Versioned prompts, recorded inputs and an evaluation of quality, context size and failure modes.
What good looks like
- Examples used for development are separated from final evaluation cases.
- Untrusted source text cannot grant tools new permissions.
Use this evidence to assess your work. Your map status is a self-assessment, not a certification.
In practice
Real productsResources
2- docsStart here
Prompt engineering overview ↗
Anthropic docs · 5 minWhere to start when a model's output is not good enough, before changing models or adding complexity.
- articleGo deeper
Effective context engineering for AI agents ↗
Anthropic · 2025 · 14 minChoosing what goes into a model's limited context, and loading the rest only when needed.
Tools
2- ToolOpen source
- ToolOpen source
promptfoo
Open-source tool for testing prompts and models against test cases, and for red-teaming LLM apps.