How to keep an AI coding agent focused on one task
Keep an AI coding agent focused with 10 reusable instructions, a clear example project request and practical advice for handling unrelated changes.
Ask an AI coding agent to add a feature, and it may also start tidying code, changing nearby behaviour or suggesting improvements. Some of those ideas may be useful. That doesn’t mean you want them implemented now.
Give the agent one clear job, tell it what to leave alone and explain how you’ll check the result. The following instructions help establish that way of working.
AI coding agent instructions: 10 best practices we use
These are shortened versions of instructions we use when building with AI agents. Adapt them to your project and permissions. They guide the work; they do not replace permission controls, tests or human review.
Read the current state.
Read the project's instructions and relevant code before editing. Identify what this change must preserve, and say what you could not inspect.
Reuse before building.
Check the tools, libraries and working paths we already have. Use the established solution before introducing another mechanism.
Make the smallest complete change.
Deliver the requested outcome with the smallest change that meets the requirements. Leave unrelated features and refactoring out.
Own the approved work.
Choose the tools and solve routine problems within the agreed scope. Ask for a decision only when it changes the outcome, risk or permission needed.
Challenge the brief when evidence disagrees.
Treat my diagnosis as a hypothesis. If the evidence points elsewhere, show me what you found and recommend the correction.
Reproduce before fixing.
For a defect, demonstrate the failure and add a focused test at the layer that failed. Show that it fails before the fix and passes afterward.
Fix the code, not its explanation.
If you need more than one paragraph to justify a function or section of code, reconsider the implementation. Simplify the code and fix the root cause instead of writing a longer defence of it. Change the code responsible for the behaviour rather than adding a parallel path that only hides the defect.
Verify the real outcome.
Run checks proportionate to what changed. Check interface changes in a browser, and inspect what was actually saved or served before claiming success.
Protect existing work and permissions.
Preserve changes you did not create, keep secrets private and use test data. Stop before destructive or public actions I have not authorized.
Leave a clean, usable handover.
Report what changed, what you verified and what remains uncertain. Save useful decisions in the existing project record and remove only your own disposable artifacts.
Where to save your agent instructions
You shouldn’t need to paste all ten instructions into every conversation. Put the rules you want to reuse in the project instruction file your coding tool reads. AGENTS.md and CLAUDE.md are examples, but different tools load different files.
Use skills for more detailed, reusable procedures, such as how to test an interface or prepare a release. The agent can load the relevant procedure when it needs it, rather than carrying every instruction into every task.
These standing instructions describe how you want the agent to work. Your next request should describe the particular job you want done.
Give the agent one clear job
“Add search to my app” sounds simple, but leaves important choices open. What should it search? Should it search everything stored in the app, or only what is already on screen?
You don’t need to work out the implementation yourself. Explain what the user should be able to do, then ask the agent to inspect the code and identify anything you need to decide.
Point it to the project’s existing documentation too. That might include design conventions, database information or decisions from earlier work. Ask it to tell you what it couldn’t access instead of filling the gaps with assumptions.
In Giljo HQ, that reusable information can live in product context, where a connected agent can retrieve it. You still need to explain what you want from this particular change.
An example project request you can copy
Suppose you have a hiking app with a list of trails and want to add search. This is an illustrative example, not a feature we have built or tested.
Ask your connected coding agent:
Use Giljo HQ to create a project for my hiking app titled “Search trails by name.” Save the following as its description:
Add a search field above the existing trail list so users can find a trail by typing part of its name.
Inspect how the list loads. Explain whether search will cover all trails or only those already loaded.
Follow the app’s existing design and coding conventions. Search trail names only. Don’t change stored trail data, add description or map search, or include unrelated cleanup.
Check that partial names match regardless of letter case, an unmatched search shows a clear message, and clearing the field restores the list. Check keyboard use too.
Creating the project saves the work for when you’re ready. To start, tell the agent:
Execute the “Search trails by name” project in Giljo HQ. Stage the plan and agent assignments, then wait for my go-ahead before implementation.
The agent takes the orchestrator role, prepares the plan and assembles the needed agents using the available templates. You review the staged work and tell it when to proceed.
If the agent goes off task
If the agent starts making changes you didn’t ask for, tell it to pause and explain them. Which changes are necessary to finish the job? Which are optional improvements?
Review that explanation before continuing. Avoid a blanket “undo everything”: the workspace may contain changes you or another session need.
Useful ideas don’t have to disappear. Ask the agent to save an unrelated improvement as a task for later. If it finds a problem that prevents the current feature from working, ask it to explain the problem so you can decide whether to change the plan.
When the job is finished, compare the result with your original request. Ask which checks ran and what remains untested, then try the feature yourself. A confident completion message isn’t evidence that the work is correct.
Keeping the work together in Giljo HQ
You can keep a request like this in a document or issue tracker. In Giljo HQ, product context holds the reusable background, while a project holds the requested change and its plan.
Separate tasks give you somewhere to save ideas without adding them to the current job. A handover helps a fresh session continue when the conversation has become long. Our guide to tasks and handovers explains both.
The instructions help the agent understand what you want. Your coding tool’s permission controls and your review of the actual result remain important.
Was this useful?
A cookie remembers your mark. Feedback privacy.