Prompting

Prompting Like a Pro: Context Engineering

In Phase 1 you learned to describe things clearly. That works beautifully on a small app. Then your project grows, and one day the AI confidently rewrites a function it wrote last week — as if it had never seen it.

It had not. That is not a bug. It is how these tools work.

The whiteboard

Imagine the AI has a whiteboard. Everything it knows about your project has to fit on that board: your question, the files it was shown, the conversation so far.

The board is big, but it is not infinite. When it fills up, older things get wiped to make room. That whiteboard is called the context window, and "context engineering" is just the skill of deciding what goes on it.

So when the AI forgets: it did not get lazy. The note fell off the board.

Four habits that fix most of it

  • Show, do not describe. Paste the actual code you want changed. Describing code from memory is a game of telephone, and the AI will happily invent the version you described.
  • Show only what matters. Dumping your entire project fills the board with noise and pushes out the part that counts. The right file beats all the files.
  • Restate the rules that must not change. "This app has no login and no database" is worth repeating every few messages. The AI cannot see your earlier promise once it scrolls off.
  • Start fresh when it gets confused. If a conversation goes in circles, open a new one and paste in just the current code and the current problem. A muddled whiteboard rarely un-muddles.

Write the rules down once

Most AI coding tools let you keep a project instructions file — a short document the tool reads automatically every time. It is the best-value thing you can write.

Keep it short and factual:

This is a single-page app. Plain HTML, CSS and JavaScript — no frameworks. No login, no accounts, no database; data is saved in the browser. Keep changes small and do not restructure files unless I ask.

That paragraph will save you from the same three arguments forever.

One safety note: because tools read those files automatically, treat one that arrives in someone else's project as untrusted — read it before you open the project in an AI tool. Instructions hidden in a downloaded repository can tell a coding assistant to do things you did not ask for.

Go deeper

The full treatment of this — including how to structure longer sessions and what to do when a project outgrows a single conversation — is in Context Engineering for AI Coding.