Context — the part everyone underweights
Artifact: your prompt with one piece of context you'd been assuming, now stated
1. The shape of useful context
We covered why context matters in chapter 1. This unit is about what shape useful context takes.
Most context lands in one of four buckets:
- Background. What kind of thing this is. Language, framework, stack, scale, the relevant facts.
- Constraints. What can't change. Public APIs, existing tests, the database schema, the user-facing URL.
- Prior attempts. What you've tried that didn't work. So the model doesn't propose your last three failed ideas.
- Goal state. What success looks like in concrete terms.
Most prompts include only background. Adding constraints and prior attempts is where the biggest jumps in quality happen.
2. Same problem, two levels of context
A bug-fixing prompt.
I have a Postgres query that's slow. Can you help?
SELECT * FROM orders WHERE user_id = $1 ORDER BY created_at DESC LIMIT 10;The model will propose generic Postgres advice: add an index on user_id, add a composite index on (user_id, created_at), increase work_mem, run EXPLAIN ANALYZE. Some of that might match. Most won't.
Background: Postgres 15, ~50M rows in 'orders' table. Query takes 2-4 seconds. Should be under 100ms.
Constraints: I can't change the schema (compliance review takes 3 months). I can add indexes.
Prior attempts: I tried adding an index on (user_id). Query planner ignores it. I tried (user_id, created_at) — query time dropped to 1.2s, still too slow.
Goal: sub-100ms p95. The query runs ~500 times per second.
Query:
SELECT * FROM orders WHERE user_id = $1 ORDER BY created_at DESC LIMIT 10;
What am I missing?Now the model can converge on actual likely answers — probably index ordering ((user_id, created_at DESC)), or that SELECT * is fetching too many columns, or that the query needs a covering index. The answer space narrowed from "all Postgres performance ideas" to "the ones consistent with the constraints you stated."
3. The cost of overpacking
Context isn't free. Too much, and you bury the actual question. The pattern that fails: dumping your entire architecture document into the prompt and asking what should I do?
The rule: include the context that would change the answer if the model knew it. Skip the rest.
A test: read your prompt and ask, if I deleted this paragraph, would the answer be worse? If no, delete.