Prompt Engineering for Coding Agents: frequently asked questions
Frequently asked questions
What is prompt engineering for coding agents?
Writing task instructions that an agent such as Cursor or Claude Code can act on without guessing: a clear outcome, the context only you know, constraints, an output contract and a check for when the work is done.
What is the single most useful thing to add to a coding prompt?
A 'done when' check the agent can run itself, such as a test command or a script with an expected result. It turns 'I think this works' into verified work.
Should I paste whole files into the prompt?
Usually not. Agents can open files. Give pointers to where to start, plus facts and decisions that are not in the repo. Paste errors and commands verbatim.
How do I get JSON back reliably?
Give an explicit schema with types, say what to return when there is nothing to report, and when you call the model from code, use your provider's structured output or JSON schema feature so the shape is enforced.
How many examples should a prompt include?
One or two: a typical case and an edge case that differ on the surface. More examples increase cost and the risk that the model copies them too literally.
How can I reduce token costs without hurting quality?
Ask for the answer first with numeric length limits, keep code and errors verbatim, trim rules files that load every turn, and measure with a token counter and a small eval set before and after.
What is an eval set and do I need one?
A small list of real inputs with pass/fail checks that you re-run after changing a prompt or model. Ten cases are enough to catch most regressions in a prompt you rely on.
When should a prompt become a skill?
When you have pasted it several times, its shape is stable, teammates need it, it needs supporting files, or it should trigger automatically on matching requests.
Do these techniques work with ChatGPT and other chat tools?
Yes. The structure (goal, context, constraints, output, done-when) applies to any model. Agent-specific parts, such as self-checking with commands, need a tool that can run them.
