Est.

Writing Engineering Task Specs That Coding Agents Can Execute

Coding agents need detailed specs to execute tasks without continuous human feedback.

· 8 min read
Cover illustration for “Writing Engineering Task Specs That Coding Agents Can Execute”
Team Adoption and Rollout · October 26, 2026 · 8 min read · 1,880 words

Migrating engineering teams from local AI coding assistants to cloud coding agents starts with changing the handoff as well as the runtime. Writing engineering task specs that coding agents can execute means setting out what the task should achieve, where it stops, what context and constraints it needs, and what will show success before handing it off. Keep close collaboration in a terminal when the task needs frequent steering, and use cloud agents when a spec can support unattended execution followed by human review.

Why delegating to a coding agent changes what a task description needs to say

With autocomplete, the engineer is there as the code takes shape and can steer it right away. Delegation removes that continuous feedback loop. A cloud agent working in the background must act on instructions that remain useful without the author explaining what a phrase meant. OpenAI’s harness engineering guide describes the resulting work cycle as writing a spec, delegating it, receiving a draft pull request, and reviewing the result. The spec becomes the core artifact because it connects the requested change to the eventual review.

“Fix the login bug” names a problem but leaves the intended behavior, relevant code, and evidence of success unresolved. In a terminal session, an engineer can supply those details as questions arise. An unattended run has no engineer there to answer those questions. An underspecified spec therefore wastes the agent run and leaves the reviewer without a frame for evaluating the returned code.

What a spec written for a coding agent must contain

OpenAI specifies five components for a delegated task, namely the high-level goal, relevant repository and area, approach and constraints, acceptance criteria, and dependencies and links. Each answers a different question about the work. To apply this format, check that the description establishes the outcome, locates the change, limits the agent’s discretion, defines success, and supplies supporting context. These components need not become a long document. Their purpose is to remove decisions the agent cannot safely infer.

Start with the behavior that must change. “Return a 422 when a saved card is expired” gives the agent a more useful target than “Fix checkout bug.” The description can then explain that checkout with an expired saved card currently returns a 500, while the required behavior is a 422 with a clear validation error, preserved cart state, and a regression test. This separates the symptom from the desired result. It also gives the reviewer a reason for the change before either party examines the implementation.

Next, identify the repository and likely code area. In the expired-card example, those are api-service and src/payments/. State required technical choices where they exist, then make the boundary explicit with “Do not modify the payment provider integration.” Without that limit, the agent could read a local validation fix as a request to change more than the task calls for.

Finally, attach the conditions and references needed to execute the work. The example requires the expected checkout response, cart preservation, and regression coverage, with reproduction steps that create a user with an expired saved card and submit that user’s saved card token to POST /checkout. Link to the tests, design decisions, incidents, or requirements that bear on the task. Include dependencies that affect the approach or order of work.

Writing acceptance criteria the agent and reviewer can both use

Acceptance criteria are a validation contract written before the code. Each criterion needs a trigger, an expected result, and enough detail to exclude a plausible approximation. “Authentication works” does not meet that standard. “An unauthenticated request to /account redirects to /login and preserves the return URL” does, because it identifies the request condition, destination, and state that must survive. The agent can work toward those observations, and the reviewer can evaluate them without reconstructing an unwritten intention.

A request to POST /checkout with an expired saved card must return 422 with an error value of card_expired. The cart must be kept as it was after that failed attempt. A regression test must cover both the response and cart preservation. Checking only the status code would leave a specified part of the behavior unevaluated, even if the resulting pull request looked complete.

Negative behavior needs the same precision as successful behavior. For a permission change, the criteria should establish that an allowed actor succeeds and a disallowed actor is rejected. For migration work, they should cover existing reads as well as new write paths. For UI work, they should name the viewport or interaction the reviewer must exercise. These are different forms of the same discipline, which is making the relevant boundary observable rather than leaving it inside a broad statement such as “the feature works.”

Writing out these details takes time before coding starts. That is a genuine cost, but the information is also needed for human-led development and meaningful review. A spec that a junior engineer can execute must resolve much of the same ambiguity as one delegated to an agent. The alternative is not necessarily less work, because a vague pull request forces the reviewer to recover the missing intent later. Write the criteria while the intended behavior is clear, then review the implementation against that prior agreement rather than judging success from whatever the agent produced.

Using failing tests as the acceptance criteria

Failing tests are the executable form of acceptance criteria. They are an optional advanced approach. Anthropic’s Claude Code best practices describe a red-green-TDD workflow in which the developer writes failing tests and asks the agent to make them pass. The developer specifies the behavior through tests, while the agent supplies the implementation. With a solid test suite, the agent can iterate against a concrete signal instead of relying only on its interpretation of prose.

A test that checks only the 422 response does not establish cart preservation, although both belong to the requested outcome. Keep tests small and targeted enough to expose that distinction. Anthropic warns that underspecified tests can pass without reflecting the author’s intent. Turning a sentence into a test therefore does not automatically make the requirement precise, because the assertions still determine what the test proves.

Executable criteria also make the division of work explicit. Kiro’s spec documentation describes multi-agent workflows in which one agent writes failing tests while another writes the implementation. The test suite becomes a coordination artifact between those roles. But the team still needs to own acceptance tests on critical paths, even when an agent writes them. Otherwise, the implementation and its supposed evidence may share the same misunderstanding of the requirement.

For teams without mature test infrastructure, prose criteria with explicit verification steps remain a practical fallback. A new feature does not need to wait for a fully executable specification before it can be described well. State what the reviewer must exercise and what result must be observed, then retain those conditions through review. Where tests are available, inspect their results as evidence in addition to reviewing the code. Passing tests still require human approval, and OpenAI recommends human review of agent pull requests before merging.

Scoping tasks so an agent can complete them reliably

OpenAI offers a practical heuristic for delegation, which is to try a spec for a task that would take a junior engineer two hours and treat one that would take two days as too complex. The useful unit is work the agent can finish without ongoing human intervention and the reviewer can evaluate in a single sitting. A well-written description of a large feature can still exceed that unit.

To apply the heuristic, keep the task within one component where possible. Break complex features into smaller tasks instead of asking the agent to resolve every interaction in one run. Broad assignments create room for early declarations of completion while parts of the feature remain untested. For incremental work, specify that the agent should commit after each chunk and track progress. If the task should remain end to end within one execution, state “Do not parallelize this task”.

For teams comfortable with basic delegation, a meta-spec can coordinate related small tasks. It should outline what each sub-task should achieve and how to approach it, then point to a detailed sub-spec. Add acceptance criteria for the combined result. Those criteria address whether the parts satisfy the overall goal, which cannot be established merely by checking that each sub-task produced a pull request.

OpenAI recommends starting with loosely coupled tasks because dependencies make merge conflicts harder to resolve. Independent specs can be delegated simultaneously and reviewed as separate changes, while tightly related work needs its dependencies made explicit. This is also where the distinction between terminal and cloud agents remains useful. Close collaboration belongs in the tighter terminal feedback loop, while bounded background work can use cloud execution without requiring the engineer to supervise every step.

A team moving off laptop-centered assistance should begin with a simple proof of concept before delegating complex work. The migration requires a dependable way to supply each run with its task, repository context, and validation rules. As more tasks run on their own, putting the same project rules in every spec takes work that need not be repeated. Durable context belongs in a shared repository file instead.

Keeping project context out of every spec with AGENTS.md

AGENTS.md holds instructions that should apply across agent runs. OpenAI says it can hold build commands, guidance for each directory, security boundaries, and what validation should show. These instructions should not depend on the task author remembering them. The individual spec can then focus on the new behavior and its exceptions, while the repository supplies the standing rules needed to work safely and consistently.

The division is straightforward in the checkout example. Returning 422 for an expired saved card and leaving the payment provider integration untouched belong in that task’s spec. Build, test, and lint commands belong in the durable project guidance. So do standing restrictions on security-sensitive directories, adding dependencies, and committing credentials. Directory-specific instructions can be nested where that guidance applies only to part of the repository.

For Claude Code, Anthropic documents CLAUDE.md as persistent context read at the start of a session. Keep that file focused, organized, and current as dependencies, patterns, or services change. Requirements for one task should stay in its spec, because making a temporary constraint a standing rule changes what it means for later work. Common pitfalls belong in the shared guidance when later runs should take them into account.

OpenAI describes its cloud environment as sandboxed containers that isolate tasks and provision dependencies, and recommends CI gates, short-lived least-privilege agent credentials separate from human accounts, and a network-restricted sandbox before background delegation. The spec defines the authorized outcome, while the harness supplies the conditions under which the agent can attempt it.

The team also benefits from keeping specs in a central location such as GitHub Issues or a Linear board. OpenAI recommends shared specs for visibility, reusable formats, and a library of prior examples. When reviewers can find why a change was requested, they can check each pull request against its original constraints even if they did not write the task. That is the durable handoff a cloud workflow needs, with the requested change in the spec, standing rules in repository guidance, and approval reserved for human review.

Sources

  1. Harness engineering: leveraging Codex in an agent-first world

More in Team Adoption and Rollout