Skip to content
Documentation
Esc
↑↓navigate↵open⌘Jpreview
On this page

Set up a coding agent

Set up a coding agent to build, run, and share your mobile app on Limrun by itself.

Paste this prompt into your coding agent. The agent reads this page as Markdown and does the setup steps below by itself. It asks you for an API key when it needs one:

Set up Limrun for me. Fetch https://docs.limrun.com/agents/setup.md and follow it.

Set it up by hand

Install the lim CLI and the Limrun skills where your coding agent runs. The skills teach the agent the whole loop: build on a remote Mac, run the app on a cloud simulator, check the screen, and hand you a link to review.

Install the CLI

The CLI needs Node.js 20 LTS or newer. Install it with your package manager:

npm  install --global lim
pnpm add     --global lim
bun  add     --global lim

Set your API key

Create an API key at console.limrun.com/settings under API Keys, then export it in the shell your agent uses:

export LIM_API_KEY=lim_...

The CLI also reads LIM_API_KEY from a .env file in the working directory.

Install the Limrun skills

From your project root, install the skills:

lim skills install

The command fetches the latest skills from the public limrun-inc/skills repository and installs them into each agent’s native skills directory without prompting. By default it targets every agent that already has a skills directory, or all supported agents when none exists, and uses project scope. In project scope, the Bazel and Detox skills are included only when a scan of the folder finds matching clues; a global install includes every skill.

Narrow or change the install with these flags:

Flag What it does
--ref <version-or-sha> Install a skills release version, such as 0.1.17 or v0.1.17, or a full 40-character commit SHA. Branch names are not accepted.
--agents claude|cursor|codex Install for one agent. Repeat to pick several.
--skills <name> Install one skill, such as limrun-xcode. Repeat to pick several.
--scope project|global Install into the project (default) or into the agent’s global skills directory.
--keep-existing Leave existing skill directories that differ from the fetched version untouched instead of updating them.

Existing skill directories with different content are updated in place, so review the change in your version control diff.

To pin a skills release or commit:

lim skills install --ref 0.1.17
lim skills install --ref <full-commit-sha>

Without --ref, the command fetches main. The summary and JSON source.commit field report the resolved commit. Save it and use --ref to install the same source again, even if a release tag moves. Missing versions or commits fail without falling back to the latest skills. Use explicit --skills and --agents selections to keep the installed selection fixed across projects. --keep-existing can preserve local content that differs from the pinned source.

Ask for a change

Open the same project in the agent, then ask for the change you want and say that it should build and run the app on Limrun:

Update the onboarding screen, build the app with Limrun, run it on the remote simulator, and share the Console URL so I can review it.

What the agent does

The skills walk the agent through this loop. Each step links to the page that documents its commands in full.

  1. Build the app. lim xcode build . creates or reuses an Xcode sandbox, syncs the source to it, runs xcodebuild remotely, and streams the logs back. See Build with Xcode.
  2. Attach a simulator. lim ios create --attach --reuse-if-exists --label issue=<id> boots a simulator attached to the sandbox. The attach installs and launches the latest build, and every later successful build reinstalls it. With --reuse-if-exists, a rerun with the same labels lands on the same instance. See Run a simulator.
  3. Share the live view. Share the Console URL from the create output. The user opens it and signs in to watch and use the simulator. Creation opens the Console URL by default; use --no-open to skip it. With --json, creation returns consoleUrl without opening a browser. Signed stream URLs are omitted.
  4. Read the screen, then act. Before every tap, the agent reads lim ios element-tree and picks elements by accessibility ID instead of pixel coordinates. See Run a simulator.
  5. Record video for changes that involve motion, and attach it to the pull request. See Record a video.
  6. Share a preview link. A build with --upload <asset-name> lands in Asset Storage, and https://console.limrun.com/preview?asset=<asset-name>&platform=ios opens it in the console for members of your organization. See PR previews.
  7. Delete the instances when the work is done with lim ios delete and lim xcode delete.

Tips for agents

  • The element tree is big. Pipe lim ios element-tree --json through jq or grep so it does not fill the agent’s context window.
  • Read after the screen settles. After a tap that navigates or loads data, read with lim ios element-tree --wait-for-idle-timeout-ms 3000 so the tree doesn’t describe a screen mid-transition.
  • Branch on error codes. With --json, a failed device command prints {"error":{"code":...}} on stderr. When type fails with "written":"none", nothing was typed, so a retry can’t double the text. See Handle failed commands.
  • Build errors are the agent’s job. When lim xcode build fails, the agent reads the output, fixes the code, and rebuilds instead of handing the failure back to you.
  • Unknown bundle ID? Check the Xcode project, or run lim ios list-apps after a successful build.
  • Delete defaults to the last instance. Without an ID, lim ios delete removes the last iOS instance the CLI created in this workspace. If the agent created several, list them by label first with lim ios list --label-selector "issue=LIM-34".

Next steps

Last updated on