Skip to content
PKResources
Course outline

Agentic Engineering: the hands-on course · Module 2: Context engineering

Feeding the right files, docs and examples

Point, paste or leave out: how to give an agent the files, docs and reference examples it needs, and nothing it doesn’t.

Lesson 7 / 24 · ⏱ 8 min

Agents can search your repo on their own, and they are decent at it. But searching costs steps and budget, and they sometimes find the wrong thing first: the deprecated helper, the old pattern, the test nobody maintains.

The fastest way I know to raise the quality of agent output is to hand it the right material up front. Not more material. The right material.

Three ways to give context

Point“see src/billing/tax.ts”cheap to writeread only if neededmy defaultPastetext inline in the briefalways seenalways paid forfor things not in the repoLet it searchno hint at allextra stepsmay pick the wrong onefine for well-known code
Each option trades effort now against budget and risk later.

Pointing is my default: a path plus one line of why. Pasting is for things the repo doesn’t contain, like a customer’s bug report, an API response, or the section of a spec that applies.

The reference example beats the description

If you want a new endpoint, component or migration to look like the others, don’t describe your conventions. Name the best existing one and say “follow this.”

Add a GET /invoices/:id/pdf endpoint.

Follow src/routes/invoices/get-invoice.ts as the reference:
same validation, error handling and test layout.
Its test is src/routes/invoices/get-invoice.test.ts.

Business rule not in the code: draft invoices return 404, not 403.

External docs and library versions

Agents learned libraries from a snapshot of the past. If you use a newer major version, they may confidently write the old API. When a task leans on a library that changed recently, give it the relevant page of the docs for your version, or point to a local copy, and name the version in the brief.

Build a context pack

For any task bigger than a one-liner, I assemble the same four things before I hit enter.

  1. 1

    Where

    The two or three files where the change will land.

  2. 2

    Like what

    One reference example of the pattern to follow, and its test.

  3. 3

    What the code can’t tell it

    Business rules, constraints, the one gotcha you already know about.

  4. 4

    Outside facts

    Only the excerpt that applies: an error, a spec section, a docs page for the version you use.

Writing the full brief, with acceptance criteria, is Module 3. The context pack is the part of the brief that answers “what should it look at?”

Point, paste or leave out?

🎮 Point, paste or leave out?

1 / 8 · Score: 0

Task: add CSV export to the orders page. How would you give each item to the agent?

Before you move on

✅ Key takeaways

0 / 4 completed