AI-Assisted Software Development: Coding Agents in PracticeContext engineering for codebases · Lesson 6 of 17

Writing tasks agents can finish

Article · 12 min · 9 min lecture

Video lecture

Writing tasks agents can finish

14 chapters · about 9 min · full transcript

Coming soon

Chapter 1 of 14

Writing tasks agents can finish

  • Anatomy of an agent-ready task
  • Sizing and splitting
  • Handling ambiguity

The narrated lecture is in production

Every chapter is scripted and ready. Browse the chapters and read the full transcript now — the video will appear here when it’s published.

Chapters

The task spec is the product

With coding agents, the quality of the output is bounded by the quality of the task description. A vague ticket produces a plausible-looking change that solves a different problem. Research on Copilot's issue-to-PR agent and plenty of team experience point the same way: issues with clear scope, acceptance criteria and pointers to relevant code are far more likely to produce mergeable pull requests.

Anatomy of an agent-ready task

## Goal
Customers in the UAE should see VAT (5%) as a separate line on PDF invoices.

## Context
- Tax rules: src/domain/tax/ae.ts (rate already defined as AE_VAT_RATE)
- PDF rendering: src/infra/pdf/invoiceTemplate.tsx
- Similar prior change: PR #412 added GST line for PK invoices — follow that pattern.

## Acceptance criteria
- [ ] Invoices with country=AE show "VAT 5%" line with amount in fils → AED formatting.
- [ ] Non-AE invoices unchanged (snapshot tests still pass).
- [ ] Unit test for ae.ts rounding at .5 fils boundary.
- [ ] PDF snapshot test for an AE invoice.

## Constraints
- Do not change the public API or database schema.
- No new dependencies.

## Verification
Run: npm test && npm run check. Attach the generated sample PDF path in the PR description.

## Out of scope
Arabic-language PDF layout (tracked in INV-233).

Each section does a job: Goal tells the agent why; Context saves exploration; Acceptance criteria define done in checkable terms; Constraints fence the blast radius; Verification tells it how to prove success; Out of scope stops helpful over-reach.

Sizing tasks

Agents succeed most often on tasks that a competent developer could finish in under a day and review in minutes. Signs a task is too big:

  • The acceptance criteria span more than one subsystem.
  • You cannot say which files will change.
  • The spec contains "and also".

Split along seams: data model change, then API, then UI; or one package at a time. Each slice should leave the system working and tested.

Writing for ambiguity

Agents rarely ask clarifying questions unless told to. Add an explicit instruction:

If any acceptance criterion is ambiguous or conflicts with existing code, stop and ask
me before implementing. List your assumptions at the top of your plan.

In delegate mode, where the agent cannot ask you in real time, require it to list assumptions in the PR description so reviewers can check them.

Worked example: from vague to agent-ready

Before: "Make the export faster."

After:

  • Goal: CSV export of 50k invoices currently times out (>30s) for large Karachi-based clients.
  • Context: src/api/handlers/exportCsv.ts loads all rows into memory; the DB driver supports streaming (see src/infra/db/stream.ts).
  • Acceptance: export streams rows; memory stays flat in the provided load test (npm run test:load -- export); output byte-identical to current export for fixture test/fixtures/export-small.json.
  • Constraints: same endpoint and response headers.
  • Out of scope: Excel export.

The rewrite took five minutes and turned an open-ended performance hunt into a checkable engineering task.

Hands-on: an issue template for agent tasks

Save as .github/ISSUE_TEMPLATE/agent-task.md:

---
name: Agent-ready task
about: A bounded task suitable for a coding agent
labels: agent-ready
---
## Goal

## Context (files, prior PRs, docs)

## Acceptance criteria
- [ ]

## Constraints (API, schema, dependencies, performance)

## Verification (exact commands)

## Out of scope

## Assumptions the agent must list in the PR

Use the agent-ready label as a gate: only issues with this template filled in may be assigned to cloud agents.

Pitfalls

  • Specifying the implementation instead of the outcome. Give constraints, not line-by-line instructions, unless the approach genuinely matters.
  • Hidden context. Decisions from a Slack thread the agent cannot see.
  • No negative criteria. Say what must not change.

Reviewing the spec before assigning

Before you hand a task to a cloud agent, run a thirty-second review against this checklist: Could a new colleague start without asking a question? Can every acceptance criterion be checked by a command or a clearly observable behavior? Is there at least one negative criterion? Are the files or modules named? Is anything the agent needs locked away in a chat thread or a meeting? If any answer is no, fix the spec first. It is far cheaper to spend two minutes improving the issue than twenty minutes reviewing and rejecting a pull request built on a misunderstanding. Some teams also ask the agent itself to critique the spec before starting: "List anything in this issue that is ambiguous or missing." That single step catches many gaps.

How to measure success

Track first-attempt merge rate for agent PRs, split by whether the issue used the template. If the template is working, the difference will show within a few weeks.

Key takeaways

  • The task spec bounds output quality: goal, context, acceptance criteria, constraints, verification, out of scope.
  • Size tasks to under a day of work and minutes of review; split along seams.
  • Include negative criteria (what must not change) and pointers to similar prior PRs.
  • Require agents to ask or list assumptions when criteria are ambiguous.

Check your understanding

Quick questions to lock in the lesson. They don’t count towards your certificate.

  1. Which acceptance criterion is most often missing from agent tasks and most often causes regressions?
  2. A spec reads: 'Add SSO, and also refactor the user model, and also update the admin UI.' What should you do?

Put it into practice

Rewrite one vague ticket from your backlog into the six-part agent-ready format and add the issue template to your repository.

Enrol for free to save your progress

Reading is always free. Enrol to keep your place, take the final assessment and earn a verifiable certificate.