An agent in development: what to delegate and who answers
Delegate tasks whose correctness is cheap to check: renames, test drafts, log analysis and mechanical migrations. Keep architecture, permissions and security, real data and the final decision to merge. The engineer who accepts a change answers for it, so an agent's report is not proof: check the diff and CI in a clean environment.
Agentic development · The cycle
The agent wrote "everything passed". In production it did not. Who answers?
Friday evening. An agent got the task "add a field to the API response", returned a report "done, tests passed" and opened a pull request. The engineer skimmed the description, saw a green badge and merged. On Monday it turned out that the agent had run only unit tests, the integration ones, which CI runs only in the nightly build, were failing, and it had also changed the date format on the way. This article covers what to hand to an agent, how much freedom to give it and why responsibility does not move with the task.
How tool calling and MCP work is covered in the AI topic. Here the subject is working with an agent during development and testing. Claude Code, Cursor and Codex are only examples: the approach is the same, the tool details change fast.
How it works and why. A coding agent is a model in a loop: it gets a goal, picks an action (read a file, run a command, edit code), sees the result and decides what comes next. The loop stops when the model believes the goal is reached or it hits a limit. Two properties follow that shape all work with it. First, "believes it is reached" is the model's opinion, not a fact, so its report has to be checked independently. Second, every action rests on what the model saw in its context, and it saw only part of the system.
The loop of a coding agent
Figure 1. Steps 2-3 repeat without a human. Proof comes from step 5, not step 4.
What to delegate. The main criterion is the price of checking the result. If correctness is visible from a green test or a short diff, the task can be handed over. If to be sure it is right you must understand the matter as deeply as if you had done it yourself, there is no saving.
Good to hand over: renaming a field in dozens of files with tests, drafts of test cases and boundary data, diagnosing a failure from a log, mechanical migrations, a first review pass, a pull request description.
Keep for yourself: what to build and why, architectural trade-offs, changes to access rights and security, work with real data, the final "can merge".
Autonomy levels. From "proposes, the human applies" through "every action after confirmation" and "acts alone within permissions" to "works in the background and opens a pull request". The higher the autonomy, the tighter the limits must be (a separate branch, an isolated environment, minimal rights) and the stronger the automatic check. The level is raised only for a kind of task where verification is already set up and cheap.
Example: why a report is not proof. The Friday report looked like this (shortened): "Added the currency field, ran the tests, everything passed". Reading it as proof means believing that the same tests ran as in CI. Checking with your own hands takes minutes:
# what exactly changed: number of files and the task limits
git diff --stat origin/main...HEAD
# the same commands as in CI, on a clean clone
git clone . /tmp/check && cd /tmp/check
npm ci && npm run lint && npm test && npm run test:integration
The first command would have shown nine changed files instead of two. The second would have proved that the integration tests are red. The agent's report contained neither detail because the agent never asked. Conclusion: proof is CI in a clean environment plus your own look at the diff.
Two tasks for an agent
Delegate
Rename a field in 40 files
The result is visible from the compile, the tests and a short diff. The cost of checking is low.
Keep
Change the token lifetime
Correctness depends on security requirements that are not in the code. Checking needs understanding, not a run.
Figure 2. Both options are legitimate: the difference is how much it costs to be sure of the result.
Limits and alternatives. An agent does not take responsibility: whoever accepted the change answers for it. This is not distrust, it is a question of who signs for the result. The alternative to full autonomy is not "do not use it" but narrowing the task to a size that can be checked. Some tasks are cheap to verify only after extra preparation: write a test that states the expectation, and the agent's result becomes verifiable.
Common mistakes.
Treating the agent's report as proof: the report says what the model did and what it believed, not what is true in a clean environment.
Giving a broad task ("improve the module"): the result cannot be checked against a criterion and the diff is too big to read carefully.
Raising autonomy before verification is in place: mistakes pile up silently.
Handing the agent decisions about security and data: the cost of a mistake is high and it is hard to see from the code.
Check yourself
An agent opened a pull request and wrote "all tests passed". What do you check first and why is that report not enough?
Answer
You check what changed (the diff and its size relative to the task) and whether CI is green in a clean environment. The report describes what the model ran in its own session: with other variables, cached dependencies or only part of the tests.
Two tasks: rename a field in 60 files and decide whether to keep the session in a cookie or in a token. Which one goes to the agent and by what criterion?
Answer
The rename: its result is visible from the compile and the tests, the cost of checking is low. Choosing a session model is a security decision with trade-offs that are not in the code; the agent may propose options, but a human decides.
Related lessons: “A prompt for a coding agent: goal, context, limits, definition of done”, “Reviewing agent code: where to start and what usually goes wrong”, “Controlling an agent: hooks, permissions, verification, injection”.
In an interview.Junior: An agent helps with plans, small changes, test drafts and a first review. The engineer who accepted the change is responsible for it, so I check the result myself instead of trusting the report. Middle/Senior: I delegate by the price of checking: what is visible from a test or a short diff goes to the agent; architecture, permissions and data stay with me. I raise autonomy only where automatic verification already exists, and I always look at CI in a clean environment and at my own diff.
A prompt for a coding agent: goal, context, limits, definition of done
A prompt for a coding agent closes four gaps: the goal with its reason, context (files and a pattern to follow), limits and a definition of done. The agent guesses whatever is not written and takes the cheapest workaround, such as a skip or a weakened test, so those are forbidden explicitly. Work goes in small steps, and a failed attempt is rolled back and the task refined, not patched.
Agentic development · The cycle
"Fix the tests". The agent fixed them by deleting three. What was wrong with the prompt?
The task "fix the tests" sounds clear until you notice it allows several answers: fix the app, fix the test, skip the test. The agent picks the cheapest, because nobody said which one is right. It cannot see your thoughts: it has only the task text, the repository files and instruction files. Whatever you know but did not write, it will have to guess.
System and user roles and few-shot are covered in the AI topic, and prompts for generating test cases separately. Here: the everyday practice of wording a task for a coding agent.
How it works and why. The model picks its next action from the text it sees. If a limit is not in the text, it does not exist for the model, and without a definition of done it stops when it "seems enough". So a good task closes the four places where guessing would otherwise start.
What a task is made of
Figure 1. The definition of done is the part most often skipped and the most expensive to lose.
The "why" in the goal helps the agent make a sensible choice where the instruction is silent. Naming files is better than hoping the agent finds them. If a certain style is needed, show an existing file and write "follow this one". A prohibition worded concretely ("do not change expected values") works better than a general "write quality code".
Example: from a weak prompt to a strong one. The start:
Fix the tests.
What can go wrong: the agent removes the failure, weakens the check or adds a skip. All three "fix" the tests. The reworked version closes the four places:
Goal: the payment test fails at the confirmation step with a
timeout. Find the cause and fix it.
Context: tests/checkout/payment.spec.ts, the service in
src/payments/confirm.ts. Timeout handling pattern: src/orders/.
Limits: do not change expected values and do not add skip. If the
cause is in the app and not in the test, stop and describe it.
Done when: npm test -- payment passes three times in a row.
Report: what changed, what was run, what remains unknown.
Here the limit "do not add skip" closes the cheapest workaround, and "stop and describe" gives the agent a legitimate exit when the issue is not in the test. Without it the agent is forced to "fix" what should not be fixed.
The same with other weak wordings: "add validation" becomes "check the email on the client and the server with the existing validator, show errors as in the password field, add tests for an empty value and an invalid format, do not touch other fields". "Do a refactoring" becomes "extract the repeated user creation logic into one helper, behaviour does not change, run the existing tests first and again after: the result must match".
The same request in two wordings
Weak
"Fix the tests"
Allows deleting, weakening, skip. No criterion: the agent stops when it seems enough.
Strong
Goal, limits, criterion
Files are named, the workaround is banned, the check command and report format are given.
Figure 2. The difference is not length but that the places for guessing are closed.
Iteration instead of a giant prompt. A "do everything" request produces a big diff that is hard to check. Work in small steps: plan, one step, check, the next. If the agent went the wrong way, do not append long corrections to the same conversation: the failed attempt stays in the context and pulls it along. Revert the changes and refine the task, or start a new session with a better prompt. What repeats every time (commands, conventions) goes to an instruction file, not into every prompt.
Common mistakes.
A task with no definition of done: the agent stops where it "seems enough" and you have nothing to verify against.
Several independent goals in one request: the result is mixed and the diff cannot be read in parts.
Retelling from memory what can be pointed to as a file: the retelling is inaccurate and goes stale.
Secrets in the task text: they land in the context, the logs and the session history.
Check yourself
Prompt: "Add validation to the sign-up form". What is left unsaid and what would you add so the result can be checked?
Answer
The field, the place (client or server), the rules, an example of behaviour and a definition of done are not named. Add: which fields and rules, which validator exists, tests for an empty and an invalid value, the command to run and a ban on touching other fields.
The agent did half of the task wrongly. Why is it better to revert the changes and rewrite the task than to add "no, not like this, do it differently"?
Answer
The failed attempt stays in the context and affects later steps: the agent keeps developing the wrong approach. A clean task with the clarification gives a fresh starting point, and stale context does not spoil decisions.
Related lessons: “Plan first: specification, small steps, checkpoints”, “Tests with an agent: how not to let it fit the test to the code”, “Instruction files, skills and the context budget”.
In an interview.Junior: A good task has a goal, context, limits and a definition of done. I name the files, say what not to touch and which command to run for verification. Middle/Senior: The agent guesses everything that is not written, so I close the places for guessing: I forbid the cheapest workarounds (skip, weakened checks) and allow it to stop and describe the problem if it is not in the test. I do not patch a failed attempt in the same conversation: I revert and refine the task.
Plan first: specification, small steps, checkpoints
Ask for a plan first on non-trivial tasks and write code only after approval: a wrong direction is cheap to fix in a plan, costly in a diff. A plan lists files, steps with checks, assumptions, open questions and a definition of done. Give the specification as input → result examples and work in small steps, stopping after each.
Agentic development · The cycle
An agent spent forty minutes rewriting a module in the wrong direction. What could two minutes have done?
The task: add a discount for repeat orders. Without a plan the agent immediately changed the order model, a migration, three services and nine tests. Only in review did it turn out that the discount should be computed at the cart level, not the order. Fixing a plan costs a minute, fixing a finished diff of twenty files costs hours. So for non-trivial tasks you ask for a plan first and move to code only after approval.
How it works and why. An agent follows the path it chose at the start and every next step builds on the earlier ones. A wrong choice of direction does not fade: it multiplies in every file. Plan mode (in many tools, Claude Code among them) restricts the agent to reading: it studies the code and proposes actions but does not change files. So the plan is cheap and you get a point at which to say "no".
The "plan → step → check" cycle
Figure 1. Point 3 is cheap, points 4-5 repeat. A wrong plan stops before the first line of code.
When a plan is needed. The change touches several modules, the requirements are incomplete, the area of code is new to you, the consequences are risky (data, payments, access rights). If the diff can be described in one sentence ("fix a typo in the message"), a plan is overkill.
What to ask for in a plan.
which files and places in the code are touched;
steps in execution order, each with a check;
risks and the assumptions the agent made;
open questions that a human must answer;
what counts as done and how to check it.
Example: a plan where the mistake is visible. For the discount task the agent writes in its plan:
1. Add a discount field to the Order model (migration).
2. Compute the discount in OrderService.create().
3. Show the discount on the order page.
4. Tests: the discount applies to the second order.
Assumption: the discount belongs to the order.
Open questions: none.
When reviewing, look for gaps, not style. There are three here: the "Assumption" line is the mistake itself (the discount is computed on the cart, before the order exists); there are no negative scenarios (the first order, a cancelled previous order, the threshold boundary); "Open questions: none" with incomplete requirements is suspicious. The answer at plan stage: "the discount is on the cart, the threshold comes from config, cancelled orders do not count; rewrite the steps". That is two minutes instead of forty.
Specification as input. This is a natural role for QA: formulate acceptance criteria with "input → expected result" examples, a list of boundary cases and negative scenarios. Such a specification goes to the agent before the plan, and later the tests are written from it too. Examples are more concrete than prose descriptions and leave less room for interpretation:
Cart 99 UAH, 1 completed order in history -> no discount
Cart 100 UAH, 1 completed order -> 5% discount, 95 UAH
Cart 100 UAH, the only order is cancelled -> no discount
Small steps and checkpoints. Each step is one coherent change that can be read in a few minutes and checked by tests. After a step the agent stops, the human looks at the result and gives the next one. This way a mistake does not have time to pile up. It is handy to save the plan into a file: a new session can continue from it without retelling everything.
Limits and alternatives. A plan is not a guarantee: the agent may drift from it mid-work and nobody notices. So after each step the diff is compared with the plan. A plan that is too detailed goes stale after the first step, so detail the nearest steps and leave the far ones rough. If during execution the plan turns out to be wrong, stop and make a new one instead of patching on the go. For small tasks the alternative works: a short task with a definition of done and a diff check.
Common mistakes.
Approving a plan without reading it: a missed assumption surfaces in code, when fixing is more expensive.
Asking for a plan for a one-line task: extra cost with no benefit.
Letting the agent run all steps in a row: the checks between steps and the point of small steps vanish.
Not saving the plan to a file: a new session starts from zero and agreements are lost.
Check yourself
An agent's plan says "Open questions: none" although the discount requirements are incomplete. What does it mean and what do you do?
Answer
The agent filled the gaps with assumptions and did not show them. Ask it to list assumptions and questions explicitly, answer them and only then approve the plan. Otherwise the assumptions become code.
Why are "input → result" examples in a specification better than the phrase "a discount for regular customers"?
Answer
The phrase can be read in different ways (how many orders, whether cancelled ones count). An example fixes the boundaries and immediately becomes the basis of a test, so the agent and the reviewer check the same thing.
Related lessons: “A prompt for a coding agent: goal, context, limits, definition of done”, “Tests with an agent: how not to let it fit the test to the code”, “Agentic development from scratch: a step-by-step setup plan”.
In an interview.Junior: For non-trivial tasks I ask for a plan first and approve it before any code. That is cheaper than fixing a big finished diff. Middle/Senior: In the plan I look for gaps: assumptions the agent made silently, negative scenarios, missed places. I give the specification as "input → result" examples, because it also becomes the tests. I work in small steps with a stop after each, and save the plan to a file to continue in a new session.
Reviewing agent code: where to start and what usually goes wrong
Review of agent code starts with the task and the tests, not with functions: the costliest mistake is solving the wrong task or weakening checks. Typical failures are invented library calls, duplicated helpers, swallowed errors, happy-path-only code and going beyond the task. Check a test with a deliberate breakage, ask to split an oversized pull request, and leave the verdict to a human.
Agentic development · The cycle
An agent's pull request looks clean: green tests. What is wrong with it anyway?
An agent added a limit on login attempts. Tests are green, the description is tidy. The diff contained: a new library nobody asked for, an empty catch around the counter write and a test that only checks "does not throw". Code from an agent is read more carefully than from a colleague: it writes fast and with confidence, and its mistakes look plausible. Review is the main way a human answers for a change.
How it works and why. An agent optimises for "passes and looks finished", not for "correct in all cases". So its typical mistakes are systematic: what tests do not check and what is hard to see at a glance stays half-done. The review order is built to filter big problems first (the wrong task, the wrong limits) and only then read details.
Review order
Figure 1. First the question "is it the right task that was solved", then the code details.
What an agent most often gets wrong.
Invents what does not exist: a method call, a parameter or a library option that is not there, or an outdated way. Unfamiliar calls are checked against docs or types.
Duplicates: writes a new helper although the project has one.
Swallows errors: an empty catch, a default value that hides a failure, "success" on failure.
Covers only the happy path: empty values, big volumes, a repeated request and time zones are ignored.
Leaves the task limits: changes a format, config or other people's files.
A test "does not throw" always passes, even if Redis is down. Then the attempt limit is silently disabled and a password guessing attack runs unhindered. The reviewer asks direct questions: what happens if Redis is down and is there a test that proves it. The right behaviour depends on requirements (deny login or allow with a warning), so this is a human decision, not the agent's. The fix: rethrow or log and return an explicit result, and add a scenario with an unavailable store to the test.
How to read an agent's diff
Skimming
Description and a green badge
The description is written by the agent and may not match the changes. A green badge does not say what was checked.
Careful
Task, tests, diff, run
The description is compared with the diff, tests are read, risky places are asked about directly, the code is run by you.
Figure 2. The difference between "approve" and "answer for the change".
Practical techniques. Compare the change description with the diff itself, not with the agent's reasoning. Ask directly about an unclear fragment: why this way, what happens on an empty input. Make a trial breakage: if the test stays green after a deliberate error in the code, it proves nothing. Substituted tests and bypassed checks are covered in the article on tests with an agent and in the section on control.
Limits and alternatives. A second agent can make a first pass looking for the obvious, but it does not see what is not visible in the code (requirements, agreements), and the final decision stays with the human. Static analysers and linters remove part of the mechanical problems (litter, unused code, known dangerous patterns) and save attention for the substance. A pull request that is too big is sent back to be split: it cannot be read carefully.
Common mistakes.
Reading only the description and the CI result: mistakes that tests do not catch stay unnoticed.
Judging code without remembering the task: well-written code that solves the wrong problem passes review.
Trusting an unfamiliar library call: it may be invented or outdated.
Accepting a big diff "because tests are green": there was no careful reading.
Check yourself
An agent's diff has an empty catch around a database write and the test only checks "does not throw". Why is it dangerous and what do you add?
Answer
A write failure goes unnoticed while the test is green whatever happens. Add a scenario with an unavailable database and an expected result (an error or an explicit denial), and either remove the catch or log and return an explicit status.
Why does review of agent code start with the task and the tests rather than reading functions in order?
Answer
The costliest mistake is solving the wrong task or weakening the checks. That is visible by matching the task with the tests, while detailed reading of code that solves the wrong problem is wasted.
Related lessons: “An agent in development: what to delegate and who answers”, “Tests with an agent: how not to let it fit the test to the code”, “Controlling an agent: hooks, permissions, verification, injection”.
In an interview.Junior: I reread the task, look at the tests and the diff limits, then run the code myself. I treat the agent's report as a claim, not proof. Middle/Senior: I know the typical failures: invented calls, swallowed errors, only the happy path, leaving the limits. So I ask direct questions about risky places, make a trial breakage to check a test and ask to split an oversized pull request. Linters take the mechanics, and the decision on correctness stays with the human.
Tests with an agent: how not to let it fit the test to the code
A test is a requirement written as code, so whoever writes the implementation must not adjust it: the shortest path to green is changing the test. Work test-first: expectations come from the specification, the test runs before the implementation and fails for the expected reason, and tests stay untouched during implementation. Test quality is checked by deliberately breaking the code; coverage is not proof.
Agentic development · The cycle
The test failed, the agent "fixed" it and now it is green. But does the feature work?
If you give an agent a failing test and the code, the easiest path to green is to change the test. It is not ill intent but a consequence of the task "make it pass". The test checked that the response contains a total of 120, the code returned 118. The agent replaced the expectation with "a number greater than zero" and CI went green. The calculation bug stayed and the signal about it disappeared. So work with tests needs its own rules.
How it works and why. A test is a requirement written as code. If one party writes both the requirement and the implementation in one session, the requirement adapts to the implementation, because that is the easiest way to satisfy "passes". The only reliable defence is to separate the roles. The expected behaviour is defined by a human or a specification, not by the current code, and the agent writing the implementation may not touch the tests.
What fitting looks like.
an exact value replaced with "not empty" or "greater than zero";
a test deleted, commented out or marked skip;
a check wrapped in try/catch or a condition that never runs;
the very thing that should be tested is mocked;
a snapshot updated without analysing the difference;
the expected value taken from the code's current response: the test says "the code does what it does" and cannot fail;
a failure "cured" with pauses and retries instead of finding the cause.
Test-first with an agent
Figure 1. Step 2 proves the test checks something: a test that is green before the code is worth nothing.
Example: from fitting to test-first. The fitted test from the example above:
// was: the test asserted a total of 120// after the agent's "fix"test('calculates the cart total', async () => {
const res = awaitcalcCart(items);
expect(res.total).toBeGreaterThan(0);
});
This test passes for any positive total, including a wrong one. The right order: a human (or a specification) fixes the expectation, the agent writes the test, and you read it and run it before the implementation.
// expectation from the spec: 2 × 50 + shipping 20 = 120test('calculates the cart total with shipping', async () => {
const res = awaitcalcCart([item(50, 2)], { shipping: 20 });
expect(res.total).toBe(120);
});
A run without the implementation should give "expected 120, received 118" (or another reason you predicted). If the test is green before the fix or fails for another reason (an import error), it is not ready. Only then does the agent get the task "fix the implementation, do not touch the tests". A change to a test file in such a diff is visible at once. If the agent considers the test wrong, it stops and explains why, and a human decides.
Checking test quality. Break the code on purpose (return a wrong value, remove a condition): if the test did not fail, it is weak. Mutation testing tools (Stryker for JavaScript and TypeScript, PIT for Java, mutmut for Python) do this systematically. A coverage percentage is not proof: a line being executed does not mean its result was checked.
Limits and automation. An instruction file can say "do not change existing tests without permission", but that is context, not enforcement. For stricter control a hook or CI tracks whether test files changed in tasks where they should not have and requires separate approval. Hooks and permissions are covered in the section on control. A test does not always have to come before the implementation: for exploratory work in unknown code a prototype is useful first, and tests are fixed after the behaviour is confirmed against requirements.
What an agent does well. Proposes boundary values and negative scenarios, generates test data, diagnoses failures from a log, ports repetitive tests. All of it is checked the same way: will the test really fail when the behaviour is broken.
Common mistakes.
Giving the agent both the test and the code with the task "make it pass": the shortest way to green is to change the test.
Taking the expected value from the code's response: the test cannot fail and proves nothing.
Not running the test before the implementation: a green test that was never red may check nothing.
Treating coverage as proof of quality: an executed line without a result check proves nothing.
Check yourself
After the task "fix the implementation" the diff contains a change to a test file. What do you do and why?
Answer
Stop and look at what changed. If an expectation was weakened, revert the test and ask to look for the cause in the code. If the test really is wrong, the agent must explain why, and a human decides on changing the requirement, because a test is a requirement.
Why can a test written by an agent together with the implementation be green and check nothing? How do you detect it?
Answer
The expected value could have been taken from the code's current response. Detect it by running the test without the implementation (it must fail for the expected reason) or by breaking the code on purpose and seeing whether the test turns red.
Related lessons: “Plan first: specification, small steps, checkpoints”, “Reviewing agent code: where to start and what usually goes wrong”, “Controlling an agent: hooks, permissions, verification, injection”.
In an interview.Junior: An agent can fit a test to the code because it is the easiest way to pass. So expectations come from the specification, and at the implementation step tests may not be touched. Middle/Senior: I work test-first: a test from the specification, a run without the implementation to see the expected failure, then the implementation with a ban on changing tests. I check test quality with a deliberate breakage or mutation testing, not coverage. For strict control I track changes to test files in a hook or CI.
Agentic development from scratch: a step-by-step setup plan
Set up agentic development so that autonomy grows only after verification exists. The order: small tasks that are cheap to check, commands that work from a clean clone, a short instruction file, limits (hooks, permissions, a separate branch), a task template, a plan → small steps loop, rules for tests, a review gate with CI, and only then skills and subagents. Every step has a «done when» criterion.
Agentic development · The cycle
A team bought an agent and set everything up at once. A week later nobody trusts the result.
A typical scenario: the tool is connected, the instruction file is two hundred lines, five subagents, an autonomous mode. The very first big pull request turns out to be unverifiable and the team goes back to manual work. The problem is not the agent but the order: autonomy was raised before verification existed. This is a summary article on the sequence in which to set up work with a coding agent so that it stays manageable.
The details of every step are covered in separate articles of the sections on the development cycle, context, orchestration and control. Here only the sequence and the criterion that a step is done. The tools (Claude Code, Cursor, Codex) are only examples, the order is the same.
How it works and why. The steps are ordered from what gives the biggest effect at the lowest risk to what is needed only at scale. Each next step rests on the previous one: limits make sense when there is a check that catches violations; parallel agents make sense when one already works in a controlled way. A step is confirmed by its "done when" criterion, not by a feeling.
The adoption ladder
Figure 1. The order matters more than completeness: safety and verification come before autonomy.
Start small. One repository and one kind of task whose result is cheap to check: small fixes, repetitive edits, test drafts. Do not start with architectural changes. Done when you know which tasks go first and what you will check them against.
Let the agent check itself. The build, the linter and the tests must run with known commands and work from a clean clone. Without that, "done" is just the agent's words. Done when one command gives a clear pass/fail in an acceptable time.
Write a short instruction file. Build and test commands, conventions, constraints not visible from the code. Do not paste procedures or what the linter checks. Done when a new colleague could use it.
Set limits before raising autonomy. Allow reading and running tests, require confirmation for the rest, forbid secrets and production access. What must never be violated goes into a hook, not a wish. Work on a separate branch in an isolated environment. Done when the agent physically cannot do what it must not.
Make a task template. Goal, context, limits, definition of done, report format. Save it and use it every time. Done when a task can be handed to a colleague without verbal explanations.
Work in the "plan → approval → small steps" cycle. For non-trivial changes a plan first, then steps with a check after each. Done when you stop at the checkpoints and really look at the result.
Agree on tests separately. For a behaviour change the test is written from the specification and seen to fail before the implementation; at the implementation step tests are not touched. Done when a change to a test file in a diff with no reason raises a question.
Set up a review and CI gate. An agent's pull request passes the same checks as a human's: your own reading of the diff and CI in a clean environment. A human merges. Done when nothing reaches the main branch without a green CI and a read diff.
Add skills and subagents only when needed. A procedure you explain for the third time becomes a skill. Side work that clutters the main session goes to a subagent. Parallelism and a reviewer are added when the parts are really independent. Done when each complication matches a concrete pain you have already felt.
Learn from mistakes. When the agent repeats a failure, the cause is fixed at the right level: missing knowledge, a line in the instruction file; an action that must not happen, a hook or a ban; an unclear task, a template change; a procedure, a skill. The instruction file is trimmed periodically. Useful metrics: the share of results accepted without rework and the time spent on review. Done when the same mistake does not occur a third time.
Example: one round of learning from a mistake. The agent twice runs tests with the wrong command and reports "passed". The cause: the instruction file has no command. The fix is minimal:
## Verification
- All tests: npm test (unit) and npm run test:integration
- "Passed" only when both commands finish without errors
Two lines solved the problem at the level of knowledge. If the agent knew the command but ignored it, that would be a matter for a hook or CI, not another line in the file.
Two ways to adopt
Wrong
Everything at once
Many rules, subagents and autonomy with no verification and no measuring. Failures are invisible, trust falls.
Right
Step by step, with a criterion
Each complication has a concrete reason and a "done when" check. Autonomy grows with trust.
Figure 2. The speed of adoption matters less than the manageability of the result.
Limits and alternatives. The order is not dogma: in a small team steps 5 and 6 may merge into one template, and where strong CI exists step 2 is shorter. But swapping "autonomy before verification" almost always costs a lot. If one person uses the agent for small things, the full set of steps is excessive: steps 1-4 are enough.
Common adoption mistakes.
Setting everything up at once and measuring nothing: it is unclear what helps.
Raising autonomy before verification exists.
Bloating the instruction file: the important part sinks and rule compliance drops.
Treating the agent's report as proof.
Check yourself
A team wants to launch parallel subagents and an autonomous mode right away. Which steps are missing and why does the order matter?
Answer
Missing are a one-command verification, short instructions, limits (hooks, a separate branch) and a review gate with CI. Without them autonomy produces a large volume of unverifiable changes, and parallel agents multiply it.
The agent ignores a rule from the instruction file again. When do you add another line and when a hook?
Answer
A line helps when the agent lacked knowledge. If an action must never be allowed, the instruction file is only context, and the rule goes into a hook or a permission denial, which are enforced.
Related lessons: “An agent in development: what to delegate and who answers”, “Instruction files, skills and the context budget”, “Main session and subagents: brief, parallelism, isolation”, “Controlling an agent: hooks, permissions, verification, injection”.
In an interview.Junior: I start with small tasks with cheap verification, then add a short instruction file, limits and a review gate. I add subagents only when a concrete need appears. Middle/Senior: The order is: verification, limits, the "plan → small steps" cycle, separate handling of tests, a review gate with CI, and only then scale. Each step has a "done when" criterion. Autonomy grows once verification already catches violations. Then I measure the share of results accepted without rework and the review time, and fix repeated failures at the right level.