Skip to content
Knsept
Free playbook
PromptingAI Workflows

Token-efficient prompting: say less, get better code

Longer prompts don’t make better code. Four habits that cut token use and, more importantly, cut rework.

Robert Hemingway
By Robert HemingwayDeveloper & builder
Oct 8, 20262 min read

When I started building with agents, my prompts read like design documents. They had paragraphs of background, every edge case I could think of, and a style guide pasted in “just in case.”

The output got worse, not better. The model had to hunt through noise to find the one sentence that mattered, and it cost more every time.

These four habits changed that.

1. Lead with the outcome

Put what “done” looks like in the first line, not the last.

So we have this signup form and right now the validation only happens on the server, which is annoying because users don't see errors until they submit. I was thinking maybe we could add some client-side checks? It's in the components folder. Also we don't want new libraries. Ideally it would show errors inline and not submit if the email is wrong.

Goal, context, constraints. Three short blocks. The model doesn’t have to infer which part of a long paragraph is the actual request.

2. Point, don’t paste

Agents can read files. Instead of pasting 300 lines of a component, name the path and the function. You save tokens, and the model reads the current version of the file instead of a stale copy from your clipboard.

Instead of…Say…
Pasting a whole fileSee handleSubmit in src/forms/signup.ts
Re-explaining the stackA one-time context file (see below)
Listing every style rule“Match the surrounding code.”

3. Keep standing context in one file

Anything you’d say in every session belongs in a context file the agent loads automatically: stack, conventions, commands, and the things that must never happen. Write it once and keep it short. Mine is under 60 lines.

4. Ask for the shape of the answer

Most wasted tokens are in the response, not the prompt. Ask for exactly the shape you need:

Reply with:
- the diff only
- one line on anything you couldn't verify

No recap of the task, no essay about the approach, no “Here’s the updated code!” preamble.

Measuring it

Don’t take my word for it. Most agent tools show tokens per session, so run a simple test: do a week of normal tasks, note the average, then do a week with these four habits. Count the “no, I meant…” follow-ups too. Those corrections are the most expensive tokens of all, and they’re the ones that drop the most.

Say less. Say it first. Point at things instead of pasting them.

Found this useful? Share it, or follow new posts in your reader.

Robert Hemingway
Written by

Robert Hemingway

I build small, sharp tools and write down what I learn along the way: front-end craft, edge deploys, AI-assisted workflows, and the systems that hold them together.

About me