Write a spec your coding agent can build in one pass

Write a spec your coding agent can build in one pass

I tested the Kiro CLI with and without a short spec on 10 tasks. See where the spec changed the result, what it contains, and how to measure it.

Series: A study on AI in the product lifecycle (8 articles)

  1. …
  2. 3
    Write a spec your coding agent can build in one pass This article
Global Sr. Solutions Architect, Private Equity
How often does your coding agent's first pull request match what you meant, and how much of that depends on the spec? In the  Ambig-SWE study , accepted at ICLR 2026, models struggled to tell a complete task from an incomplete one, and letting them ask for the missing information raised performance by up to 74%. In my own test of 10 tasks, 20 of 20 runs with a short spec passed every check on the first pass, against 14 of 20 without one, and all six extra passes came from 3 tasks.
My view is that a spec pays off when it records the decisions an agent can't infer from the code, and when something outside the agent checks the result. In this article, I show what the agent worked out on its own, which tasks needed a spec, what a short spec contains, and why the checks belong outside the agent. Practitioner guides such as  Addy Osmani's on writing a good spec  cover what to write, and my test measures where a spec changed the outcome.

What can an agent work out on its own?

I gave the  Kiro  command line interface (CLI), running Claude Opus 4.8, 10 tasks on a fictional retailer's review pipeline of about 3,500 lines of Python, with two runs per task. Both conditions loaded the same 246-word project map from  Structure context and intent for your coding agents , so the spec was the only difference. Each task arrived as a plain issue title, and hidden tests, a lint check, and a scope check graded the result. One issue said only "Very long reviews are expensive to translate and are usually spam. Stop sending them to translation." It named no limit and no setting, yet without a spec the agent added a configurable limit the same way the project sets its other options and passed every check in both runs. Consider leaving out of the spec what a careful reader of the code would conclude anyway.

Which tasks needed a spec?

Three of the 10 tasks needed one, and each left open a decision the code couldn't settle. Without a spec, the agent missed the first pass on all three in both runs, and with a spec it passed all six (Figure 1).
Ten tasks in two groups, two runs each, without and with a spec. Three tasks whose issue left a deci

Figure 1. First-pass results per task, grouped by whether the issue left a decision open. Source: author's test
Adding Spanish left open whether Spanish should become a default language, and the agent made it one. Sharing duplicated request code left the helper's name open, and the agent called it  invoke_claude  in both runs, where the spec named  invoke_text . Letting a batch choose its translation service left open which files to touch, and the agent edited the  README  in both runs and the infrastructure stack in one. A reviewer might accept the  README  edit, but the other two changed a default and a name the team had already decided. When an issue leaves a decision like these open, consider settling it in the spec before the agent starts.
With the spec, the median task also used 19% fewer Kiro credits, partly because the agent needed no follow-up prompts, and the translation service task dropped from 30.0 credits to 9.1 across its two runs.

What goes in a short spec?

The specs in my test ran 97 to 159 words, with five parts.
  • Intent. Why the work exists, in one or two sentences.
  • Acceptance criteria. Each rule in one testable sentence, including the decision the issue leaves open.
  • An example. One input with its expected result.
  • Constraints. What to reuse or leave unchanged.
  • Out of scope. What the change shouldn't touch. No run with a spec edited a file outside the task.
State each rule in words as well as in the example. In a  2026 preprint  that tested five models, the models followed a rule that examples only implied 11.1% to 65.8% of the time on average. An explicit description got the two that followed examples best to follow both rules on every instance.
Kiro's  feature specs  write acceptance criteria in EARS (Easy Approach to Requirements Syntax), a WHEN condition followed by a SHALL behavior, so each criterion can become a test. Its Analyze Requirements option checks a draft for gaps before design starts. My test pasted each spec into the CLI prompt instead. The  AI-Driven Development Lifecycle  runs a requirements analysis stage in every scope and asks a person for approval before work moves on. Keep implementation detail to what the agent can't infer, because a  preprint study of spec-driven development in practice  found that such detail may help agents while making specs prone to decay.

Why should the checks run outside the agent?

An agent's own report of success doesn't tell you the change is right. In both Spanish runs without a spec, the agent reported that its changes passed all checks, and a hidden test caught that Spanish had become a default. Turn acceptance criteria into tests that run in the pipeline, where the agent can't mark them as met, and give any AI reviewer the repository as well as the diff. In an AI review pass I later discarded, two models judged the diffs without the repository and failed changes for problems that weren't there, such as a display name the repository already defined.

How do you know your specs are working?

 Measure AI developer productivity from idea to production  introduced the spec one-shot rate, the share of specs that produce a mergeable pull request without revision. My test measured the step before that, a first pass on automated checks, and first passes, follow-ups, and out-of-scope edits moved together.
The gain showed on 3 of 10 tasks, short of the 6 of 10 I set in advance for a general effect. I wrote the tasks, the specs, and the hidden tests, so the tests check decisions the specs state, and the agent couldn't ask questions. It's also one small repository and one model. Consider the same comparison on 20 of your own recent tasks, with one acceptance test per task written before either run, once with the issue title alone and once with a short spec.
When your agent's first pull request misses, what was most often left out, the intent, a decision, a constraint, or a way to check it?

Further reading

About the author

Michael Purpura is a Senior Global Private Equity Solutions Architect at AWS. He works with private equity firms and their portfolio companies to structure AI adoption around measurable business outcomes.

Series: A study on AI in the product lifecycle (8 articles)

  1. …
  2. 3
    Write a spec your coding agent can build in one pass This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article