# Let the builder check its own change

> Write a verify skill so the builder runs the app and uses the change the way a person would before it hands over.

Tests say the code runs. They do not say the feature works. With `builderVerify` on, the builder starts the app and uses the change itself before it finishes.

```bash title="Terminal"
dobby config set builderVerify on
```

To turn it on for one project, add this line to the project's `dobby.md`:

```text title="dobby.md"
builderVerify: on
```

The default is `off`. Nothing changes until you turn it on.

## Let Dobby write the first skill

With `builderVerify` on and no `.claude/skills/verify/SKILL.md` in the repo, Dobby files one ticket for the project: "Write the verify skill". It files it once. `verifySkillBootstrap` decides how:

| Value | What happens |
|---|---|
| `auto` (default) | Dobby files the ticket on its next scan. |
| `ask` | Dobby asks you once. `dobby verify-skill <project>` files the ticket when you say so. |
| `off` | Dobby never files it. |

```bash title="Terminal"
dobby config set verifySkillBootstrap ask
```

For one project, add `verifySkillBootstrap: ask` to its `dobby.md`. `dobby init <project>` shows the same offer when verification is on and the skill is missing, and asks whether to file the ticket now.

The builder reads the repo (`package.json` scripts, the README, `docker-compose`, `.env.example`, seed scripts, any Playwright config) and writes the skill: the start command, the app address, the test login as an environment variable name only, and two or three core user paths. Then it proves the skill on `main`: it follows the skill, the app must start and one path must pass. That run is traced like any verify run (`dobby trace <ticket>`). The skill goes through the normal review and merge. A repo that already has a verify skill is left alone: Dobby uses it as it is and files nothing.

If only you know something (a test account, a seed command, a paid API key), the builder does not guess. It stops with one question in your needs-you list. Answer it with the value in `appEnv` (Dobby's config or the project's `dobby.md`), never in the repo.

Until the skill lands, builds record `verify=skipped` in the stamp, say so once per ticket, and `gates.verify` never blocks them.

## Write or edit the skill by hand

You can write the skill yourself at any time, and edit one Dobby wrote. It is a normal file in the repo: change it in a PR, like the examples below. A change to `.claude/skills/verify/` is a check edit, so the review looks at it closely.

## Write the skill

The builder follows `.claude/skills/verify/SKILL.md` in the repo. Without that file, Dobby skips the check and says so once per ticket (see above for having Dobby write it).

The skill names how to start the app, where it listens, what to do and what to check. The builder starts the app through a Dobby helper that gives it an empty `HOME` and no Claude login, so write the plain start command.

A web app:

```markdown title=".claude/skills/verify/SKILL.md"
---
name: verify
description: Start the shop and use the changed page in a browser.
---

1. Start the app: `npm run dev` (it listens on http://localhost:3000).
2. Open http://localhost:3000/products/1 in the browser.
3. Click "Add to cart", then open the cart.
4. Check that the cart shows one item and the stock label says "In stock".
5. Check the browser console has no errors.
```

A backend:

```markdown title=".claude/skills/verify/SKILL.md"
---
name: verify
description: Start the API and call the changed endpoint.
---

1. Start the service: `npm start` (it listens on http://localhost:8080).
2. Wait until `curl -s http://localhost:8080/health` returns `ok`.
3. Call the endpoint: `curl -s -X POST http://localhost:8080/orders -d '{"item":"tea","qty":2}'`.
4. Check the answer has `"status":"created"` and an `id`.
5. Call it again with `qty` set to 0 and check it answers 400.
```

:::tip
Write the steps a new teammate could follow. Name the exact text or status code to look for, so the builder can say pass or fail.
:::

The builder checks each part of the ticket's done-when, fixes what fails, checks again, and ends with one line: `Verify: pass - <what it checked>` or `Verify: fail - <what failed>`. Dobby shows that line in chat, cut to 200 characters. The token cost of the check is part of the ticket's cost in `dobby trace`.

## What the stamp says

The `Verified-by:` line ends with `verify=`:

```text title="Verified-by line"
Verified-by: tests=pass tester=pass review=2 rounds device=none app=pass flows=pass verify=pass
```

| Value | Meaning |
|---|---|
| `pass` | The builder ran the change and reported `Verify: pass`. |
| `fail` | The builder reported `Verify: fail` and could not fix it. |
| `excused(reason)` | The gate sent the build back twice, and the builder added a `Gate-escape: verify: <why>` line to its commit message. |
| `skipped` | The setting is on, but Dobby could not run it: no verify skill, or the sandbox rules below. |
| `none` | The setting is off, or the builder wrote no `Verify:` line. |

## The gate

`gates.verify` decides what Dobby does with a build that skipped the check (`none`) or ended with `fail`. A `skipped` build is never blocked.

| Value | What happens |
|---|---|
| `off` | Nothing is checked. |
| `observe` (default) | Dobby records "would have blocked" and the build goes on. |
| `enforce` | The build goes back to the builder with the reason. After `gates.escapeAfterBlocks` (2) blocks, a `Gate-escape: verify: <why>` line in the commit message lets the next try pass, and the stamp says `excused`. |

```bash title="Terminal"
dobby config set gates.verify enforce
```

The scripted app and flows checks (`appStart`, `flowsDir`) are separate and stay as they are.

## The run trace

Each verify run is a stage in the ticket's trace (`dobby trace <ticket>`, and the ticket page). Every step the builder reports (start, each action, each check) has its time, outcome, tokens, cost and screenshot path. Screenshots are kept outside the worktree. The tokens and cost of a step are the build run's totals split by step time, so read them as an upper bound. The `verify_steps` table holds the same rows if you want to query them.

A failed step has a cause:

| Cause | Meaning |
|---|---|
| `code` | The change is wrong. |
| `skill` | The verify skill's steps are wrong or out of date. |
| `environment` | The machine, the port or the network. |

:::tip
After `verifySkillTicketAfter` (default 3, `0` = never) runs that failed with `cause=skill`, Dobby files one "Fix the verify skill" ticket that cites the traces.
:::

## The monthly stress test

Once a month, with the miss-check prune, Dobby runs the skill on the base branch `verifyStressRuns` times (default 5, `0` = off). It files a ticket when the runs disagree (flaky), all fail, or a run takes longer than `verifyMaxSeconds` (default 300). The cost is logged. It runs only for projects with `builderVerify` on and a skill in the repo. Like the builder's verify, it is skipped on Linux while the sandbox is on (each sandboxed command gets its own localhost, so the browser cannot reach the app). Each key can be set per project in `dobby.md`.

A change to `.claude/skills/verify/` is a check edit: the PR review flags it, because a weaker skill makes the check easier to pass.

## Limits

- The app and the browser run on your machine, the same way the app check does. See [Security and the sandbox](/docs/security.md).
- No Claude login reaches the app, and its `HOME` is an empty folder. An app that needs files from your home folder will not find them.
- Localhost only. The builder starts what it needs and stops it before it finishes.
- With `build.sandboxSteps` set to `on`, the check is skipped with one chat line, because the app and the browser would run outside the step sandbox.
- On Linux, the builder's sandbox gives each command its own localhost, so the browser cannot reach the app. The check is skipped with one chat line.
- The browser is a headless Playwright MCP server, started with `npx`. The first run needs network to fetch it.
