---
name: test-code-before-building
description: "Define a small feature by examples that can pass or fail."
---
# Write acceptance tests before asking for code

## Inputs
Feature brief

## Procedure
Pick a value just below a cutoff and the value exactly on it. A vague requirement often breaks at the boundary.
Turn the feature brief into a table of inputs and expected outputs. Include one normal case, both sides of a cutoff and one ambiguous case. Ask one question for any missing rule. Stop before writing implementation code.

## Verify
Read each expected output without the AI. If two people could disagree about a row, settle the requirement first.

## Test with the sample
A shipping calculator charges $5 on orders under $50 and $0 on orders of $50 or more. Use dollars and cents. The brief says nothing about a negative order total.

## Expected example
$12.00 → $5.00; $49.99 → $5.00; $50.00 → $0.00. For −$1.00, ask whether to reject the input. No behavior has been specified for that case.

## Further practice
https://aiquestiondesk.com/prompts/test-code-before-building
