Module 2 · Lesson 4 of 12

Specify Behavior Before Code

A useful specification describes the observable outcome, boundaries, and evidence of completion before implementation begins.

# Specify Behavior Before Code

A vague request invites an agent to fill gaps with assumptions. Specify what a person or system should observe, what must stay true, and how completion will be checked. Prefer examples, edge cases, and acceptance criteria over prescribing every line of implementation.

For a feature, capture the user problem, expected behavior, non-goals, constraints, and validation. Include the unhappy path: missing data, permission failures, retries, or invalid input. State what is already decided and what the agent should ask about.

Good specs are small enough to review and precise enough to test. If there are competing interpretations, resolve them before asking for code.

## Apply it

Rewrite one issue as: Given a starting state, when an action occurs, then the expected outcome is visible. Add one boundary case and one explicit non-goal.

Practice: Ask an agent to identify ambiguities in your specification before implementation.

Sign in to keep track of the lessons you finish.