Topic 4 of 5 · 5 min read
Spec mistakes that agents misread
Goal: Find the ambiguous, contradictory or untestable lines in a spec and rewrite each so only one reading is left.
A spec line is only good if two careful readers, human or agent, would build the same thing from it. Most bad specs fail that test in one of five ways.
Check yourself · 1 of 3
Which line is the most likely to be misread by an agent?
Why it matters
An agent never says "this sentence is ambiguous". It picks one reading and writes confident code. When the reading is wrong, the code, the tests the agent wrote for it, and its summary all agree with each other and disagree with you. That agreement hides the mistake.
The five patterns
- Vague words. "Fast", "secure", "user-friendly", "robust", "as needed", "etc." have no edge. Replace each with a number, a list or a behaviour.
- Hidden assumptions. The spec relies on something only you know: which time zone, which user roles exist, that the table is small. State it or link it.
- Contradictions. Line 3 says "never delete data" and line 11 says "remove the record". Agents do not flag the clash. They satisfy whichever line they read last or weigh most.
- Missing non-goals. Without a boundary, "improve search" can mean a new index, a new UI or a new library.
- Code dictated instead of behaviour. "Use a for loop to filter, then call saveAll()" locks in a design. If it is a bad design, the agent builds it faithfully. Say what must be true, and give the implementation only when it is a real constraint.
How to review a spec
Read it as the agent would, with no knowledge of your project. For each line ask: can a test fail on this? Is there a second reading? Does another line disagree? Then rewrite until only one reading is left. A useful trick is to give the spec to a second agent and ask "list every decision you would have to guess", then close those gaps.
Before and after
Weak:
- Export should be fast and handle big files.
- Export all records, but skip old ones as needed.
- Use pandas to build the CSV row by row.
Fast how? How big? Which records are old? And row by row in pandas is slow, so the last line fights the first.
Better:
- Exporting 500,000 rows MUST finish in under 60 seconds and use under 500 MB of memory.
- Export every record with status "active". Records with status "archived" are excluded.
- The file MUST be streamed to the client, not built in memory. The library choice is open.
What goes wrong
- Fixing the code, not the spec. You correct the agent's output three times and the next run repeats the error.
- Over-specifying everything. A 10-page spec buries the five rules that matter. Keep the page short.
- Unit tests that copy the misreading. If the agent wrote both, passing tests only prove it agrees with itself.
Examples
Rewriting a vague line
Before: "Notifications should be sent promptly to relevant users."
After: "When an order ships, send one email to the buyer within 5 minutes. Do not notify the seller. Send nothing if the buyer has opted out."
Three things became checkable: time, recipient and exception.
Finding a contradiction
3. Deleted accounts MUST be removed from the database.
9. Order history MUST never lose the customer's name.
Both cannot hold if orders reference the account row. State the rule: delete the profile, keep the name text on past orders.
Key points
- Replace vague words such as fast, secure or as needed with a number, a list or a behaviour.
- State assumptions about time zones, roles, data size and environment, because the agent cannot see them.
- Contradictory lines are not flagged by agents; they follow one and ignore the other.
- Describe the required behaviour and leave the implementation open unless a real constraint forces it.
- Ask a second agent to list every decision it would have to guess, then close those gaps in the spec.
Common mistakes
- Leaving words like 'fast', 'secure' and 'etc.' in a requirement and trusting the agent to know what you mean.
- Writing two rules that conflict and not noticing because the agent never complains.
- Prescribing the implementation line by line so a poor design is built exactly as written.
- Correcting the agent's output again and again instead of fixing the spec line that caused the error.
Check yourself · 2 of 3
A spec says 'never delete user data' in one place and 'remove the user record on request' in another. What will an agent most likely do?
Check yourself · 3 of 3
Why can a spec that says 'use a for loop, then call saveAll()' hurt?
Practice items, not counted towards your mastery.
Start here
- GitHub Spec Kit (opens in a new tab)ToolFree
An open-source toolkit with commands for writing a spec, a plan and a task list before code.
- Understanding Spec-Driven Development: Kiro, spec-kit and Tessl (martinfowler.com) (opens in a new tab)ArticleFree
A critical comparison of three spec tools, including where specs still fail agents.
- Specs (Kiro docs) (opens in a new tab)DocsFree
How one agentic IDE structures a spec as requirements, design and tasks files.
More for this topic
- RFC 2119: Key words for use in RFCs (opens in a new tab)StandardFree
Defines MUST, SHOULD and MAY, a precise way to say how strict a requirement is.