Skip to content

Commit 60b73dd

Browse files
committed
Add Claude Code plugin: the DeviceDeck MCP + authoring/triage/flows skills
Phase 3's first shell, and a thin one — it wraps the Phase 2 `devicedeck mcp` server, no new device logic. plugin.json registers the stdio server (devicedeck mcp) and carries a PostToolUse hook that turns the common failures (no server, device busy, driver-start crash) into an actionable message. Three skills auto-discover from skills/: authoring (drive a device by durable selector), triage (diagnose a failure from the device's own tree + screenshot), and flows (capture and replay Maestro flows). A marketplace.json makes the repo installable with `claude plugin marketplace add devicelab-dev/DeviceDeck`. Format modeled on the auto-mobile reference plugin (inline mcpServers, skills/ auto-discovery, mcp__devicedeck__* tool names) and checked against the docs. Submitting to a marketplace is a launch step; the plugin is ready for it.
1 parent 0b48f8e commit 60b73dd

6 files changed

Lines changed: 187 additions & 0 deletions

File tree

‎.claude-plugin/hooks.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"PostToolUse": [
3+
{
4+
"matcher": "mcp__devicedeck__*",
5+
"hooks": [
6+
{
7+
"type": "command",
8+
"command": "if echo \"$CLAUDE_TOOL_STDOUT\" | grep -qiE '(connection refused|dial tcp)'; then echo '{\"decision\":\"block\",\"reason\":\"No devicedeck server responded. Start it first: run `devicedeck serve` in a terminal, then retry.\"}'; elif echo \"$CLAUDE_TOOL_STDOUT\" | grep -qiE '(device busy|another client is driving)'; then echo '{\"decision\":\"block\",\"reason\":\"That device is already being driven by another tab or test run. Close it, or pick another device with list_devices.\"}'; elif echo \"$CLAUDE_TOOL_STDOUT\" | grep -qiE '(driver crashed on startup)'; then echo '{\"decision\":\"block\",\"reason\":\"The Android driver crashed on startup (a known transient dexopt race). Retry the launch; devicedeck retries the driver start itself.\"}'; fi"
9+
}
10+
]
11+
}
12+
]
13+
}

‎.claude-plugin/marketplace.json‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "devicedeck-marketplace",
3+
"owner": {
4+
"name": "DeviceLab",
5+
"url": "https://devicelab.dev"
6+
},
7+
"metadata": {
8+
"description": "DeviceDeck plugin for Claude Code — drive simulators and emulators, and author reviewable mobile tests.",
9+
"version": "1.0.0",
10+
"pluginRoot": "./"
11+
},
12+
"plugins": [
13+
{
14+
"name": "devicedeck",
15+
"source": "./",
16+
"description": "Drive iOS simulators and Android emulators as a real webpage; author reviewable, real-device-portable tests.",
17+
"version": "0.1.0",
18+
"author": { "name": "DeviceLab", "url": "https://devicelab.dev" },
19+
"homepage": "https://devicelab.dev",
20+
"repository": "https://github.com/devicelab-dev/DeviceDeck",
21+
"license": "Apache-2.0",
22+
"keywords": ["ios", "android", "simulator", "emulator", "automation", "testing", "mcp", "mobile", "maestro"],
23+
"category": "development",
24+
"tags": ["mobile-testing", "ios", "android", "ui-testing", "device-control", "mcp"],
25+
"strict": true
26+
}
27+
]
28+
}

‎.claude-plugin/plugin.json‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "devicedeck",
3+
"description": "Drive iOS simulators and Android emulators as a real webpage. An agent lists, boots, launches, inspects, taps, and screenshots devices, and authors reviewable tests that run unchanged on real hardware.",
4+
"version": "0.1.0",
5+
"author": {
6+
"name": "DeviceLab",
7+
"url": "https://devicelab.dev"
8+
},
9+
"homepage": "https://devicelab.dev",
10+
"repository": "https://github.com/devicelab-dev/DeviceDeck",
11+
"license": "Apache-2.0",
12+
"keywords": [
13+
"ios",
14+
"android",
15+
"simulator",
16+
"emulator",
17+
"automation",
18+
"testing",
19+
"mcp",
20+
"mobile",
21+
"maestro"
22+
],
23+
"hooks": "./hooks.json",
24+
"mcpServers": {
25+
"devicedeck": {
26+
"command": "devicedeck",
27+
"args": ["mcp"]
28+
}
29+
}
30+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: devicedeck-authoring
3+
description: Use when authoring a mobile UI test or flow against an iOS simulator or Android emulator through DeviceDeck — picking a device, launching an app fresh, and driving it by durable selector so the test is reviewable and runs on real hardware unchanged.
4+
metadata:
5+
short-description: Author a reviewable mobile UI test with DeviceDeck
6+
---
7+
8+
# Authoring mobile tests with DeviceDeck
9+
10+
DeviceDeck mirrors a simulator/emulator's native UI tree as real DOM, so you drive it
11+
by accessibility identifier — a durable selector, never a coordinate. What you author
12+
here runs unchanged on real hardware (that is the whole point).
13+
14+
**Prerequisite:** a `devicedeck serve` is running (default `http://127.0.0.1:8787`). If a
15+
tool reports a connection error, start it in a terminal first.
16+
17+
## Workflow
18+
19+
1. **Find a device** — `mcp__devicedeck__list_devices`. Note the `udid` (iOS) or serial (Android).
20+
2. **Boot it if needed** — `mcp__devicedeck__boot_device`.
21+
3. **Launch the app fresh** — `mcp__devicedeck__launch_app` with the bundle id / package. It
22+
wipes app data by default, starting at a first-run screen (pass `fresh: false` to resume).
23+
4. **See what's on screen** — `mcp__devicedeck__ui_tree` for structure, or
24+
`mcp__devicedeck__screenshot` when you need pixels. Choose elements by their `identifier`.
25+
5. **Act by selector** — `mcp__devicedeck__tap` with the element's `testid`, and
26+
`mcp__devicedeck__assert_visible` (by testid or visible text) to check each step landed.
27+
6. **Type** — the MCP does not type (keeping it reliable). Get the page with
28+
`mcp__devicedeck__device_page_url`, open it with your browser tools (Playwright/Puppeteer),
29+
and `fill()`/type there — they verify each keystroke against the device's read-back.
30+
7. **Emit the test** — write it in the caller's framework using the same `data-testid` selectors
31+
(`getByTestId('login-button')`). Assert against the device tree, not a guess.
32+
33+
## Rules that keep a test durable
34+
35+
- **Selectors, never coordinates.** Tap and assert by identifier; a captured flow that used
36+
pixels reviews as noise and breaks on the first layout change.
37+
- **Wait for the device to echo a typed value before submitting.** Keys land a moment after the
38+
DOM has them; a submit fired too early acts on a half-typed form.
39+
- **Reset between independent tests.** A native app stays logged in across relaunch; `launch_app`
40+
fresh (the default) is the clean slate.
41+
- **One driver per device.** A device serves one client at a time; run with a single worker.

‎skills/devicedeck-flows/SKILL.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: devicedeck-flows
3+
description: Use when working with DeviceDeck Flow Capture — recording a manual session on a simulator/emulator into a Maestro flow with durable selectors, or replaying a captured flow so it runs unchanged on real hardware.
4+
metadata:
5+
short-description: Capture and replay DeviceDeck Maestro flows
6+
---
7+
8+
# Flow Capture and replay
9+
10+
DeviceDeck's differentiator: record a manual session and it becomes a **Maestro flow with durable
11+
selectors** (accessibility identifiers, never coordinates), so the same flow replays on real
12+
hardware — the funnel from "I did this by hand" to "this is a test" with no rewrite.
13+
14+
## Capturing
15+
16+
Recording is driven from the console UI (open `http://127.0.0.1:8787`, pick a device, **Record**),
17+
not from an MCP tool. While recording:
18+
19+
- Every tap resolves to a durable `tapOn: id="..."` selector. A tap that resolves to nothing
20+
addressable is refused rather than recorded as a coordinate — do not force it; find the
21+
element that carries the identifier.
22+
- Arm **Assert** to record an assertion instead of a tap (the next tap becomes `assertVisible`).
23+
- The output is a YAML flow under `examples/captured/`.
24+
25+
## Replaying
26+
27+
A captured flow is a stock Maestro flow — replay it through the `devicelab` driver:
28+
29+
```
30+
maestro-runner --driver devicelab <flow.yaml>
31+
```
32+
33+
For a sustained replay (a soak test), use `scripts/flow-gate.sh <flow.yaml> <count> <udid>`, which
34+
batches runs under the simulator's render-server crash ceiling and resets the CoreSimulator
35+
subsystem between batches.
36+
37+
## The contract
38+
39+
A captured flow must run **unchanged** on devicelab.dev real devices — identical format, same
40+
selectors. If a flow needs editing to replay elsewhere, the selectors were not durable: re-capture
41+
against elements that carry accessibility identifiers.

‎skills/devicedeck-triage/SKILL.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: devicedeck-triage
3+
description: Use when a mobile test driven through DeviceDeck failed or is behaving unexpectedly — to see the device's actual state, confirm what is and is not on screen, and classify the failure with evidence rather than guessing.
4+
metadata:
5+
short-description: Diagnose a failing DeviceDeck mobile test
6+
---
7+
8+
# Triaging a failing mobile test
9+
10+
Decide from the device's own state, not from the test log alone. DeviceDeck exposes both the
11+
structure and the pixels.
12+
13+
## Workflow
14+
15+
1. **Reproduce to the failing point**, then look before concluding:
16+
- `mcp__devicedeck__ui_tree` — the exact elements on screen, with identifiers and values.
17+
- `mcp__devicedeck__screenshot` — the rendered screen, for anything structure can't show
18+
(a spinner, a rendered image, an off-screen layout).
19+
2. **Confirm the expectation** — `mcp__devicedeck__assert_visible` for the element or text the
20+
test waited on. "Not visible" tells you the app never reached that state; "visible" points at
21+
a timing or selector problem instead.
22+
3. **Classify:**
23+
- *App never advanced* — a control was disabled, or a previous step's input did not land
24+
(check the field's `value` in the tree — is it what the test typed?).
25+
- *Element not found* — a selector that no longer resolves (identifier changed, or the wrong
26+
screen), or, on Android, an intermittent driver-start crash (retry the launch).
27+
- *Wrong screen* — the app resumed a logged-in session; relaunch fresh with `launch_app`.
28+
- *Timing* — the value is right on the device but the test asserted too early; wait for the
29+
device to echo it.
30+
31+
## Report
32+
33+
State the failure with the evidence that decided it — the tree fragment or screenshot, the
34+
assertion result, the field value seen — so the fix targets the real cause, not a symptom.

0 commit comments

Comments
 (0)