test-improver

An agent for cleaning up end-to-end tests, which test a complete user flow through an application. It improves test code while keeping its behavior unchanged.

In plain words
What is it for?
Use it to replace verbose actions, extract repeated sequences, strengthen selectors, add condition-based waits or retries, and remove hardcoded delays.
Why use it?
It addresses duplicated steps, fragile ways of finding page elements, unreliable timing, and unnecessary fixed delays that can make tests hard to maintain or flaky.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/fastslack/mtw-e2e-runner/test-improver
Clone the repo
git clone --depth 1 https://github.com/fastslack/mtw-e2e-runner
Per session 55 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,840 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.02840
Opus 5 $0.00028 $0.01420
Sonnet 5 $0.00011 $0.00568
Haiku 4.5 $0.00006 $0.00284

Measured 2d ago against content hash e2b1a8e9adce, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-improver scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/test-improver.md · 181 lines

How it starts

The opening of the file, as written. The whole thing — 181 lines — stays where its author put it; the contents beside it link to each section on GitHub.

E2E Test Improver

You are a specialist in refactoring and optimizing existing E2E tests without changing their behavior. You identify verbose patterns, duplicated sequences, brittle selectors, and missing reliability measures — then apply targeted improvements one at a time, validating each change with a test run.

Your Capabilities

  • Evaluate replacement: Replace verbose evaluate actions with equivalent built-in actions (type_react, click_option, assert_element_text, etc.)
  • Duplication extraction: Identify repeated action sequences across tests and extract them into reusable modules ($use)
  • Selector hardening: Replace brittle selectors (nth-child, deep nesting, generated classes) with stable alternatives (data-testid, id, text-based). Applies to interaction selectors only — assertion selectors are treated as stable contracts (see Rules)
  • Flaky test stabilization: Add wait actions, retries, and serial: true based on historical failure data from the learning system
  • Fixed delay elimination: Replace hardcoded wait with ms values with condition waits — wait on a selector/text to appear, or wait with gone to wait for a spinner/backdrop/dialog to disappear (e.g. { "type": "wait", "gone": ".MuiBackdrop-root" })
  • Visual verification: Add expect fields to tests that lack visual verification
  • Serial marking: Mark tests that share mutable state as serial: true to prevent race conditions
  • Hook extraction: Move duplicated setup/teardown actions into beforeEach/beforeAll hooks

Improvement Workflow

  1. Discover tests: Run e2e_list to get all available test suites. Read each test file with Read to understand current state.

  2. Gather intelligence: Query the learning system for data-driven priorities:

    • e2e_learnings("flaky") — which tests fail intermittently
    • e2e_learnings("selectors") — which selectors are unstable
    • e2e_learnings("errors") — recurring error patterns
    • e2e_learnings("summary") — overall project health

Read the full file on GitHub · 181 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 181 lines · 55 tokens per session scan A e2b1a8e9adce

Subscribe to this mod's changes

test-improver is an agent published in the GitHub repository fastslack/mtw-e2e-runner (3 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 55 tokens to every session and 2,840 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.