/atr-skills:atr-behaviorfrom atr-skills
Runs natural-language browser tests written as .test.txt specs. Compiles once, replays without model calls. Use --no-compile for predictable CI cost.
Ships in atr-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Runs browser tests written as natural-language .test.txt specs. A spec is
compiled once into a sibling .test.js and afterwards replays with no
model in the loop — seconds, and no tokens. The agent comes back only to
diagnose a failure.
Writing a spec is a different job. Load
atr-authorfor that: which assertions are worth writing, what belongs in the notes section, and how to avoid a test that passes without testing anything.
atr run --behavior tests/login.test.txt # compile if needed, then replay
atr run --behavior tests/e2e/ # every .test.txt in the directory
atr run --behavior tests/e2e/ --browser-url http://localhost:3000
| Flag | Description | Default |
|---|---|---|
--behavior <path> | Test file or directory | (required) |
--browser-url <url> | Base URL for the application | from config or base_url |
--headless | Run the browser headless | false |
--viewport <WxH> | Viewport size | 1920x1080 |
--cdp-endpoint <url> | Connect to an existing browser | - |
--no-compile | Replay only; never call the model. Fails loudly if the script is missing or stale | false |
--recompile | Regenerate the script even if it matches the spec | false |
--no-repair | Diagnose a drifted script but do not rewrite it | false |
--prune-values | Remove inputs the script no longer reads | false |
--lint <mode> | What to do about a script that cannot fail: error, warn, off | error |
--no-triage | Never ask the model why a failure happened, even to classify it | false |
--otel-endpoint <url> | OTLP collector for run telemetry, e.g. http://localhost:4318 | from config or env |
--interpret | Skip compilation; let the agent drive every step | false |
-v, --verbose | Show the script's own atr.log() output | false |
Use --no-compile whenever cost must be predictable — always in CI. It
replays, or it fails and says why. It never calls the model.
Without it, any of these silently turns a 9-second step into a multi-minute model run: the spec was edited, the script is missing, the script has never completed a run, or a failure invites a repair.
atr run --behavior tests/ --no-compile # CI: replay or fail
atr run --behavior tests/login.test.txt # local: compile if needed
--no-compile needs no backend at all — no API key, no project, no
gcloud auth application-default login. A CI job that only replays does not
have to hold credentials, and one that has them spends at most a single call,
only when a run has already failed, to say why (see below). (--interpret
is refused alongside it, since it is nothing but model calls.)
Each run prints how it was serviced (compiled →, repaired →) and how many
model calls it cost. A passing replay costing more than zero is worth
investigating; a failing one costs one call to classify the failure, which
is the point.
Before a script runs, ATR checks statically that it can fail: that the script
asserts something, and that no step is built only from reads. A step of pure
atr.log reports success whatever the application does, and a suite of those
reports that everything works right up until someone opens the application.
A blocking finding stops the run and exits 2 — nothing was learned about the application, so it is not a test failure. The findings never go to the model: a model asked to invent the missing assertions will invent ones that pass.
atr run --behavior tests/ --lint=warn # report but run; for adopting the check
atr run --behavior tests/ --lint=off # skip it
Looser problems — a short substring matched against the whole page, a fixed
atr.sleep outside a retry — are reported and not enforced.
The compiled script is committed and carries a hash of the spec:
// atr-spec-sha256: 9f2c…
Edit the spec and the next run recompiles. Reflow whitespace and it does not —
the hash is over normalised text, so sha256sum on the raw file will never
match it. A script that has never completed a run carries
// atr-unverified and is recompiled rather than trusted. Deleting the hash
line marks a script hand-written and off-limits to the compiler: it is replayed
as it is, under --no-compile too, and never recompiled, repaired or hoisted.
A failure is still triaged — against what the script itself checks, not the
spec — and the reason reported; no rewrite is asked for or applied.
--recompile is the one way to replace it with a compiled script.
A compile drives the spec more than once — once to learn the application,
then again to verify what it wrote — so a destructive spec needs a rebuildable
fixture. That is what atr.setup(...) in the compiled script is for, and what
a Setup: section in the spec compiles to.
Beside the spec:
login.test.properties — committed, written by the compiler, editable.login.test.override.properties — gitignored, wins over it.ATR_VALUE_* environment variables — win over both.base_url here is what lets one spec run against localhost and staging with no
flags. Values support $(command) and ${VAR}, expanded when read — so a
committed properties file executes, on every machine including CI.
--prune-values removes keys the script no longer reads. It reports without
removing unless you pass it, scans the shared library as well as the script,
and says nothing at all when either builds a key at run time, because then no
scan can be sure.
A _shared.js beside the specs is loaded into every script in that directory.
It holds operations — sign in, create the thing — never assertions:
expect and atr.fail are refused from it.
Editing it does not force a recompile. Scripts carry a second header,
// atr-lib-sha256:, and a mismatch means the script is unproven against the
current library rather than stale — so it replays and the header is updated
when it passes. Under --no-compile the update is reported instead of written,
so CI does not leave a dirty tree.
Hoisting follows the same rule. A run normally hoists the operations its specs
keep repeating into _shared.js; under --no-compile it reports what could be
hoisted and changes nothing, because applying it would call the model and
rewrite the scripts — neither of which that flag permits. Run
atr refactor-ops <dir> to act on it.
A defect in the library is a config failure: never repaired, never retried,
never sent to the model.
| code | meaning | what CI should do |
|---|---|---|
| 0 | every test passed | — |
| 1 | the application is broken — an assertion failed | escalate |
| 2 | nothing was learned about the application — missing input, browser or model failure, stale script under --no-compile | retry, or fix the environment |
1 means the app is wrong and nothing else. That separation is the point: a red build that can also mean "the CI box was slow" is a red build people learn to ignore.
Printed with every failure, and each asks for a different response:
| kind | means | ATR's response |
|---|---|---|
assertion | the application did not do what the spec requires | stops immediately, no model call — never auto-repaired |
not_found | a target is gone; the UI moved | agent repairs the script, budget of 1 |
timeout | slow, flaky, or hanging | retried, then triaged |
environment | browser, daemon or network | retried, then reported as infrastructure |
config | an input this checkout does not define | reported; never repaired or retried — a person must supply it |
script | the generated JavaScript is wrong | repaired |
An assertion failure never reaches the model. That is deliberate: asking a model to confirm a regression spends the tokens compilation exists to save, and risks it "fixing" the assertion that caught the regression.
A regression can present as a timeout. If a script waits for a state and
then asserts it, the wait fails first — so a page that stops reaching that
state is reported as a timeout rather than as the application being wrong.
atr.expectText waits and asserts in one call and cannot be misattributed that
way; the lint reports the two-call form and names it.
For scripts already written the other way, triage covers it: a failure that survives its retries is classified, and a verdict of "the application is at fault" makes the run exit 1.
Triage is not compilation. --no-compile refuses to generate a script;
it no longer refuses to judge one. A replay that fails will spend one model
call to classify it — only on a run that has already gone red, and never to
rewrite anything, since CI asked for a replay. If no backend is configured it
says so and reports the runtime's own classification, so nothing new is
required of a CI job that had none. --no-triage restores the absolute
guarantee.
atr run --behavior tests/x.test.txt --headless=false # watch it
atr run --behavior tests/x.test.txt -v # show atr.log output
atr run --behavior tests/x.test.txt --no-repair # diagnose without rewriting
Then read the compiled .test.js — it is ordinary, readable JavaScript, and
the failure names the step and the target.
When authentication cannot be scripted (SSO, a hardware token, a one-time code):
atr browser start # start the daemon; a window opens
# sign in by hand
atr run --behavior tests/ # reuses the running daemon's browser automatically
No flag is needed — atr run picks up a running daemon's CDP endpoint on its
own and opens an isolated tab for the test, leaving your tabs alone.
~/.atr/config.yaml:
behavior:
base_url: "http://localhost:3000"
browser:
executable: "auto"
headless: true
viewport: { width: 1920, height: 1080 }
page_timeout: "30s"
action_timeout: "10s"
Every behaviour run is recorded locally in ~/.atr/history.db, including the
runs that never reached the application — a missing input, a browser that would
not start, a stale script under --no-compile. Those are the ones a pass rate
has to exclude to mean anything.
atr history # per spec: runs, pass/fail/infra, flakes, repairs
atr history --spec tests/login.test.txt --runs
atr history --since 7d --json
Two numbers only ATR can give you:
The median REPLAY duration is worth watching: a replay is deterministic with no model in the loop, so a suite drifting from 9s to 15s means the application got slower.
The database is plain SQLite and the views (runs, attempts, compiles) are
a stable contract, so anything the command will not tell you is one query away:
sqlite3 ~/.atr/history.db "SELECT spec, outcome, count(*) FROM runs GROUP BY 1,2"
Point ATR at an OTLP collector and the same runs are exported as traces, metrics and logs — which is how a CI run's history survives the container being torn down. Three ways, in precedence order:
atr run --behavior tests/ --otel-endpoint http://localhost:4318 # this run only
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 # the standard variable
telemetry:
endpoint: "http://localhost:4318" # ~/.atr/config.yaml
Give the collector's base URL; the signal path (/v1/traces and friends) is
appended, and a URL that already names a signal is left alone. With no endpoint
anywhere, nothing is emitted and no error is logged.
Turn either off in ~/.atr/config.yaml; both may be off at once:
history:
enabled: true
keep_days: 90
telemetry:
enabled: true
Nothing ATR records lifts a resolved value into a field of its own. A value can appear inside a failure message, because the message quotes the application and your own expectations back at you — so whether messages leave the machine is governed by whether you export the logs signal.
atr-author — writing, recording and reviewing specs.atr-browser — driving the browser by hand.docs/behavior-compilation.md — the full picture.What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/atr-analyzeRun tests, linters, type checkers, and builds with AI-powered analysis. Use this INSTEAD OF running test/lint/build commands directly via Bash. Wraps any command (pytest, jest, go test, make test, npm test, make lint, mypy, tsc, eslint, golangci-lint, cargo clippy, make typecheck, make build, etc.) to produce clean summarized output, keeping conversation context small. When a test or lint fails, ATR analyzes the full output and returns actionable failure insights./atr-authorWrite, author, add or record an ATR behaviour test. Convert a manual test case or a QA script into a .test.txt spec. Use when creating a new browser test, turning a bug report into a regression test, or fixing a spec that compiles badly, produces a false pass, or keeps needing repair. Companion to atr-behavior, which covers running tests that already exist./atr-npx claudepluginhub imyousuf/agentic-test-runner --plugin atr-skillsOther plugins' skills for the same job