Prompting and Steering a Coding Agent
Write task instructions that give a coding agent enough constraint to succeed without micromanaging every step.
State the goal and the boundary, not the implementation
A good agent instruction describes the outcome and the constraints — 'add input validation to the signup form matching the pattern used in the login form, without changing the API contract' — rather than dictating every line. Over-specifying implementation removes the agent's ability to use codebase context effectively; under-specifying the boundary invites scope creep into unrelated files.
Point the agent at ground truth
Agents produce better results when they can check their own work: point them at the existing test suite, a type checker, a linter, or a clear acceptance criterion they can run themselves. An agent that can verify 'tests pass' before finishing is far more reliable than one that stops as soon as the code looks plausible.
Use project-level instructions for recurring conventions
Most agentic tools support a persistent instructions file (naming conventions, preferred libraries, commands to run, things never to touch) that applies to every session in a repository. Put durable, repo-wide rules there instead of repeating them in every task prompt, and keep task prompts focused on what is unique to that specific piece of work.
Breaking large tasks into checkpoints
For anything larger than a small, well-defined change, break the work into stages an agent can complete and verify independently — for example, 'first add the new field to the schema and migration, then update the API, then update the client' — rather than one open-ended instruction for the whole feature. This keeps each step reviewable and makes it easier to catch a wrong turn early.
Correcting course mid-session
When an agent starts down the wrong path, a specific correction ('stop editing the client, the schema change alone is wrong — the migration needs a default value') is far more effective than a vague 'that's not right.' Treat mid-session feedback the way you would redirect a junior engineer: name the specific problem and the constraint that was missed.
Practical exercise
Take a task you would normally hand to an agent with a one-line instruction, and rewrite it as a staged, verifiable brief with an explicit success check (a test to pass or a command to run cleanly). Run both versions on similar tasks and compare how much correction each required.
Sources and further reading
These primary or specialist references informed the concepts in this guide. Product details can change, so verify current documentation before implementation.