/agentex:optimize-loginfrom AgenTeX
Reduces login overhead in browser tests by saving and reloading browser sessions, turning a multi-minute login into a one-time cost per session.
Ships in AgenTeX. 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; scripts run unread.
You turn a web application's login into a one-time cost per session: discover the real login live, script the smallest path through it, then save and reload that session for every later run. You never build around a security gate — a captcha or OTP you cannot solve is handed to a person, never bypassed.
Login is usually the most expensive step of a browser run and the least interesting. On a real project it was ~197 seconds of agentic driving per scenario, inside a ~12-minute preamble. After applying this skill: ~38s once, then ~8s per later run.
The loop below is the same everywhere. How much code it takes is not — a username/password form is three lines; a cross-origin iframe with a captcha and an OTP is a hundred and fifty. Find out by looking, not by assuming.
users (password: the user's password or
defaults.password; login.mode in config/project.json says whether to reuse saved
sessions ("session") or log in fresh every run ("fresh")).storageState). In a playwright-cli session (a test run,
define-flow): login_state.js save, never state-save by hand.login_state.js load, which loads into that session and
checks the landmark saved with the file.Steps 3–5 are identical in every application and are bundled:
${CLAUDE_PLUGIN_ROOT}/skills/browser-driver/scripts/login_state.js. Follow the browser-driver
skill's "Login mode" section and
${CLAUDE_PLUGIN_ROOT}/skills/browser-driver/references/tools/login-state.md.${CLAUDE_PLUGIN_ROOT}/skills/optimize-login/scripts/session.js —
saveSession(page, {statePath, landmark}), resumeSession({statePath, url, landmark}),
isAuthenticated(page, landmark).Steps 1–2 are yours to discover per application.
To check a saved session outside a run, without writing any project code (this launches its own library browser, not the run's session):
node ${CLAUDE_PLUGIN_ROOT}/skills/optimize-login/scripts/session.js resume \
--state test/.auth/<environment>-<user>-state.json \
--url https://app.example.com/dashboard \
--absent "role=button[name='Login']"
Prints one RESULT: RESUME_PASS|RESUME_FAIL line.
session.js needs the playwright PACKAGE, because it drives a library browser of its own (a
playwright-cli session loads a saved storageState through login_state.js and needs no
library). It looks for it in the project you run it from — the working directory and its
parents, so a monorepo hoist works — falling back to NODE_PATH if you set one. If
the project has not got it: npm i -D playwright, then npx playwright install chromium.
The bundled Chromium is what it launches; add --channel chrome (or msedge, …) only when
the test needs that specific browser, and --headed to watch a resume fail with your own
eyes. A channel you ask for and Playwright cannot launch is an error — no other browser is
quietly used in its place.
A landmark is something true only when logged in: an element that appears (an account
menu), or one that disappears (the Login button). Pass {present: sel}, {absent: sel}, or
both.
URLs lie. A login page can carry ?returnUrl=/dashboard and satisfy any path-based check while
the user is still logged out — observed live, reporting a successful login that had not
happened, with the real failure surfacing much later somewhere unrelated.
Verify before saving and again after loading. A state file written from a half-finished login is well-formed and useless; and a session that has since expired leaves the file untouched, so "the file exists" is never "the session is alive". Do not gate on the file's age either — a 15-minute-old session was dead here while a 47-minute-old one restored cleanly.
Read the live page, not your assumptions: dump the fields, buttons, disabled states and any error text as they are at the moment of failure, then fix that specific thing and re-run. Most login scripts fail for a reason the page will state plainly if you ask it.
Two habits that pay for themselves:
Whatever you discover about a specific login — a control that ignores clicks on its label, a
field the server reads that the visible inputs never populate, a step that opens on a different
method than you expect — belongs in that application's own notes, not in this skill. In a
project using the AgenTeX page map, that means the page's gotchas.
This is deliberate. A shipped list of somebody else's surprises invites you to read the next login through the wrong lens; the surprises are findings from exploring one application, and the next one will be strange in its own way.
storageState is cookies and localStorage only. An application holding its tokens in
IndexedDB cannot be resumed this way — the post-load landmark check surfaces that plainly
instead of leaving a confusing failure later.This skill produces no report of its own — its output is state, consumed by whatever flow invoked it:
session.js resume check prints exactly one line, RESULT: RESUME_PASS|RESUME_FAIL,
and exits 0/1 to match.test/.auth/<environment>-<user>-state.json for
later runs to reload.A saved session is a bearer token in a file: whoever holds it is logged in as that user. Keep
these in test/.auth/, which /init-test and /update-agentex add to the project's .gitignore,
and never commit one. Never open, print, copy or edit one (or its .meta.json sidecar); in a
playwright-cli session only login_state.js loads or saves it.
Sessions are saved per environment and user — test/.auth/<environment>-<user>-state.json
(e.g. qa-buyer-state.json); a session saved on one environment is never resumed on another,
and one user's is never resumed as another's.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
agentex@elgazzar-plugins is listed by mhmdelgazzar/elgazzar-plugins — review the source before installing
npx claudepluginhub mhmdelgazzar/elgazzar-plugins --plugin agentex17 skills in this plugin
/api-integrationExecute user-defined API calls during test runs, from the project's integration/ catalog. Use whenever a test step needs an HTTP call: verify via API that a UI action persisted, check an endpoint's response, or seed test data through a service. Triggers on spec steps starting with "api:", or requests like "verify via API", "call the endpoint", "check the response". The agent executes ONLY requests the user has defined in a *_api.json catalog (searched recursively under integration/) — it never composes its own HTTP requests.
/ask-kbAsk a project's knowledge base a natural-language question during a test run, via the KB Ask API, and read the answer as advisory context. Triggers on spec steps starting with "kb:", or requests like "ask the KB", "what does the knowledge base say", "how does <flow> work". Explicit only — the agent never calls the KB on its own initiative. Answers inform testing/navigation but are NEVER used as PASS/FAIL evidence.
/azure-integrationInteract with Azure resources from a QA/test run via the Azure CLI (`az`) — login/auth, discovery, and reading App Service, Storage, Key Vault, and AKS resources. Use whenever a task needs to reach Azure (verify a deployment, tail app logs, read a blob/secret, get AKS credentials) or when `az` is not installed. Read the reference before the first `az` command./browser-driverThe browser driver for test-execution runs. It drives a real browser through playwright-cli for unprefixed (prose) spec steps and covers isolated sessions, screenshot and console evidence, login modes, and the failure signatures that decide retry versus defect. Use when a test-execution run's drivers include browser, before the first browser action; the test-execution orchestrator and qa-executor read it. Not a standalone entry point./bug-report-azureAfter a completed test/regression run where one or more defects were found, file them as tracker Bugs on the configured tracker — Azure DevOps or Jira Cloud ("file these as Jira bugs" works the same) — following a configurable bug template, through bundled Node scripts that talk to the tracker REST API directly (no Azure CLI, no acli needed). Product/team-agnostic: org/site, project, area path, template, assignees, and test plan resolve from config, never hardcoded. ONE gate per filing: all reads and validation run first with zero board writes, then a single consolidated screen (validated fields + the exact write plan) and one approval before anything is written. Severity/priority recommended from the run's findings, screenshots validated in two passes, writes fail closed with an exact per-write ledger — the board never silently differs from what the user confirmed./db-integrationExecute user-defined database queries during test runs, from the project's integration/ catalog (SQL Server via sqlcmd). Use whenever a test step needs a DB check: verify a row was created/updated by a UI action, check column values, or seed test data. Triggers on spec steps starting with "db:", or requests like "check the database", "verify the row", "query the table". The agent executes ONLY queries the user has defined in integration/*_db.json — it never composes its own SQL.
Other plugins' skills for the same job