What is Context Engineering? The Skill That Matters More Than Prompting
Prompt engineering is about HOW you ask. Context engineering is about WHAT the model sees when it answers. In production AI systems, context engineering matters far more.
The difference
Prompt engineering: Crafting the instruction β βYou are a senior developer. Review this code for bugs.β
Context engineering: Deciding what code, docs, history, and metadata to include alongside that instruction. Which files? How much history? What documentation? What to leave out?
Why it matters more
A perfect prompt with bad context produces garbage. A mediocre prompt with great context produces useful output. The model can only reason about what it can see.
This is why Claude Code with its full codebase understanding outperforms ChatGPT with a pasted snippet β same model quality, vastly different context.
The context budget
Every model has a finite context window. Even with 200K tokens (Claude) or 1M tokens (Gemini), you canβt include everything. Context engineering is about maximizing signal-to-noise within that budget.
What to include:
- The specific files being edited
- Relevant type definitions and interfaces
- Recent git history for the changed files
- Error messages and stack traces
- Project conventions and rules
What to exclude:
- Unrelated files (noise)
- Full dependency source code
- Old conversation history (summarize instead)
- Redundant information
Context engineering in practice
AI coding tools
Aider uses a repo map (tree-sitter AST) to understand your codebase structure without loading every file. OpenCode uses LSP for type-aware context. Both are context engineering β deciding what the model sees.
The --read flag in Aider and Claude Code is pure context engineering: βinclude this file for reference but donβt edit it.β
RAG systems
RAG is context engineering at scale. Instead of stuffing everything into the prompt, you retrieve only the relevant documents. The quality of your chunking, embeddings, and retrieval determines context quality.
MCP servers
MCP is a context engineering protocol. It lets AI models pull in exactly the context they need β a database query result, a fileβs contents, a Slack message β on demand rather than pre-loading everything.
Context engineering vs prompt caching
Prompt caching is an optimization for context engineering. Once youβve decided what context to include, caching ensures you donβt pay full price for it on every request.
The hierarchy
1. Context engineering β what does the model see?
2. Prompt engineering β how do you ask?
3. Model selection β which model answers?
4. Output parsing β how do you use the response?
Most developers optimize #3 and #4 while ignoring #1. The biggest gains come from better context, not better models.
FAQ
Is context engineering just prompt engineering with a different name?
No β prompt engineering focuses on crafting the instruction itself, while context engineering focuses on selecting and organizing all the supporting information the model sees. You can have a perfect prompt that fails because the wrong files, docs, or history were included alongside it.
How do I get better at context engineering?
Start by paying attention to what information you include when asking an AI for help. Notice when adding a type definition, error message, or relevant file dramatically improves the output. Practice trimming irrelevant context and measuring how it affects response quality.
Does context engineering matter for small context windows?
It matters even more with small context windows because every token counts. With a 4K or 8K window, you must be extremely selective about what to include. But even with 200K token windows, poor context selection leads to the model losing focus on what matters.
Related: Prompt Engineering vs Context Engineering Β· Context Packing Strategies Β· What is Prompt Engineering? Β· What is RAG?