/muggle:muggle-test-feature-localfrom muggle
Runs real-browser E2E acceptance tests against localhost using Muggle Test's Electron browser. Handles email-gated flows (magic links, OTPs, 2FA) via managed login profiles with live inboxes. Captures screenshots and supports signup, checkout, form validation, and UI interactions.
Ships in muggle. 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.
Telemetry first step: see
_shared/telemetry-emit.md. UseskillName: "muggle-test-feature-local".
Running outside Claude Code (in Codex, for one)? Read
../_shared/host-tool-equivalents.mdfirst — it maps the tools and paths this skill names to your host's.
Goal: Run or generate an end-to-end test against a local URL using Muggle Test's Electron browser.
| Scope | MCP tools |
|---|---|
| Cloud (projects, cases, scripts, auth) | muggle-remote-* |
| Local (Electron run, results — the studio publishes during the run) | muggle-local-* |
| Create new entities (preview / create) | muggle-remote-project-create, muggle-remote-use-case-prompt-preview, muggle-remote-use-case-create-from-prompts, muggle-remote-test-case-generate-from-prompt, muggle-remote-test-case-create |
The local URL only changes where the browser opens; it does not change the remote project or test definitions.
Three gates apply, each per the standard procedure in preference-gates/README.md:
autoUseWorktree at pre-flight (see _shared/use-worktrees.md).autoRebase before any service starts — muggle-test-prepare syncs the checkout first — and again before Step 7 (Execute) when the base moved meanwhile, re-invoking muggle-test-prepare after that rebase so the dev server serves it. Stale code is never tested (see _shared/sync-branch-with-base.md).autoCleanup after the PR is merged (see _shared/post-merge-cleanup.md).Before the first run, once every question that run needs is answered (Step 3), invoke muggle-test-prepare from the checkout under test. Halt on what it surfaces — a checkout it cannot bring onto the latest base included.
Then read ~/.muggle-ai/e2e-instructions/<key>.md when it exists — this stack's recorded startup order, manual steps, and local gotchas. A gotcha listed there explains a symptom that would otherwise read as a failure. Absent is normal.
Every selection-based question MUST use the AskUserQuestion tool (or the platform's equivalent structured selection tool). Never ask the user to "reply with a number" in a plain text message — always present clickable options.
AskUserQuestion with labeled options the user can click.Gates run per preference-gates/README.md.
| Preference | Step | Decision it gates |
|---|---|---|
frontloadQuestions | every step | When the run asks: one up-front batch before the first long-running step, nothing after it (see frontloadQuestions.md) |
autoLogin | 1 | Reuse saved credentials when auth is required |
autoSelectProject | 2 | Reuse last-used Muggle Test project for this repo |
autoSelectLocalHost | 4 | Reuse last-used local dev server URL for this repo |
autoUseWorktree | 0 (pre-flight) | Isolate dev work in a worktree (see _shared/use-worktrees.md) |
autoRebase | 0 (pre-flight) | Rebase onto origin/<default> before Step 7 (Execute) (see _shared/sync-branch-with-base.md) |
showElectronBrowser | 7 | Show Electron browser window during local E2E tests |
openTestResultsAfterRun | 8 | Open results page on Muggle Test dashboard after run |
postPRVisualWalkthrough | 10 | Post visual walkthrough to PR after results |
autoCreatePR | 10 (if no PR) | Auto-create the PR when posting the walkthrough has no PR to target |
autoWatchPR | 10.5 (if a PR exists) | Start a muggle-pr-followup watcher on the PR after the run |
autoCleanup | post-merge | Run cleanup after the PR for this work is merged (see _shared/post-merge-cleanup.md) |
autoLogin)muggle-remote-auth-statusautoLogin (per preference-gates/README.md):
always → proceed with saved session.never → muggle-remote-auth-login with forceNewSession: true, then muggle-remote-auth-poll.ask → run Picker 1 from preference-gates/autoLogin.md via AskUserQuestion; map the answer back to one of the actions above.muggle-remote-auth-login then muggle-remote-auth-poll. Do not skip or assume auth.The per-repo project cache lives in ~/.muggle-ai/last-project.json, in the entry keyed on <cwd> (via the muggle-local-last-project-get / muggle-local-last-project-set MCP tools). Look for Muggle Test Last Project: id=… url=… name="…" in session context.
Gate autoSelectProject (per preference-gates/README.md). Cache: Muggle Test Last Project session line.
always + cache → use cached projectId, skip to use case selection. No cache → fall through to ask.never → full project list; skip Picker 2.ask → project list picker (see gate file for spec + Picker 2 override). Skip Picker 2 if "Create new project".Ask the user to pick project, use case, and test case (do not infer).
muggle-remote-project-listmuggle-remote-use-case-list (with projectId)muggle-remote-test-case-list-by-use-case (with useCaseId)Selection UI (mandatory): Every selection MUST use AskUserQuestion with clickable options. Never ask the user to "reply with the number" in plain text.
Project selection context: A project groups all your test results, use cases, and test scripts on the Muggle AI dashboard. Include the project URL in each option label so the user can identify the right one.
Prompt for projects: "Pick the project to group this test into:"
Relevance-first filtering (mandatory for project, use case, and test case lists):
AskUserQuestion, plus these fixed tail options:
AskUserQuestion call. Skip this option if the API returned zero rows.Create new — tools and flow (use these MCP tools; preview before persist):
projectName, description, and url (may be the local app URL, e.g. http://localhost:3999). Call muggle-remote-project-create. Use the returned projectId and continue.muggle-remote-use-case-prompt-preview with projectId, instruction — show preview; get confirmation via AskUserQuestion.muggle-remote-use-case-create-from-prompts with projectId and instructions: ["<the user's natural-language instruction>"] — persist. Use the created use case id and continue to test-case selection.useCaseId): User provides an instruction describing what to test.
muggle-remote-test-case-generate-from-prompt with projectId, useCaseId, instruction — preview only (server test-case prompt preview); show the returned draft(s); get confirmation via AskUserQuestion.muggle-remote-test-case-create, mapping preview fields into the required properties (title, description, goal, expectedResult, url, etc.). Then continue from section 5 with that testCaseId.description before the run, on a new case or an existing one (limits). Stated only in this chat, it does not reach the run.Ask first. Prepare's grant holds ports other sessions wait for, and its lease ends four minutes after the services come up with no run. So before invoking it, resolve every question asked on the way to the first run: Step 4's URL gate, Step 5's script choice (applied after Step 4a), and Step 7's showElectronBrowser gate. From prepare to the first execute call, ask nothing. Under frontloadQuestions=always — the default, so also when the key is absent — add to this batch every later gate that resolves to ask: Step 8's openTestResultsAfterRun, Step 10's postPRVisualWalkthrough and autoCreatePR, Step 10.5's autoWatchPR. Ask each one's Picker 1 here, never default it; nothing is asked after the first execute call.
Then invoke the muggle:muggle-test-prepare skill via the Skill tool from the checkout under test — every run, even when services look up. Live PIDs prove nothing about which code they serve: prepare syncs this checkout onto the latest base, starts sibling services from base checkouts on the latest default branch, and keeps a running service only when it still serves the right commit. It fast-exits when everything is proven. Once it reports ready, check its readiness table: this checkout's services must show this checkout as their Source at its current HEAD. Then proceed to Step 4.
This step is especially important when the user's app depends on sibling services (a backend API, an auth service, etc.) that may not be running yet. The prepare skill handles discovery, startup, and cleanup so this skill doesn't have to.
Compile-gate (do not skip) — after muggle-test-prepare reports ready, run the two-stage readiness probe per _shared/dev-server-readiness.md before dispatching any test. Halt on any failure it surfaces; do not dispatch against a broken bundle.
autoSelectLocalHost)Skill responsibilities (the rest is in preference-gates/autoSelectLocalHost.md):
Muggle Test Last Host: <url> session-context line, or muggle-local-last-host-get. Pass as {lastHost} substitution.lsof -iTCP -sTCP:LISTEN -nP | grep -E ':(3000|3001|4200|5173|8080)'. Pass as {suggestedHost}.muggle-local-last-host-set after the user picks (the gate file requires this on every pick).Gate autoSelectLocalHost per preference-gates/README.md + preference-gates/autoSelectLocalHost.md.
Remind them: local URL is only the execution target, not tied to cloud project config.
Before deciding the target's script, resolve its prerequisite chain from the backend test-plan graph and ensure every ancestor already has a ready script — generating any that don't, test-generation only, root-first. Follow _shared/test-case-chain-readiness.md.
muggle-remote-test-case-ancestors-get returns the chain; an orphan test case has no prerequisites — skip straight to Step 5. Do not infer parents from precondition text; the graph is authoritative.
muggle-remote-test-script-list with testCaseId and runEnvironmentType: "local" — this skill always replays against localhost, so resolve the local-lane script (the remote-lane script carries the deployed URL).
AskUserQuestion to present them as clickable options. Show: name, created/updated, step count per option. Include "Generate new script" as the last option.A test case whose local lane has records runs once per record (../_shared/dev-loop/run.md), so the pick sets only the mode: a script means replay, which replays each record's own script, and "Generate new script" means regen.
Run the shared loop in ../_shared/dev-loop/run.md: one run per record, freshSession, replay vs regen, actionScript as-is, timeoutMs, and failure interpretation.
Caller glue: mode is the path chosen in §5; localUrl from §4; cwd = the repo root, or the prepared worktree when one is in use.
showUi gated by showElectronBrowser)Resolve the showElectronBrowser gate first, then call muggle-local-execute-test-generation or muggle-local-execute-replay. Do not ask the user to re-approve the Electron launch itself — choosing this skill is the approval. That run-approval suppression does not extend to the gate below: when showElectronBrowser=ask you must still fire its picker.
Gate showElectronBrowser (per preference-gates/README.md). Reuse the choice within a session. The runner shows the browser by default, so treat showUi as a hide switch — include it only to turn the browser off:
always (show it) → omit showUi entirely — no showUi key in the call. Passing showUi: false here is a bug: it hides the browser the user wanted to watch.never (hide it) → pass showUi: false explicitly. Omitting showUi here is a bug: it falls back to the default (shown) and reveals the browser the user turned off.ask → you must call AskUserQuestion (Picker 1 from preference-gates/showElectronBrowser.md) before the execute call, then map the answer to the always/never action above. Do not decide for the user.So the execute call carries no showUi key for always, or showUi: false for never — never showUi: true.
viewUrl gated by openTestResultsAfterRun)The studio publishes every completed run — pass or fail — to the cloud during execution, so the run result already carries the cloud refs. Failed runs are published too, so reviewers get the per-step screenshots, not just a generic "failed" link.
../_shared/dev-loop/publish.md: viewUrl / cloudTestScriptId / cloudActionScriptId from muggle-local-run-result-get.openTestResultsAfterRun (per preference-gates/README.md):
always → open viewUrl automatically (open "<viewUrl>" on macOS or OS equivalent).never → print the URL only.ask → under frontloadQuestions=always, apply the answer Step 3's batch collected; otherwise run Picker 1 from preference-gates/openTestResultsAfterRun.md via AskUserQuestion. Map the answer back to one of the actions above.Read the run record per ../_shared/dev-loop/failures.md and failure interpretation — never diagnose from execute's stdout tail.
viewUrl from the run result.If the run's status is failed or any non-passing terminal state, route through _shared/debug-failed-run.md — mandatory; a failure is never reported without it. It gathers evidence (attempted steps + reasoning + screenshot), diagnoses via _shared/failure-mode-handling.md (§B replay / §C regen), shows the debug card, and presents the guaranteed selection in which "give feedback & rerun" is always offered and "skip" is never the default.
Pass it: the runId, the mode that failed (replay if the user picked an existing script in Step 5, else regen), testCaseId, projectId, and the local execution handle so a rerun re-enters the same path.
Skip only when the run passed cleanly — the debug path is by definition about failures.
This step is not an exit. Whatever the user picks — feedback, rerun, or skip — control returns to the reporting and walkthrough steps. A failed run is the highest-value walkthrough: a reviewer needs the screenshots of what broke far more than confirmation that a passing flow passed. Ending the turn inside this step with results unposted is what the walkthrough Stop gate blocks.
Fires after every Electron run, pass or fail. A run can technically pass while still containing steps the user would correct — a misclick, wrong element, or a summary that doesn't match intent. This is the user's chance to flag it before regeneration picks up elsewhere.
Skip if 9a already routed the user into muggle-feedback for this run. Under frontloadQuestions=always, print the question below as a report line with its path — /muggle-feedback <runId> — instead of asking. Otherwise ask via AskUserQuestion:
"Did the agent miss or do anything wrong on this run? Your feedback regenerates the affected scripts."
muggle-feedback via the Skill tool, passing the just-finished runId so the submit flow opens on this run's steps and summary.Non-blocking — one click to dismiss. Do not re-ask for the same runId within a session.
After reporting results:
postPRVisualWalkthrough. On skip → 10.5.gh pr view --json number,title,url 2>/dev/null — find the PR.autoCreatePR. On skip → 10.5.E2eReport — see ../muggle-pr-visual-walkthrough/e2e-report-assembly.md.../muggle-pr-visual-walkthrough/SKILL.md Mode A with the E2eReport.Once a PR exists for this work, offer to keep watching its review thread.
gh pr view --json number,title,url result from section 10 if available, else run it now. No PR (none exists, none created) → end.autoWatchPR with {pr} = <owner>/<repo>#<number>. On skip → end.muggle-pr-followup session slot and dispatch its loop per the stage-8 seeding in ../do/open-prs/forward.md (default slug <repo>-pr<number>).state.md's ## Pre-flight answers block from the context resolved this run — validation strategy, local URL, project, credentials, auth, working tree — per ../_shared/resolve-e2e-validation-context.md. Strategy = local-e2e for this local E2E run.The /mprfollowup shortcut starts the same watcher manually at any time.
echo "MUGGLE_WALKTHROUGH_SKIP: <reason>" rather than silence.execute's response stdout tail. Always call muggle-local-run-result-get first; classify only from its structured fields and (when present) the artifacts it names. The execute tail is an excerpt and routinely truncates the failure cause.muggle-remote-test-case-ancestors-get — never infer parents from precondition text. Generate any not-ready ancestor test-generation-only, root-first.muggle-feedback. Never silently end a run without giving the user a one-click path to flag what was wrong — under frontloadQuestions=always that path is a report line, not a question.../_shared/dev-loop/run.md — never hand-build actionScript; always pass timeoutMs.AskUserQuestion for every selection — project, use case, test case, script. Never ask the user to type a number.muggle-remote-use-case-prompt-preview, muggle-remote-test-case-generate-from-prompt) before persisting.muggle:muggle-pr-visual-walkthrough skill — never inline the walkthrough markdown or call gh pr comment directly from this skill.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub multiplex-ai/muggle-ai-works --plugin muggleai48 skills in this plugin
/mExplicit short alias for the `muggle` skill (router/menu). ONLY invoke when the user explicitly types `m` or `/m` — never auto-trigger from any other phrasing./mbtExplicit short alias for the `muggle-browser-task` skill. ONLY invoke when the user explicitly types `mbt` or `/mbt` — never auto-trigger from any other phrasing./mbugreportExplicit short alias for the `muggle-bug-report` skill. ONLY invoke when the user explicitly types `mbugreport` or `/mbugreport` — never auto-trigger from any other phrasing./mciExplicit short alias for the `muggle-ci-install` skill. ONLY invoke when the user explicitly types `mci` or `/mci` — never auto-trigger from any other phrasing./mcleanupExplicit short alias for the `muggle-cleanup` skill. ONLY invoke when the user explicitly types `mcleanup` or `/mcleanup` — never auto-trigger from any other phrasing./mdoExplicit short alias for the `muggle-do` skill. ONLY invoke when the user explicitly types `mdo` or `/mdo` — never auto-trigger from any other phrasing.Other plugins' skills for the same job