4. Ask before you build¶
An AI agent given a vague user story will write a test anyway. It has to guess: which status code means "rejected", whether a cancelled order is deleted or marked, how fast "quickly" is, who is signed in. Every guess becomes an assertion, and the test now encodes decisions nobody made. If it passes, it proves the guesses; if it fails, nobody knows whether the code or the guess is wrong.
A careful tester doesn't start writing until those questions are answered. The K11 tools make the agent do the same.
The review tools¶
Before generating anything, the agent calls a review tool that reads the story (or the load plan) and returns the questions a careful tester would ask, each with why it matters and the words that raised it:
| Tool | Reviews | Used by |
|---|---|---|
review_user_story |
a user story before UI tests are written | Playwright QA, Selenium QA (/story-to-test) |
review_user_story |
a user story before an API flow is drafted | API Functional QA (/api-story-test) |
review_flow_plan |
a story, or the producers and consumers, before integration flows are proposed | Integration QA (/integration-check) |
review_perf_plan |
the request and .qa-mcp/perf.yaml before a load test |
Performance QA (/perf-check) |
The reviews are rules, not a model. The same story always gets the same questions. The rules are tested against shared
cases: Playwright QA, Selenium QA, API Functional QA and Integration QA run the same review_cases.json, so a story gets
the same questions whichever tool reads it.
An example¶
Give API Functional QA this story:
As a customer I want to cancel my order so that I am not charged.
Scenario: cancel an order
When I cancel my order
Then the order is cancelled quickly
And invalid requests are rejected
review_user_story returns (abridged):
| Kind | Question | Why |
|---|---|---|
precondition |
In "cancel an order", what is the starting state: who is signed in, and what data already exists? | Tests need set-up; guessing it makes them pass for the wrong reason or fail on a clean environment. |
vague-term |
"quickly" can't be tested as written. What is the measurable version? | A test needs a threshold or a concrete expectation. |
error-contract |
Which status code and error body should this return (for example 400 or 422)? | "Any 4xx" also passes when the request fails for the wrong reason, such as a typo in the URL. |
delete-semantics |
Is the record removed (hard delete) or kept and marked (soft delete)? What does GET return afterwards? | A hard delete expects no row, a soft delete expects the row with a status. Guessing makes the check prove the wrong thing. |
access |
What should happen without credentials, and when one user calls with another user's IDs: 401, 403 or 404? | Without an expected answer a test can't tell a missing check from a correct one. |
and "ready": false. The agent shows you the questions and waits. Five answers later, the flow it drafts checks things
that were actually decided.
The rules¶
Shared rules (all story reviews):
| Rule | Asks about |
|---|---|
outcome |
a scenario with no observable result, or a vague one ("works", "correctly") |
criteria |
no acceptance criteria at all |
role |
no user role (permissions and test accounts depend on it) |
vague-term |
words a test can't check: fast, easy, many, appropriate, user-friendly… |
limit |
a limit or threshold without a number ("up to", "maximum", "expires") |
failure-path |
no scenario says what happens when things go wrong |
precondition |
actions with no starting state |
undefined-term |
(with context) a term the story relies on that the context never explains |
API rules (API Functional QA): error-contract, delete-semantics, access, repeat (a duplicate request with no
defined result), and spec-mismatch (with a spec: an endpoint or field the spec doesn't have).
Integration rules (Integration QA): time-limit (a consumer effect with no time limit, "eventually"), dead-letter
(a failing message with no retry count or dead-letter topic), duplicate, ordering, batch (a job with no schedule or
expected row counts) and contract-mismatch (against the AsyncAPI contract).
Performance rules (Performance QA): slo (missing SLOs or an endpoint no SLO covers), load-profile (the default 5 users
with no plan.peak saying where the number comes from), duration, vague-term ("fast", "heavy load"), test-data and
environment-size.
When you want to go ahead anyway¶
Sometimes the answer is "we don't know yet, write what you can". Say so, and the agent proceeds, but nothing is silently guessed: each open question is written into the test as a comment next to the step it affects, and listed in the final report.
- name: cancel the order
call: POST /orders/${orderId}/cancel
# OPEN QUESTION: which status code and error body for an order that already shipped (400, 409 or 422)?
expect: { status: 200 }
Performance QA does the same in .qa-mcp/perf.yaml, and never invents an SLO: an SLO nobody agreed to is worse than none,
because it makes a release look checked when it wasn't.
Why this matters for the gate
The release gate trusts the evidence it is given. A test built on guesses produces confident evidence about the wrong thing. Asking first is what makes the evidence worth gating on.