/atr-skills:atr-authorfrom atr-skills
Guides writing ATR behaviour test specs (.test.txt) that compile correctly and avoid false passes. Covers assertion design, element targeting, absence checks, and counting patterns.
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.
Read when SKILL.md points to them.
A .test.txt spec is compiled once, by a model driving the real application,
into a JavaScript file that replays with no model in the loop. Running is
solved. Writing a spec that compiles, and that does not lie when it passes,
is the hard part — and it is what this skill is for.
The spec text reaches the compiler verbatim. ATR does not parse sections; it passes the whole file through. Everything you write in it is instruction to the model. That is the whole reason authoring guidance is a skill rather than a manual: the spec is the one input to the compiler that does not ship with the compiler.
Syntax lives in references/test-file-format.md. Start with
references/spec-template.test.txt. What follows is judgement.
A false pass is the worst thing ATR can produce — worse than a crash, because nobody investigates a green test.
These are all assertions that cannot fail:
Expected Results:
- Steps completed successfully ← the steps succeeded by construction
- No console errors ← true on most broken pages
- The page loads ← it loaded before you clicked anything
Write what would be different if the feature were broken:
Expected Results:
- The order confirmation shows the order number
- The cart badge reads 0
- The "Place order" button is gone
If you cannot name something that would differ, you do not yet have a test.
A substring match against the whole page passes for the wrong reason. One real
spec searched for "archiv" and matched three unrelated things on the page.
Name the container. The compiler emits atr.text(selector) when you name one
and a whole-page match when you do not.
"Read-only" does not mean a notice appeared. It means zero editors and zero send buttons. A spec that only checks for the banner passes on a page that shows the banner and still lets you type.
Absence is only meaningful once the page has settled — wait for the state that removes the thing (the confirmation, the empty list, the new view) and then assert it is gone.
"The last entry in the log is X" breaks the second time the test runs into the same log. "One more entry than before, and it reads X" survives.
Tests run repeatedly against shared state. Any assertion phrased as an absolute position or an absolute total is a time bomb.
Not one event. Say what state ends the step:
Never ask for a fixed sleep. The compiler will wait for a state if you name one, and will guess if you do not.
Say it as one expectation, not a wait and then a check. The compiler emits
atr.expectText, which waits and asserts together; the two-call form hands the
diagnosis to whichever call hits the wall first — always the wait — so a page
that stops reaching the state is reported as a timeout rather than as the
feature being broken, and CI retries it instead of escalating.
A compile drives your spec more than once — once to learn the application, then again to verify what it wrote. A spec that deletes the only record it depends on works once and then fails for ever.
Put the setup in the spec and say it is setup:
Setup:
- Create a project named "atr-fixture-{run}" if one does not exist
The compiler turns that into atr.setup(...), which runs before the steps on
every execution and is not counted as a step. A failure there is reported as
the fixture failing, not the application misbehaving.
This is also the answer to "how do I test deletion": create the thing, delete the thing, assert it is gone.
Labels hide in at least three places — placeholder, aria-label, and
<label for> — and two dialogs in the same application will disagree about
which. Use atr browser snapshot and quote what is actually there.
Rich-text editors are the recurring trap: they reject a plain fill and need an input-event recipe. The class is universal even though the recipe is app-specific, so put the recipe in Notes for the compiler (below).
config is the one failure kind the agent will not help with: not
repairable, not retryable, never sent to the model. A person has to decide
what the value should be.
That is deliberate. The tempting "fix" for a missing value is to inline the literal back into the script, which undoes the reason inputs live outside it.
Values live in <spec>.test.properties (committed) beneath
<spec>.test.override.properties (gitignored) and ATR_VALUE_* variables. A
committed properties file executes — $(command) and ${VAR} expand at
read time, on every machine including CI.
Some applications cannot be logged into by a script — SSO, a hardware token, a one-time code.
atr browser start # start the daemon
# sign in by hand in the window that opens
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.
Name the symptom of forgetting, because it is unrecognisable otherwise: every step times out on a sign-in page, which looks exactly like a hang.
For a credential that can be scripted, use a secret reference rather than a
value — the compiler emits atr.fillSecret, which fetches and types inside one
call so the value never enters the script, the transcript, or a later repair
prompt.
How you break a spec into steps decides what can ever be shared between specs.
A hoisted operation replaces a run of consecutive statements inside a single step. So if you write:
1. Open the tags page
2. Follow the "rest" tag
the compiler puts a check at the end of step 1 — it arrived, after all — and
now the navigate and the click sit either side of an assertion and either
side of a step boundary. They can never become one shared openTag(), because
gathering them would mean moving the assertion, and an assertion never moves.
Write the journey as one step and the checks as the next:
1. Open the tags page and follow the "rest" tag
2. Confirm the reader is looking at that tag's posts
This is also just better spec writing: a step is a thing the reader does, and Expected Results is what must then be true. The sharing falls out of that.
You do not have to write the shared library. Compile two specs that drive the same journey and ATR hoists it for you: it finds the repetition, names it, rewrites both scripts to call it, and replays them before keeping the change. Nothing is kept unless every rewritten script still claims exactly what it claimed before, character for character.
A compile is also shown what its neighbours wrote, so two specs reaching the same page use the same selector and the same constant name rather than inventing their own. That is what makes the repetition findable at all.
Do not name a library function in a spec. A step that reads "open the
front page using openFirstPost() from the shared library" does not fail when
no such operation exists — the compiler writes a local function of that name
and calls it, and the test passes. It reads as though the script shares code
when it does not: the next spec making the same journey writes it again, and if
a real library operation of that name ever appears, the local one silently wins
over it. The lint reports this as local-helper. Describe what the reader
does; deciding what deserves a name is ATR's job.
You can still write _shared.js by hand, and reading it is worth it either
way — it is loaded into the same scope before every script in the directory,
so its top-level functions are simply in scope:
// tests/e2e/_shared.js
function signIn(username) {
atr.navigate("/login");
atr.fill("#username", username);
atr.fillSecret("#password", {ref: "app_password"});
atr.click("#submit");
atr.waitFor("#dashboard"); // ends on the dashboard
}
The compiler is shown this file verbatim, so it calls signIn() instead of
rediscovering eight steps — which is the real saving. Duplication is the
obvious cost of not having it; compile time is the larger one, and every
rediscovery is a fresh chance to get it subtly different.
Three rules, and the first is enforced rather than requested:
expect and atr.fail refuse to run from the library.
Once a test's assertions live in shared code you can no longer read the test
and know what it checks, and one edit can weaken every test in the directory.atr.step or atr.setup either — steps
belong to a spec, and a library that declares them renumbers all of them.values is per-spec, so a library that reads
values.get("username") needs every spec in the directory to define it.A defect in the library is config: never repaired, never retried, never sent
to the model. A person fixes shared code.
atr refactor-ops tests/ --dry-run says what could be hoisted without
changing anything or opening a browser. Turn the automatic pass off with
behavior.extract_operations: on-demand or --no-extract.
Under --no-compile — which is what CI runs — hoisting only ever reports.
Applying it would call the model and rewrite the scripts, and that flag permits
neither, so a replay job never comes back with a modified working tree.
Editing the library does not force a recompile. Scripts carry a second
header, // atr-lib-sha256:, and a change to it means the script is unproven
against the new library, not wrong — so it replays and the header catches up.
Only a genuine signature break reaches the model, and only for the specs that
actually broke.
The honest trade-off: this is Page Object Model, and it carries POM's bargain. You keep "read the script, see exactly what it asserts". You lose "read the script, see exactly how it got there".
The section nobody knows exists, and the one that decides whether a hard spec compiles. It goes at the end of the file and holds everything the model cannot learn by looking at one page:
Every note should be a trap that produced a wrong result. If you cannot say what would go wrong without it, leave it out — the notes are prompt, and padding costs iterations.
Do not restate what the compiler already knows. These are in the binary's
prompt and repeating them wastes tokens: use atr.setup for fixtures, wait for
state instead of sleeping, atr.expectExists/atr.expectMissing for presence,
selectors over page text, :has-text() for text-qualified targets.
Bootstrap. atr browser record --output tests/thing.test.txt gives you
the steps. It cannot give you the expectations — it leaves a TODO
where they belong. Answer it; that is rule 1.
Compile once. atr run --behavior tests/thing.test.txt. It drives the
real application, so it needs a base URL and takes minutes.
Read the emitted .test.js before trusting it. This is the step nobody
does. You are checking one thing: could this script fail? A step with no
assertion is a step that passes whatever happens.
Commit the script. It carries a hash of the spec, so a reviewer can see what changed and CI can replay it. A generated file whose behaviour depends on who ran it last is worse than no file.
--no-compile in CI. It replays or it fails loudly. Without it a spec
edit silently turns a 9-second CI step into a multi-minute model run.
--prune-values occasionally. Repeated compiles accumulate aliases —
one real spec ended up with seven keys for two inputs.
Backport the compiler's corrections. When a compile discovers your spec
was wrong — you wrote button[type="submit"], the real control is
button:not([type]) — put the correction back in the spec. Nobody does
this, and spec and script diverge silently from then on.
The reason nobody does it: editing the spec changes its hash and forces a recompile. So batch backports and do them when a recompile is due anyway.
Read the generated .test.js against this list. It is short because it only
contains things that make a compiled test lie:
atr.log cannot fail.toContain with a short needle against atr.text() with no selector.atr.sleep outside atr.retry — a fixed sleep is a race that has not
happened yet.atr run runs the mechanical half of this list for you — a step that can only
succeed, a script with no assertion at all, a short substring matched against
the whole page, a fixed sleep — and refuses to accept a script that cannot
fail. --lint=warn reports without refusing while a suite adopts the check.
The judgement half is yours.
| kind | means | what you do |
|---|---|---|
assertion | the application is wrong | fix the app — never the assertion |
not_found | the UI moved | let the agent repair it, then check the diff |
timeout | slow, flaky, or hanging | retried automatically; if persistent, the spec is waiting for the wrong thing |
environment | browser or network | not about your test |
config | an input is missing | you must supply it; the agent will not |
script | the generated JavaScript is wrong | the compiler's fault; it repairs itself |
Only assertion turns a suite red (exit 1). Everything else exits 2, so a CI
job can retry rather than escalate.
examples/behavior/blog/ is three specs against a live blog, with the inputs,
the shared library and the JavaScript the compiler produced from them. It is
the only example written against a site with no data-testid anywhere, whose
content changes when its author publishes — which is what most real
applications look like.
Worth reading for what the compiler did with the notes section, and for how the expectations are phrased so that publishing a new post does not break them.
atr-behavior — running specs that already exist: flags, exit codes,
triage.atr-browser — driving the browser by hand while you work out what the
spec should say.references/test-file-format.md — the syntax.references/spec-template.test.txt — start here.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
atr, behaviour-testing, test-authoring, spec-writing, regression-test
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-behaviorRun behavior tests, run browser tests, execute .test.txt files, run e2e tests with ATR, replay compiled browser tests, natural language browser testing, or triage a failing ATR behaviour test. For writing or recording a new spec, use atr-author instead./atr-browserControl browser, automate browser interactions, navigate to URLs, click on webpages, fill forms, take screenshots, inspect webpages, web scraping with browser, test websites manually, or interact with web pages programmatically using ATR browser server mode. Pairs with the atr-computer skill when a workflow needs the OS desktop too (drag-and-drop from the file manager, system dialogs, native apps)./atr-computerControl the desktop (mouse, keyboard, screen, windows, apps) cross-platform via ATR. Take screenshots, click at coordinates, type text, drag, manage windows, launch and quit apps. Includes 'atr computer ask' — an in-process LLM agent that takes a natural-language instruction and drives the desktop end-to-end. Use for native UI testing, desktop automation, multi-monitor flows, or anything outside the browser. Pairs with atr-browser for combined web + desktop workflows./atr-recordRecord a browser session to disk and read back what went wrong — console errors, failed requests, and the frames that were on screen when they happened. Use when a browser run failed and the transcript is not enough, when you need evidence of a flaky reproduction, or when somebody wants to watch what an agent did. Also covers `atr remote`, the live view that streams the running browser into a web page. Pairs with atr-browser, which drives the browser this records.npx claudepluginhub imyousuf/agentic-test-runner --plugin atr-skillsOther plugins' skills for the same job