build-and-test

build-and-test is a command for coding agents from Lykhoyda/rn-dev-agent. It costs 31 tokens per session (982 once invoked), scanned C, original, MIT.

A build-and-test command for Expo and React Native mobile apps. It builds and installs the app on an iOS simulator or Android emulator, starts Metro, and tests a requested feature from start to finish.

In plain words
What is it for?
Use it to verify a mobile feature end to end on a simulator or emulator, either with a local build or an Expo Application Services build.
Why use it?
It brings building, device setup, installation, and feature testing into one defined process. It also checks that the intended device and app are being used.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the rn-dev-agent plugin — 11 skills, 16 commands, 5 agents, 6 hooks shipped together

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 commands/lykhoyda/rn-dev-agent/build-and-test
Clone the repo
git clone --depth 1 https://github.com/Lykhoyda/rn-dev-agent

Or install rn-dev-agent, the plugin that ships this one along with the rest of its 11 skills, 16 commands, 5 agents, 6 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for build-and-test

README.md
[![agentmods](https://agentmods.dev/badge/commands/lykhoyda/rn-dev-agent/build-and-test.svg)](https://agentmods.dev/commands/lykhoyda/rn-dev-agent/build-and-test)
Your own site
<a href="https://agentmods.dev/commands/lykhoyda/rn-dev-agent/build-and-test"><img src="https://agentmods.dev/badge/commands/lykhoyda/rn-dev-agent/build-and-test.svg" alt="Measured on agentmods" height="20"></a>
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 982 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00031 $0.00982
Opus 5 $0.00015 $0.00491
Sonnet 5 $0.00006 $0.00196
Haiku 4.5 $0.00003 $0.00098

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

Security

Grade C, and why

build-and-test scanned grade C with 1 finding 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 4d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

`trap 'rm -rf -- "$artifact_dir"' EXIT` in that same scope. Then run
packages/claude-plugin/commands/build-and-test.md · 77 lines

How it starts

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

Build the app and test this feature: $ARGUMENTS

Run the build + test protocol INLINE (parent session)

Important (GH #31): Do NOT spawn the rn-tester agent via the Task tool. MCP tools (cdp_*, device_*) are not available in spawned subagents. Execute the build + test protocol directly in this parent session.

Phase A — Build pre-flight (run in this session):

  1. Resolve session authority — call rn_session(action="status") and require the intended worktree, platform, exact UUID/serial, and app ID. device_list may diagnose available hardware but never selects the target.
  2. Check if app is already running — call passive cdp_status. If the session's exact signed target is connected and app.dev == true, skip to Phase B.
  3. Build / install (substitute <platform> with ios or android):
    • No --eas flag: after previewing and confirming the session integration, run literal pnpm ios or pnpm android. The adapter injects the exact device and allocated Metro port and records the build/install receipt. For Expo Android, continue to bind and report the exact adb serial: the adapter uniquely translates it to Expo's model/AVD display name only for --device, pins adb with ANDROID_SERIAL, and refuses EXPO_DEVICE_IDENTITY_MISMATCH before Expo on a missing, unauthorized, duplicate, foreign, or drifted mapping.
    • With --eas flag: enter one shell scope, create <artifact-dir> with artifact_dir=$(mktemp -d), and immediately register trap 'rm -rf -- "$artifact_dir"' EXIT in that same scope. Then run bash "$CLAUDE_PLUGIN_ROOT/scripts/eas_resolve_artifact.sh" "<platform>" "<profile>" "<artifact-dir>", parse a successful absolute artifact path, and run bash "$CLAUDE_PLUGIN_ROOT/scripts/expo_ensure_running.sh" "<platform>" --device-id "<device-id>" --artifact "<path>". Keep resolution and installation inside the trapped scope so every success or failure path cleans only that exact caller-owned directory after the install attempt.
  4. Start Metro only through the literal integrated package script; an ambient default-port Metro is diagnostic, not authoritative.
  5. Confirm CDP — call cdp_connect for the exact signed target, then passive cdp_status.

Phase B — Run the rn-tester protocol (load rn-testing skill):

Follow the same protocol as /rn-dev-agent:test-feature, INCLUDING its mandatory Step 0 — scan saved actions (/rn-dev-agent:list-learned-actions) and replay a matching flow BEFORE composing any device_* primitives — then environment check, understand the feature, plan, navigate, execute+verify, edge cases, generate persistent test.

Read the full file on GitHub · 77 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. 4d ago First seen · 77 lines · 31 tokens per session scan C 70f44f0cec2b

Subscribe to this mod's changes

build-and-test is a command published in the GitHub repository Lykhoyda/rn-dev-agent (11 stars, last pushed today), licensed MIT. It adds 31 tokens to every session and 982 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.