/mabl:mabl-debugfrom mabl
Diagnoses and fixes failures in mabl end-to-end tests. Provides forensic inspection of failed runs and interactive live debugging via Chrome CDP.
Ships in mabl. 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.
Investigate a failed mabl test, reproduce it locally, and verify the fix.
# Check the mabl CLI is installed and recent enough; install/upgrade if not
MIN_MABL_CLI_VERSION=2.111.0
command -v mabl >/dev/null 2>&1 || npm install -g @mablhq/[email protected]
[ "$(printf '%s\n%s' "$MIN_MABL_CLI_VERSION" "$(mabl --version)" | sort -V | head -1)" = "$MIN_MABL_CLI_VERSION" ] || npm install -g @mablhq/[email protected]
mabl auth info # verify you're logged in (run `mabl auth login --auto` if not)
Command + flag discovery. Don't guess flag names — ask the CLI. Run
mabl agent debug command-listfor a single JSON tree of every subcommand, its full command path, positionals, and options. Add--output yamlfor a human-readable form. At any group level the same command works on the subtree — e.g.mabl agent debug session command-listlists just the session subcommands.Use
mabl agent debug <subcommand> --helpwhen you want yargs' formatted text help for one specific command.
Output shape per command.
artifact <type>defaults to a{step_run_id, type, file, size_bytes}envelope so the agent can readsize_bytesbefore slicing.debug stepsandlist-stepsdefault to YAML for readability (override with--output jsonfor tooling). Everything else (get-variables,set-current-step,run-step,run-to-step,run-all,session start) prints bare JSON to stdout. When you pipe tojq, check the command —debug stepsandlist-stepsneed--output jsonfirst.
1. Triage → debug steps + debug artifact
(what failed, on which step, with what state on the page)
2. Hypothesize → grep / git log against the failing endpoint, selector,
or stack-trace function name
3. Reproduce → debug session start --run-id <jr-id> --url <your local url>
(real Chrome attached to the agent via CDP)
4. Verify → re-run the failing step (or the rest of the test) against
the patched code; a green run-step is your check
Steps 1–2 are stateless and token-cheap. Step 3 is stateful and launches a real browser the agent drives directly.
Browser tests only.
debug stepsandsession startboth refuse API, performance, and mobile test runs up front. Performance tests don't expose per-step artifacts at all — for those, read the run report in the mabl UI. API and mobile runs use a different execution shape that this CLI surface doesn't cover.
# Step trace, default. Output is the steps that didn't pass, plus the
# summary block. Pass --all to see passed / skipped steps too.
mabl agent debug steps <jr-id>
mabl agent debug steps <jr-id> --all # full trace
When the default trace hides entries, it tells you so via a top-level
note field saying how many it hid and that --all shows them. Treat
that as "the run executed more than the failed step, you just don't
need to see the noise yet."
Each entry has index (1-based), step_run_id, flow, action,
description, status (usually passed / failed / skipped —
match it as not passed and not skipped rather than comparing to
failed, the way the recipe below does), duration_ms, step_id
(per-flow — feed to live-session commands),
and step_id_in_test (per-test). The trace also carries a top-level
summary block on any run with a step that didn't pass; on those it
also includes
summary.step_id — that's the value to copy straight into
debug session run-step / run-to-step after triage. The top-level
summary is the one to scan first; the API-side failure_summary
payload (where step_id_in_test originates) is only present on hard
failures. step_run_id is what every artifact call below takes.
# Drill into one artifact for the failing step.
# Default output is a {step_run_id, type, file, size_bytes} envelope —
# read size_bytes BEFORE deciding how to consume the file.
mabl agent debug artifact <type> <jr-id> --step-run-id <sid>
Prefer this over the hosted MCP's
get_mabl_test_run_artifact. The CLI downloads once to.mabl/debug/<jr-id>/, slices locally with--query/--text-only/--head/--tail/--bytes, and reuses the cached file across calls. The MCP equivalent ships the full payload through the MCP transport every time — for a 15 MB HAR that's hostile to your context window. Reach for the MCP version only when you don't have shell access.
Artifact types and the right slicer for each:
| Artifact | Typical size | Best for | Use this flag |
|---|---|---|---|
console | 10–100 KB JSON | JS errors / page errors | --query '[.console_logs[] | select(.level == "error" or .level == "severe")] + .javascript_exceptions' |
network | 1–15 MB HAR | failed / slow requests | --query '.log.entries[] | select(.response.status >= 400) | {url: .request.url, status: .response.status}' |
dom | 0.5–5 MB HTML | failing element + neighbors | --text-only (one line per role / name / id / data-testid) |
screenshot | 100–500 KB PNG | visual / dialog / layout | open file from the envelope |
Flag picker:
console, network) → --query <jq-expr> first. Always.--head N / --tail N are line-oriented — console / network are
often a single long JSON line, so --head 5 happily returns the
whole blob. Use --query to slice JSON; reach for --bytes only
when you specifically need a fixed-byte prefix.--text-only. The full HTML almost never fits in context.
Page chrome (header, nav, footer) renders first in the listing, so
on a big React app the top of --text-only is mostly framing. To
find a specific component, pipe through grep:
... --text-only | grep -iE "modal|dialog|<your-feature>". Or read
the cached .html directly when grep isn't precise enough.size_bytes. Under ~50 KB → --print.
Otherwise --bytes 8000 for a peek, or read the cached file directly.--print is rejected for binary.--before (screenshot only) gives the pre-action snapshot. Runs
without a pre-action capture return a soft envelope —
{step_run_id, type, before, note: "before-screenshot not available for step run <sid>"} —
not an error. Treat it as "the snapshot just doesn't exist for this
step" and fall back to the post-action screenshot.Example — full triage of a failing click:
SID=$(mabl agent debug steps abc123-jr --output json \
| jq -r '.steps[] | select(.status != "passed" and .status != "skipped") | .step_run_id' | head -1)
[ -n "$SID" ] || { echo "no non-passing step in the trace — read the summary block first"; exit 1; }
# What did the network look like at the failing step?
mabl agent debug artifact network abc123-jr --step-run-id "$SID" \
--query '.log.entries[] | select(.response.status >= 400) | {url: .request.url, status: .response.status}'
# What was on the page right before the click?
mabl agent debug artifact dom abc123-jr --step-run-id "$SID" --text-only | head -40
# Any uncaught JS errors?
mabl agent debug artifact console abc123-jr --step-run-id "$SID" \
--query '[.console_logs[] | select(.level == "error" or .level == "severe")] + .javascript_exceptions'
Artifacts cache to .mabl/debug/<jr-id>/ (gitignored) and are reused
across calls.
The triage output gives you names that ground the search:
| Triage signal | Search pattern |
|---|---|
| stack-trace function | grep -r "handleSubmit" src/ |
| failed API endpoint | grep -r "/api/v1/users" src/ |
| missing element / data-testid | grep -r "register-submit" src/ |
| recent regression | git log --oneline <last_passing_deploy>..HEAD (deploy from analyze_mabl_failure) |
For higher-level analysis the hosted mabl MCP server exposes
analyze_mabl_failure (root-cause inference, related-tests, last-passing
deploy), get_mabl_test, list_mabl_environments, list_mabl_credentials.
Use these when the shell tools don't give enough context — same APIs,
no shell required.
Most of the work in this phase is deciding who owns the fix. Quick heuristic:
| Signal | Likely owner |
|---|---|
| Stack trace points into product source; failed network call to an app endpoint; new uncaught JS error after a recent deploy | App — git log <last_passing_deploy>..HEAD on the relevant repo, then file/fix in product code |
Stale data-testid; assertion expects a value the app never produced | Test — update the step / selector / assertion in the mabl test |
| Test flakes on retry but app code, DOM, and network all look healthy | Test — usually a missing wait or a timing assumption |
When in doubt, run the live session (§3) and step through — a real browser tells you faster than more triage.
Launch a real Chrome attached to the agent via CDP and step through the test.
# If you came from a failed test run (`*-jr`), pass --run-id and most
# flags are inferred: test id, browser, credentials, environment,
# locale, timezone. Recommended form when debugging an existing failure.
mabl agent debug session start --run-id <jr-id>
# If you only have the test definition id (`*-j`) — debugging a test
# that hasn't been executed yet — pass it as the positional. You'll
# likely need --credentials-id and --environment-id explicitly.
mabl agent debug session start <test-id> --credentials-id <cred-c> --environment-id <env-e>
Prefer --run-id whenever you have one — it pins the inputs to what
the failure actually saw. Re-running with different inputs is debugging
a different test. Explicit flags override the run-derived values when
you do need to vary one.
--url <url> overrides the test's target URL. Only add it when you've
confirmed the user wants to reproduce against a different host (a
local dev server, a preview deployment) — don't reach for it
reflexively. The default behavior, hitting whatever URL the run used,
is what matches the failure. Swapping --url to a different host
can break login / credential steps even if the run-id is the same:
the credentials, OAuth callback URLs, cookie domains, or
environment-specific auth flow may all differ between the recorded
host and the swapped one. If the test starts failing at the login
step after a --url swap, the new host's auth, not the bug under
investigation, is the cause.
The output JSON includes a sessionId (mabl-debug-<timestamp>); every
later session command takes it as the first arg. When you're done,
release it with mabl agent debug session stop <sid> — that kills the
detached Chrome, removes ~/.mabl/debug/<sid>/, and returns
{stopped: true, hadSessionFile: true}. Sessions are cheap but they
do hold a live browser process and ~MB of disk per session; clean up
when iteration ends.
The stepCount field on the session-start envelope is the size of the
fully-expanded runtime step list (top-level + every nested
EvaluateFlow / StepGroup child). The forensic debug steps trace
reports total_steps for the steps the run actually executed — which
is normally smaller because a branch or an early failure stops the
walk before every nested step runs. The two numbers
describing the same test will disagree by design; don't try to
reconcile them.
Dump the runtime step tree first so you have addressable step_ids and
indexes to work with:
mabl agent debug session list-steps <sid>
For a long test (50+ steps) the full dump is noisy — list-steps has
four window / filter flags that cut it down without | grep:
| Flag | What it does |
|---|---|
--filter "<substring>" | Case-insensitive substring match against each step's description. |
--around <step-id> | Show only the steps around <step-id>. Default window is 5 before / 5 after. |
--context <n> | Widen the --around window to <n> steps before and after. |
--from <step-id> [--limit <n>] | Forward window starting at <step-id>, optionally capped at <n> entries. |
So a typical "show me the failure neighborhood" is
list-steps <sid> --around <failing-step-id> --context 3 — three
before, three after, instead of dumping all 59 entries.
Then loop:
mabl agent debug session run-to-step <sid> <step-id-before-failure>
chrome-for-mabl MCP tools (already
attached to the session's Chrome via CDP):
mcp__chrome-for-mabl__take_snapshot — accessibility treemcp__chrome-for-mabl__take_screenshot — PNGmcp__chrome-for-mabl__list_console_messages — page errorsmcp__chrome-for-mabl__fill / click / type_text / etc.mabl agent debug session run-step <sid> <step-id>
run-step returns {status, stepId, durationMs, error?, currentStepIndex, remainingSteps, conditionResult?}. For
If/ElseIf steps, conditionResult is the boolean the runtime
evaluated (true = branch executed, false = skipped to the matching
Else / EndIf); for non-conditional steps the field is omitted and
status: "failed" is a real failure.
Cursor behavior on failure. On status: "passed" the cursor
advances past the step (or wrapper subtree) so the next run-step
runs the following step. On status: "failed" the cursor stays on
the failing step — the user almost certainly wants to fix something
and retry the same step, not skip past it. So the fix-then-verify
loop is just: edit code / test → run-step (no positional, uses
cursor) → green check. Use set-current-step only to rewind to
an earlier step. If / ElseIf with a false condition reports
status: "passed" (the runtime semantic for "branch skipped"), so
the cursor moves on as expected for conditionals.
run-to-step and run-all emit two lines per step as it executes —
a timestamped runtime line on stderr ("HH:MM:SS - ") and a
structured progress line on stdout. Relay the stdout line; the stderr
one is the runtime's normal step-execution log and stays out of the
JSON / YAML envelope the wrapping agent reads.
The stdout format:
[1/12] PASS click "Click on the Login button" 450ms
[2/12] PASS enter_text "Type the email …" 320ms
[3/12] FAIL assert "Verify title equals 'Home'" 5200ms Element not found
The sequence stops on the first FAIL; exit code is 0 when every step
passed and 1 otherwise. Tell the user what just ran by relaying these
lines as they come.
Live progress for long runs. run-all against a 30+ step test
can take minutes, and stdout is pipe-buffered when the agent captures
with $(...) — by the time stdout lands, the run is over. Every
[i/N] line is also written to
~/.mabl/debug/<sid>/run-progress.jsonl (one JSON event per step,
flushed per step) so a wrapping agent can poll it for live progress
without waiting for the command to finish. Typical workflow: kick
run-all off in the background, Read the file every few seconds,
relay each new line to the user. The file is truncated at the start
of every run-all / run-to-step so it only ever holds the current
run's events.
Each event has {step, total, stepId, action, description, status, durationMs, error?} — the same fields as the stdout [i/N] line, in
machine-readable shape.
Nested-flow note. When list-steps shows an EvaluateFlow (or
StepGroup) wrapper followed by its inlined children, those children
will NOT appear as separate progress lines from run-all /
run-to-step — running the wrapper executes the whole nested flow as
one unit, so the cursor advances past the wrapper's subtree. The
children are still addressable individually with run-step if you
want to step into a specific child after rewinding with
set-current-step.
For the full list of session subcommands together with their flags,
run mabl agent debug session command-list. Use
mabl agent debug session <subcommand> --help for the yargs-formatted
text help on any individual command.
For live screenshots use mcp__chrome-for-mabl__take_screenshot — it's
already attached to the session's Chrome via CDP, no separate CLI.
After applying the fix (code change in the app under test, or step / selector change in the mabl test), prove it sticks:
# Rewind to just before the failing step…
mabl agent debug session set-current-step <sid> <step-id-before-failure>
# …then replay the previously-failing step on the patched state.
mabl agent debug session run-step <sid> <failing-step-id>
A status: "passed" on the previously-failing step_id is the
minimum bar. If the failure was deep in a flow, follow it with
run-all to confirm nothing downstream broke:
mabl agent debug session run-all <sid>
Exit code 0 from run-all (and a clean tail of PASS lines on
stdout) is your green check.
Reuse vs. restart. Keep using the same <sid> while iterating —
the session holds the browser, cookies, and state from earlier steps,
which is what you want. Start a fresh session start --run-id <jr-id>
only when (a) you upgraded the mabl CLI, since the runtime is loaded
at startup, (b) the browser is in a bad state you can't unstick, or
(c) you want a clean reproduction to attach to the PR.
For app-code fixes, the productive cycle is: edit → rebuild the app
under test → fresh session start → run-to-step → run-step on
the failing id. For test-only fixes (selector, wait, assertion), no
rebuild is needed — update the test definition and run-step
directly.
Test / run / plan ids:
*-jr test run forensic input abc123-jr
*-pr plan run group of test runs abc123-pr
*-j test definition live-session input abc123-j
*-p plan definition abc123-p
*-as agent session any mabl agent abc123-as
mabl-debug-<ts> live session ID (returned by `session start`)
Step ids — there are two, and they are NOT interchangeable:
| Field | Scope | Use it for |
|---|---|---|
step_id | per-flow | debug session run-step / run-to-step / set-current-step. This is what the live session addresses. |
step_id_in_test | per-test (across all flows) | Cross-referencing failure_summary.step_id_in_test. Do NOT pass it to live-session commands; you'll get "Step not found". |
The forensic debug steps trace surfaces both per entry. When you go
from triage to a run-to-step, copy step_id (not step_id_in_test).
debug session list-steps shows step_id under the id field.
step_id is usually stable across the two surfaces — but not
always. Most of the time the step_id string debug steps prints
is the same one list-steps shows under id and the same one
run-step / run-to-step / set-current-step accept. Direct copy,
no translation.
On some tests — older ones, and freshly imported flows — the two
surfaces address the same step through different ids: debug steps
prints whatever runtime stepId the trace recorded, and list-steps
falls back to a synthetic <flow-id>:<flat-index> shape. Those
strings won't match each other, so compare them before you copy.
If the id in list-steps isn't the step_id the trace gave you,
address the live step by position instead — list-steps always
emits one ("3", "3.2") and every live command accepts it.
set-current-step's JSON response includes a stepId field that's
always the addressable form (canonical or synthetic) — safe to feed
back into run-step directly.
Step numbers diverge too. failure_summary.step_number (mirrored
as step_number_in_flow in the trace and summary) is the step's
position within its flow, the way a user sees it in the editor.
list-steps exposes a different number — index — which is the
global position in the fully-expanded runtime list, including
nested EvaluateFlow / StepGroup children. They diverge once the test
has nested flows: a failure summary might say "step 14" while the
matching list-steps entry shows index: 27. Don't try to reconcile
them by counting — copy the step_id and pass that. The numbers are
for humans to scan; step_id is the address.
Position / index / path on list-steps entries. Each list-steps
entry carries three positional fields plus isCursor, alongside id.
They describe the same step from different angles — pick the one that
matches the input the next command takes:
| Field | Shape | What it is | Use it for |
|---|---|---|---|
position | "3.2" | 1-based dot-notation walk through the step tree (flows / step groups descend into the next segment) | set-current-step / run-step / run-to-step all accept it as the step reference. Humans scanning the list match this against what the editor shows. |
index | 0 | 0-based global offset in the flattened runtime list — wrappers and their children share consecutive indices | Stable address for tooling iterating over the YAML output. Do NOT mix with failure_summary.step_number (per-flow, 1-based). |
path | [2, 1] | The same descent as position, but as a structured 0-based array (one less than each position segment — so "3.2" is [2, 1]). Matches state.nextStepIndex directly. | Programmatic walks (compare segment-by-segment, slice off the tail). Convert to a position string by adding 1 to each segment and joining with .. |
isCursor | true / false | Marks the entry the live cursor currently points at | The step run-step will execute when called with no step_id. |
run-step and run-to-step accept any of: the canonical step id,
the 1-based position (bare integer like "14" or dot-notation like
"3.2"), the synthetic <flow-id>:<idx> fallback id, or even the
0-based index rendered as a 1-based position (String(index + 1)).
Pass whichever the previous output handed you — no translation needed.
Nested dot-notation requires a wrapper. "3.2" only resolves when
step 3 is a step-group or reusable-flow wrapper (i.e. an entry with
nested children expanded inline beneath it). For a leaf step, only the
bare "3" form works — "3.1" will fail with "no group or flow at 3"
because step 3 has no children to descend into. Use list-steps to
see the actual position field for the step you want.
position, path, isCursor are always populated, even when
state.json hasn't been seeded or its tree drifted from the
snapshot — list-steps falls back to a flat 1-based position so the
field is never useful-but-missing, and isCursor falls back to
session.currentStepIndex so the cursor marker is always visible.
mabl auth login --auto # one-time OAuth in browser
mabl auth info # check current auth
Live sessions re-fetch credentials from the API on every run-step so
the in-memory execution context always has fresh values; the resolved
values also end up in ~/.mabl/debug/<sid>/session.json's variable
namespace once a step that uses them has run. The directory shares the
same trust boundary as the detached Chrome's userDataDir (cookies,
localStorage, in-flight sessions) — don't share it.
If your token expires, run-step tells you to re-login.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub mablhq/skills --plugin mabl9 skills in this plugin
/mabl-initOne-time project setup for mabl. Discover this user's mabl workspace,
applications, environments, and credentials over the mabl MCP server, then
save everything an AI agent needs to create and run mabl cloud tests where the
user wants it — an agent memory file (CLAUDE.md / AGENTS.md /
.github/copilot-instructions.md), a rule, or a skill.
Fire when the user says "set up mabl", "mabl init", "initialize mabl",
"configure mabl for this project", "save my mabl workspace / application /
environment / credentials", "add mabl to my CLAUDE.md", or "/mabl-init".
Run this once per project, before authoring or running tests. For creating a
single test use mabl-test-authoring; for a whole suite use
mabl-test-coverage-design.
/mabl-playwright-exportTurn a mabl browser test into a Playwright spec that runs in the user's own
Playwright project. The mabl CLI translates the test step by step, choosing
locators from what mabl learned about the page; this skill then fits the
file to the project (config, login, credentials, shared flows), writes the
steps the CLI could not translate where Playwright can express them, and
runs the spec locally, repairing failures until it passes or it can say why
not. The spec runs on this machine, not in the mabl cloud.
Fire when the user wants a mabl test "in Playwright", asks to "export",
"convert" or "migrate" a mabl test or plan to Playwright, or wants mabl
coverage in their own Playwright suite, with a test id (`*-j`), several, or
a plan, or to pick up an export left unfinished. Browser tests only.
To CREATE a mabl test use mabl-test-authoring; to debug a FAILING mabl run
use mabl-debug.
/mabl-test-authoringCreate a SINGLE mabl browser or API test through conversational planning
and cloud authoring. Plan one test with an AI agent, refine the plan
iteratively, initiate cloud (or local) test generation, then validate that
the test it built actually matches what you asked for and fix it if not.
Fire when the user wants to create one mabl test, asks to "plan a test",
"create a test for <one scenario>", "generate a mabl test", "author a
test", or mentions testing a single URL / ticket with mabl.
For broad coverage of a whole feature / page / flow with MULTIPLE tests,
use mabl-test-coverage-design instead — it explores the feature, designs
the suite, and calls THIS skill once per test.
/mabl-test-coverage-designUse when asked to create MULTIPLE mabl tests / a whole suite for a feature area — "add mabl coverage for X", "cover the X page/feature with mabl tests", "design a mabl test suite for X", "let's create tests for X", "explore X and create tests", or "/mabl-test-coverage-design". For testing a page, screen, form, flow, or feature broadly, not one specific scenario. This skill explores the feature, designs the set of tests, then authors each one in the mabl cloud. For a SINGLE test, use mabl-test-authoring directly.
/mabl-test-editChange a mabl test that already exists — rename it, relabel it,
enable/disable it, or edit its steps (replace, insert, delete, move). Reads the
test, then routes to the cheapest lane that can make the change
deterministically — a live browser agent only when it needs the running app.
Fire when the user names an existing test (a `*-j` id or a test name) and wants
to modify it: "rename this test", "add a label", "disable that test", "delete
step 7", "make step 4 wait for the spinner to disappear", "change the URL that
step 2 opens".
For CREATING a new test use mabl-test-authoring; for debugging a FAILING test
use mabl-debug.
One boundary: if the test was just authored this session and its validation
found a gap, mabl-test-authoring's validate-and-fix step owns that decision —
it holds the authoring intent and the rule against converging by deleting
coverage. Don't take the decision over. Do accept the specifiable fixes it
routes here: a structured step edit is instant and cannot delete anything.
/mabl-test-edit-verifyCERTIFIES an edit already made to a mabl test, without trusting the green
run. NOT for reporting what changed between two versions — that is
mabl-version-compare, which states the diff and leaves the verdict alone.
This one holds the intent and rules on it. Diffs against the version before
the change to catch a pass bought by deleting coverage, re-runs it
isolated on a branch when that version still needs a run, requires more than
one clean run for a flaky test, and reports verified / problem found /
can't verify / verified-but-not-green. Never edits, never merges.
Fire after a test was changed — by an agent, in the Trainer, by anyone — and
someone asks "did that actually fix it", "verify this fix", "is this branch
safe to merge", or whether the edits match the intent the editor was given:
"do these edits match what was asked", "did the agent do what I told it to".
Also fires on a handed-over branch carrying an edited test.
To make the edit use mabl-test-edit; to find what is wrong use mabl-debug.
Other plugins' skills for the same job