Simon Willison’s Weblog

Subscribe

Guides > Agentic Engineering Patterns > First run the tests

Changes to First run the tests

Feb. 28, 2026, 10:40 p.m. #

--- +++ @@ -9,13 +9,13 @@ Agents are already biased towards testing, but the presence of an existing test suite will almost certainly push the agent into testing new changes that it makes. Any time I start a new session with an agent against an existing project I'll start by prompting a variant of the following: - +````markdown-copy - First run the tests +First run the tests - +```` For my Python projects I have [pyproject.toml set up](https://til.simonwillison.net/uv/dependency-groups) such that I can prompt this instead: - +````markdown-copy - Run "uv run pytest" +Run "uv run pytest" - +```` These four word prompts serve several purposes: 1. It tells the agent that there is a test suite and forces it to figure out how to run the tests. This makes it almost certain that the agent will run the tests in the future to ensure it didn't break anything.

Feb. 24, 2026, 12:36 p.m. #

Draft status changed from draft to published.

Feb. 24, 2026, 12:33 p.m. #

--- +++ @@ -18,8 +18,8 @@ These four word prompts serve several purposes: -1. It tells the agent that there is a test suite and forces it to figure out how to run the tests. This makes it almost certain that the agent will run the tests again itself in the future to ensure it didn't break anything. +1. It tells the agent that there is a test suite and forces it to figure out how to run the tests. This makes it almost certain that the agent will run the tests in the future to ensure it didn't break anything. 2. Most test harnesses will give the agent a rough indication of how many tests they are. This can act as a proxy for how large and complex the project is, and also hints that the agent should search the tests themselves if they want to learn more. -3. It puts the agent in a testing mindset. Having run the tests it's natural for it to the expand them with its own tests later on. +3. It puts the agent in a testing mindset. Having run the tests it's natural for it to then expand them with its own tests later on. Similar to ["Use red/green TDD"](https://simonwillison.net/guides/agentic-engineering-patterns/red-green-tdd/), "First run the tests" provides a four word prompt that encompasses a substantial amount of software engineering discipline that's already baked into the models.

Feb. 24, 2026, 12:30 p.m. #

Initial version.