Skip to content
Giminger ConsultingDE

Write tasks that agents implement correctly

Key takeaway

A good task for a coding agent describes the goal, boundaries and acceptance criteria rather than the detailed solution path. Larger work should first be written up as a plan that a person approves, then implemented in small, individually reviewable steps.

Lessons in this path
  1. A workspace in which coding agents do good work
  2. Write tasks that agents implement correctly
  3. Review, secure and ship agent-written code

What makes a good task?

Most poor results come from unclear tasks. “Make the export better” leaves the agent too much room; it will change something, but not necessarily the right thing. A task written like a good ticket for a new colleague almost always works better.

  1. Goal from the user’s perspective: who should be able to do what afterwards?
  2. Context: relevant files, existing patterns, related features.
  3. Boundaries: what must not change.
  4. Acceptance criteria: concrete, testable conditions, ideally as test cases.
  5. Output: branch, summary, open questions.

When to plan first and when to implement directly?

Small, well-scoped changes such as a typo or an extra field can be implemented directly. Once several files, a data model or an API are involved, a planning step pays off. Many tools have a dedicated plan mode for this. The agent reads the code and proposes an approach, affected files and risks, and you correct the plan before any code is written. That is cheaper than correcting finished code.

Too large a task produces a sprawling diff that nobody reviews properly. Too small a task creates coordination overhead. A size that works well in practice is one whose result can be reviewed in under an hour and that includes at least one test demonstrating the behaviour.

Rules of thumb for task size
Type of changeApproachTypical review effort
Cosmetics, copy, single componentImplement directlyMinutes
New feature in an existing patternShort plan, then implementHalf an hour to an hour
Data model, permissions, paymentsApprove plan, implement in stepsSeveral hours, second reviewer
Large refactor, framework migrationSplit into sub-tasksSpread over days

How do you stay in control with several agents in parallel?

Many teams now let several agents work on different tasks at the same time, for example in separate Git worktrees (parallel working copies of the same repository) or in providers’ cloud environments. This increases throughput but moves the bottleneck: reviewing and merging, not writing, sets the pace.

Only parallelise tasks that do not share the same files, and limit open agent branches to what you can review the same day. Unreviewed branches go stale quickly and create conflicts.

At the end of every task, ask the agent for three things: what it changed, what it did not verify and which assumptions it made.

Going deeper: test-driven tasks and failure modes

A particularly robust workflow: the agent first writes tests for the desired behaviour, you review the tests, then it implements until they pass. You review intent rather than all the code, and you reduce the risk of tests being bent afterwards to fit wrong behaviour.

Typical agent failure modes are well known and can be caught deliberately: invented functions or package names, weakened tests, silently swallowed errors, duplicated helpers instead of reuse, and overeager changes outside the task. A review guide that asks about these points explicitly catches a large share of problems. Be especially careful with invented package names, because attackers can register them.

Example: from a vague wish to a testable task

Starting point in the fictional booking start-up: “Practices should be able to export appointments.” The agent builds an export of all data including patient notes, which is problematic from a data-protection perspective.

The revised task reads: “Practice admins can export appointments for a chosen period as CSV. Columns: date, time, therapist, treatment type, status. No patient notes, no contact details. Admin role only. Reuse the existing pattern from the invoice export. Tests for date-range boundaries, empty results and missing permission. Present a plan first.” The plan shows the agent intended to check permissions in the frontend; after correction the check sits on the server. The implementation needs just one review round.

Common mistakes

  • Prescribing the solution path instead of describing the goal and acceptance criteria.
  • Asking for large refactors in a single task.
  • Starting more parallel agents than you can review the same day.
  • Not asking for assumptions and unverified areas.

Frequently asked questions

How long should a task be?

As long as a new colleague would need to implement it without asking. Usually ten to twenty lines, more for sensitive areas.

Should I write tasks in English or German?

Both work. Consistency with the terms in the code matters more. If the code uses English names, English domain terms in the task help.

What if the agent gets stuck?

Stop rather than piling on more corrections. Start a fresh session with a more precise task and what you learned from the first attempt. Long correction loops fill the context with failed attempts and usually make the result worse.

Try it yourself

Take the next feature from your backlog and rewrite it using the five building blocks. Let the agent produce a plan first and note what you had to correct.

Check your result

The plan names affected files and risks, your corrections concern details rather than fundamentals, and the result passes the tests defined in advance.

Official documentation and sources

Practical guides and references