Skip to content
← All posts
context-engineering

Context engineering: giving an AI agent the whole stack

Running the frontend and backend together, a monorepo, and a typed GraphQL contract turn an AI coding agent from a guesser into a teammate.

Context engineering cover
Published
Reading time
2 min read

The difference between an AI agent that guesses and one that is genuinely useful is context. Context engineering is the deliberate work of shaping what the agent can see and do. Here is how I set it up across a full-stack product.

Run the frontend and backend together

I keep the React frontend and the FastAPI plus GraphQL backend running side by side while I work. That way the agent does not just read code, it can exercise the whole stack: trigger a flow in the UI, watch the request hit the API, see the real response. Feedback from a running system beats reasoning about code in the abstract.

Let the monorepo be the shared context

Everything lives in a Turborepo monorepo: the design system, shared types, and the apps that use them. One agent context can span all of it. When I ask for a new feature, the agent sees how a component is actually used elsewhere and reuses it instead of inventing a fourth variation of the same button.

Make the GraphQL schema the contract

The typed GraphQL schema is the single source of truth from front to back. When the agent codes against it, the frontend and backend stay in lockstep. Change a resolver and the frontend fails to type-check before anything runs. The contract catches drift at the cheapest possible moment.

Curate the rules, do not dump everything

More context is not better context. Each package gets a small set of rules and notes (conventions, what to reuse, what to leave alone) so the agent is steered, not buried. A focused handful of anchors beats pasting the whole repo and hoping.

Treat the agent like a new teammate

All of this is what I would give a strong new hire on day one: a running app, a clear contract, and the house rules. Do that for an AI agent and it stops guessing. Good context engineering is mostly removing noise and providing the right few anchors, and it has quietly become one of the highest-leverage parts of how I work.