/rudder-core:rudder-setupfrom rudder-core
Guides a user from zero analytics to sending a real RudderStack event to a chosen destination, with the pipeline stored as rudder-cli specs in git.
Ships in rudder-core. 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.
Done means one real event reached the destination the user chose. The app sends it, or curl does when there is no app here. The destination's delivery count proves it, and so does the payload at the destination when the user can read it there. The pipeline exists as specs in rudder/ and every change is committed, so git revert followed by rudder-cli apply undoes it. The user makes three decisions: the plan (what to learn and which events), where events go, and whether to apply the specs.
rudder-cli --version. If missing, install with d=$(mktemp -d) && curl -fsSL https://github.com/rudderlabs/rudder-iac/releases/latest/download/install.sh -o "$d/install.sh" && sh "$d/install.sh". The command downloads the installer into a new temporary folder, then runs that file; do not pipe it into a shell. It is the installer attached to the latest rudder-iac release. It installs that release's archive for this OS and CPU in ~/.local/bin, after checking it against the release's checksums file. If a plain rudder-cli then runs another copy or none, follow the full-path rule under Rules that hold in every step. If the download of the installer prints The requested URL returned error: 404, a release came out in the last few minutes and its files are still uploading. Wait one minute and run the same command again, up to 10 times. Go by that message, not by curl's exit code, which is 22 or 56 for the same 404. If the last try also gets a 404, tell the user that a new rudder-cli release is being published and that they can try again in a few minutes, and stop. A line that starts with rudder-cli install: comes from the installer, which ran and failed; that is not the 404 above, even when a curl message comes before it, so do not retry. If curl cannot reach github.com, or the installer says it cannot write to ~/.local/bin, the agent's sandbox is the likely cause. Ask the user to let the command run outside the sandbox or to run it in their own terminal, and never set RUDDER_CLI_INSTALL_DIR to a folder inside the project. For any other rudder-cli install: line, show it to the user and stop. This skill needs the first rudder-cli release that contains rudder-iac#989 (docs destination) and #990 (validate's destination/secret-reference warning). Step 1 checks for both features, not for a version, because a build from source reports 0.0.0 (fact cli-features). A rudder-cli that has them also has step 7's sources listen.git --version.jq --version. Steps 3 and 7 run the jq programs shipped with this skill. If jq is missing, ask the user to install it, for example with brew install jq or sudo apt-get install jq.user_details: it sends the token in RUDDERSTACK_ACCESS_TOKEN and reads the workspace from its X-Workspace-ID header.rudder-cli auth login. rudder-cli workspace info --json succeeds when rudder-cli has one. The user creates one on Get started or in Settings, Access tokens. It is for rudder-cli only; MCP signs in separately. Never ask the user to paste it into chat, and never echo it.Step N of 9 · <title>, so the user can follow along.command -v rudder-cli. If it prints nothing, or a path other than $HOME/.local/bin/rudder-cli, a plain rudder-cli does not run the copy you installed. Then, for the rest of the session, run "$HOME/.local/bin/rudder-cli" wherever this skill or its references say rudder-cli in a command, probes and recipes included. Do the same when step 1 settles on a copy that an earlier install left in ~/.local/bin. Tell the user once that you run rudder-cli by its full path. When you ask the user to run a rudder-cli command, such as rudder-cli auth login, give it with the full path as well. Do not ask them to edit a shell profile or to restart you for this. Step 9's summary gives them the export PATH line, and so does your last message whenever you stop before step 9. allowed-tools does not cover the full path, so the user may be asked to approve those calls.work_dir, the folder step 1 settles on. Never run git init in the home folder or in a folder that holds several repositories.rudder/. Pass -l rudder to every validate and apply. Never pass -l . in an app repository. The CLI parses every YAML file under the location, so a CI workflow file fails validation.rudder-cli apply -l rudder --confirm=false, because without a terminal the default asks, declines on its own, and still exits 0.Removed resources:. Apply deletes every CLI-managed resource in the workspace that is missing from rudder/, including resources another project created. The one exception is step 9's undo, which runs only when the user asks for it, removes what this workflow created and checks each removal first.validate, apply and apply --dry-run as { <command> 2>&1; echo "exit $?"; } | awk '/^ +\|$/{g=1;next} g&&/^ +[0-9]+ \| /{h=1} {g=0} h{if(/^ +\| \^+$/)h=0;next} 1' | grep -E '^(Workspace|Error|Warning|Info): |^(error|warning)\[|^ *--> |^Found [0-9]+ error|^[A-Z][a-z]+ resources:$|^Always re-applied|^ ( )?- |^No changes|^(✔|x) |^exit [0-9]+$'. Each prints its warnings and errors with the line of the spec they are about, after secrets are filled in, and a value with line breaks, such as a key file, runs on over the lines after it. The awk program drops each message's source block, from the empty gutter line through the ^^^ line under it, whatever the value's lines hold. The grep then keeps only the workspace, the messages and where they point, the plan, each change's result and the exit status. Step 5 narrows validate's output further, to its error lines.rudder/secrets.vars.yaml (git-ignored) and are referenced in single quotes, '{{ .NAME }}', because the value is pasted in before the YAML is parsed. Never put a secret in a spec, a commit, a command line or the chat.git add <paths>, then git commit -m "<message>" -- <paths> with the same paths, so none of the user's own work goes into the commit or into step 9's undo, not even changes they staged themselves. Never use git add -A, git add . or git commit -a. The one exception is step 1's baseline commit of an app that was not in git.fix_commits. Right after each commit, record it for step 9's undo with sh '<skill folder>/references/run-record.sh' commit revert, or with commit keep when the undo must never revert it: step 1's commits of .gitignore lines and of the specs it found, and step 6's .gitignore line for an iOS app.allowed-tools pre-approves single commands such as rudder-cli, git, grep, jq and curl. It does not cover the step 1 and step 2 probes, run-record.sh, the step 7 recipes and step 8's probe and send, which are multi-line shell scripts, or a mobile app's build tools (./gradlew, adb, xcodebuild, xcrun, pod, flutter), so the user is asked to approve each one. Tell the user before the first.Stop and wait for an explicit yes at these gates: step 3 (Goal and plan), step 5 (Plan and apply).
RUDDERSTACK_ACCESS_TOKEN or rudder-cli auth login and is for rudder-cli. Never echo it, write it to a file or ask the user to paste it into chat. Never write it into an MCP configuration either: MCP signs in through the browser, and a /bearer-auth-mcp server the user set up reads the token from RUDDERSTACK_ACCESS_TOKEN itself.rudder/secrets.vars.yaml, which step 1 git-ignores. Confirm with git check-ignore rudder/secrets.vars.yaml before writing a value..env.local (git-ignored) and in the app's runtime config, or in rudder/first-event.vars.yaml (git-ignored) when the user keeps an app on its old source (step 6). An iOS app also keeps it in RudderStack.local.xcconfig, which step 6 git-ignores. A site without a build keeps it in its committed page. That is safe, because every visitor's browser receives a web source's write key anyway (browser instrumentation reference). Print at most its first 6 characters.git diff --cached -- <paths> with the paths you commit and make sure no token, write key or secret is staged, other than the write key in such a page.references/found-types.sh (step 2) is a shell probe, references/run-record.sh keeps what step 9's undo reads (steps 1, 5, 6 and 9), and references/plan-table.jq (step 3) and references/check-events.jq (step 7) are jq programs. Run them unchanged from work_dir, by their path in this skill's folder. Never copy, edit or rewrite them, and write no jq of your own for what they do.rudder-setup/references/check-events.jq under the project's .agents/skills, .claude/skills and .cursor/skills, then under ~/.claude/plugins, ~/.claude/skills, ~/.agents/skills, ~/.codex/plugins, ~/.codex/skills and ~/.cursor/skills. Plugin caches keep one copy per version, so if several turn up, use the most recently modified (ls -t).what-sends in place of its probe and asks whether the app already sends events to RudderStack in place of its SDK list, step 3 shows rudder/plan.events.json as it is, step 7 is skipped, and no run record is kept, so step 9 lists the commits for the user to revert and runs no undo.Measured, not guessed. Plan around them. They are in references/facts.md, each under its id, and a step cites one as (fact ). Read that file before step 1.
More than one step asks these. Ask them as written here.
what-sendsAsk the user: "What will send events to RudderStack?"
rudder-cli docs source --json lists, in words, such as "A website or web app (javascript)">Then:
rudder-cli docs source --json. Each entry's type is a value a source spec's type accepts, and token is how it connects to a destination. A type whose token is cloud is a backend language; every other type is a client. Offer one option per client type, described in words (fact source-type), except the legacy android and ios and the cordova type that fact advises against, then the last three options. A client answer's type is source_type.token is cloud. A language not among them follows the note for something else.unity), takes that type. A language with no source type, such as Elixir, has no RudderStack SDK either. Say so, and use the server type the user picks, or node if they have no preference, because every server type connects as cloud (fact connection-mode). Set sender to curl: the HTTP API takes events for any source (fact http-api-any-source).source_type is javascript and sender is curl. Step 6 then installs no SDK, and step 8 sends the first planned event with curl.| # | Step | Who | After |
|---|---|---|---|
| 1 | Start | you, cli, skill, mcp | start |
| 2 | Explore | you, skill, mcp, cli | 1 |
| 3 | Goal and plan | you, skill | 2 |
| 4 | Destination and secrets | you, skill, cli | 2 |
| 5 | Plan and apply | cli, you | 4 |
| 6 | Instrument | skill, mcp | 3, 5 |
| 7 | Verify locally | cli, you | 6 |
| 8 | Verify live | cli, mcp, you | 7 |
| 9 | Wrap up | skill, cli | 8 |
Who: you the user answers or approves; skill this workflow, followed by the agent; cli rudder-cli; mcp the rudderstack MCP server.
Keep these values as you go, and restate them in the wrap-up:
dir_kind: what the folder you were started in is: app, resume, empty, home, repos or other, from step 1's first probegit_state: clean, dirty or none (not in git), from step 1's second probecli_features: ok, missing, no-docs or no-secret-check, from step 1's third probework_dir: the folder you work in: the one you were started in, or ./rudderstack-first-event when step 1 creates itsender: app when the app's code sends the events; curl when there is no app here, or no SDK for it, and step 8 sends the first planned event with curlworkspace_id: from rudder-cli workspace info --json, field workspaceIDworkspace_name: field name of the same outputdata_plane_url: field dataPlaneURL of the same outputfound_types: the source types step 2's probe found, joined with + when there are several (android_kotlin+javascript); none when it found nothing it knowsapp_kind: browser, server or mobile, and the frameworksource_type: the event stream source's type (fact source-type)source_id: the spec id of the event stream source, for example storefrontevents: rudder/plan.events.json, the agreed event names with their property types; the only place either is writtenplan: rudder/plan.md, the question and where each event fires, keyed by event name, committed with the specsdestination_type: the destination's type, as rudder-cli docs destination lists itdestination_id: the spec id of the destination, lowercase kebab-case starting with a letterspecs_commit: the commit that added the specsremote_source_id: the source's id in RudderStack, from MCP list_sourcesremote_destination_id: the destination's id in RudderStack, from MCP list_destinationswrite_key: the source's write key. Show only its first 6 characters.code_commit: the commit that added the instrumentationfix_commits: the commits that fixed the instrumentation after code_commit, in any step, if anystarted_at: RFC 3339 UTC time, rounded down to the minute, recorded just before the first live send, and again before each retry in step 8Find out where you are, then confirm the tools, the token, MCP and the workspace, before changing anything.
Run these first, as written. Each prints one word; keep it as the value it names.
dir_kind: what this folder is. app and resume (rudder/ already holds specs) are places to work. A Unity project is app, and so is a repository whose top holds no app manifest but whose subfolders do, one or two levels down (a monorepo). home (the home folder), repos (several repositories and no app manifest at the top), other (files, but no app manifest) and empty are not an app.
app() { find . -mindepth "$1" -maxdepth "$1" \( -name package.json -o -name pubspec.yaml -o -name Package.swift -o -name Podfile -o -name 'build.gradle*' -o -name 'settings.gradle*' -o -name pom.xml -o -name pyproject.toml -o -name 'requirements*.txt' -o -name Pipfile -o -name go.mod -o -name Gemfile -o -name composer.json -o -name Cargo.toml -o -name '*.xcodeproj' -o -name '*.xcworkspace' -o -name '*.csproj' -o -name '*.sln' \) 2>/dev/null | grep -q .; }
if [ "$PWD" = "$HOME" ]; then echo home
elif find rudder -name '*.yaml' ! -name '*.vars.yaml' 2>/dev/null | grep -q .; then echo resume
elif app 1 || [ -f ProjectSettings/ProjectVersion.txt ]; then echo app
elif [ "$(find . -mindepth 2 -maxdepth 2 -name .git | wc -l)" -ge 2 ]; then echo repos
elif [ -e .git ] && { app 2 || app 3; }; then echo app
elif find . -mindepth 1 -maxdepth 1 ! -name .git ! -name .gitignore ! -name .DS_Store ! -name rudder ! -name .claude ! -name .agents ! -name .cursor ! -name .codex ! -name .mcp.json ! -name AGENTS.md ! -name CLAUDE.md | grep -q .; then echo other
else echo empty; fi
git_state: clean, dirty or none (not in git). dirty means uncommitted changes in work_dir outside rudder/ and agent files, or in a file that sits directly in a folder above work_dir or in that folder's gradle/. Those hold the lockfile that step 6's install changes in an npm, yarn or pnpm workspace, and a Gradle build's version catalog.
changes() { git status --porcelain -- . ':!rudder' ':!.claude' ':!.agents' ':!.cursor' ':!.codex' ':!.mcp.json' ':!AGENTS.md' ':!CLAUDE.md'; (while [ -n "$(git rev-parse --show-prefix)" ] && cd -P ..; do git status --porcelain -- ':(glob)*' ':(glob)gradle/*' ':!.mcp.json' ':!AGENTS.md' ':!CLAUDE.md'; done); }
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo none
elif changes | grep -q .; then echo dirty
else echo clean; fi
cli_features: whether the installed rudder-cli has what step 4 needs (fact cli-features): ok; missing (no rudder-cli or no jq); no-docs (no docs destination, rudder-iac#989); no-secret-check (validate has no destination/secret-reference warning, rudder-iac#990). It validates a throwaway destination spec with a literal secret in a temporary folder, which needs no token, with telemetry off so the check does not count as a use, and then deletes it.
d=$(mktemp -d); f="$d/check.yaml"
if ! command -v rudder-cli >/dev/null || ! command -v jq >/dev/null; then echo missing
elif RUDDERSTACK_CLI_TELEMETRY_DISABLED=true rudder-cli docs destination am --source javascript --id cli-check --json 2>/dev/null | jq -r '.specTemplate // empty' 2>/dev/null | sed "s/'{{ .*}}'/not-a-reference/" > "$f"; ! grep -q not-a-reference "$f"; then echo no-docs
elif RUDDERSTACK_CLI_TELEMETRY_DISABLED=true rudder-cli validate -l "$d" 2>&1 | grep -q '\[destination/secret-reference\]'; then echo ok; else echo no-secret-check; fi
rm -f "$f"; rmdir "$d"
cli_features, and go on only on ok. If it is not ok and $HOME/.local/bin/rudder-cli exists, an earlier install may have left that copy off PATH or behind another one, so first run the probe again with that full path. If it then prints ok, follow the full-path rule under Rules that hold in every step and go on. Otherwise go on with the plain probe's result. On missing, install what command -v does not find (rudder-cli with the two-step command under Before you start, jq as it says there). On no-docs or no-secret-check, say that this rudder-cli lacks docs destination or validate's destination/secret-reference warning, which this skill needs: the first release with rudder-iac#989 and #990. Show rudder-cli --version and command -v rudder-cli, and ask the user to install the latest release with the two-step command (or run it on a yes). After an install, follow that rule, then run the probe again, with the full path when the rule calls for it. If it prints no-docs or no-secret-check after you installed rudder-cli, the latest release does not have these features yet; say so and stop. Never write a destination spec from memory, a README, another skill or an older version of this one.rudder-cli workspace info --json. It finds the token in RUDDERSTACK_ACCESS_TOKEN or in the config that rudder-cli auth login writes, and never prints it. Tell the user the workspace name you are about to change. If dataPlaneURL is empty, ask the user for the data plane URL shown in the RudderStack dashboard and keep it as data_plane_url.user_details. It answers only when the rudderstack server is connected and signed in. A server at /bearer-auth-mcp has no user_details: when your RudderStack tools include list_sources but not user_details, call get_workspace_settings instead, which answers only when that server's token reaches its workspace.workspace_id argument, pass the CLI's workspaceID in it on every call. Otherwise compare selectedWorkspace.id from user_details with workspaceID from workspace info. If they differ, call user_switch_workspace with the CLI's workspace id and tell the user which workspace MCP now reads. On a /bearer-auth-mcp server the X-Workspace-ID header picks the workspace, and the tools take no workspace_id. If id from get_workspace_settings is not the CLI's workspaceID, ask the user to set that header to the CLI's workspaceID and start you again, and stop.dir_kind, then on git_state, with the branches below. If a branch moves you to another folder, run the git_state command again there. Unless a branch says otherwise, work_dir is the folder you were started in and sender is app.work_dir, create rudder/ if there is none, and start the run record for step 9's undo, sh '<skill folder>/references/run-record.sh' begin. It prints started <run> for a new run, or continued <run> with the workspace and commits of a run an earlier session stopped before step 9. After continued, tell the user that a setup here stopped before its summary, show those commits, and ask whether this is the same setup. If it is not, run it with close, then with begin again, so the undo keeps the two setups apart. If it says an undo is not finished, finish or end that undo first (step 9). Check that git ignores rudder/secrets.vars.yaml, rudder/first-event.vars.yaml and .env.local (git check-ignore -q <path>). If it does not ignore one of the two var files, add rudder/*.vars.yaml to .gitignore, and if it does not ignore .env.local, add .env.local, creating the file if needed. If that changed .gitignore, commit it alone, git add .gitignore && git commit -m "Ignore RudderStack secrets" -- .gitignore, and record it with commit keep (rule). Only step 6 touches .gitignore again, for an iOS app's key file and also in a commit of its own, so the undo in step 9 never un-ignores a secret.If dir_kind is empty, home, repos or other, so this folder is not an app:
other, look first. An app the probe does not know, such as a static site with an index.html or an Elixir app with a mix.exs, counts as app, and so does a folder whose subfolders hold an app; say so and go on as for an app.git_state is not none, this folder is inside a git repository. Name its top level (git rev-parse --show-toplevel). If the top level has an app manifest, say that it is probably the app and recommend starting there.cd into the app's folder, start the agent there, and run the same command or prompt that started this session. The first event then comes from the app's own code.empty folder, work in it, and run git init unless it is already inside a repository.home, repos or other, never run git init in the folder itself. Say that you will work in ./rudderstack-first-event, create it (an earlier run may have), run git init in it unless it has a .git, and set work_dir to it. From then on read, write and run everything inside it; start a shell call with cd rudderstack-first-event && when your shell does not keep the directory. If it already holds specs in rudder/, it is resume: follow that branch.git_state is not none), never create a repository in it, because the outer one records it as an embedded repository and a later git add -A there commits it as a gitlink. Ask the user for a folder outside any repository, and use it in place of ./rudderstack-first-event.what-sends, "What will send events to RudderStack?", as written under Shared questions, and follow its notes.sender to curl. There is no app here, so step 6 installs no SDK, step 7 is skipped, and step 8 sends the first planned event with curl (fact http-api-any-source).If git_state is dirty:
git_state command found: run its first line and then changes, in one shell call. It prints each path from the repository's top. Ask the user to commit or stash them and say continue, because this workflow commits its own changes, a workspace's lockfile above work_dir included, and a git revert must undo only those. Run the git_state command again, and go on only when it prints clean.If git_state is none and dir_kind is app or resume:
git revert of this workflow's commits would delete the app's files (fact first-commit-adds-whole-files).git init. Before staging anything, make sure .gitignore has rudder/*.vars.yaml and .env.local, so a filled var file or write key is never staged. If there is no .gitignore, create one with those lines, node_modules/, .env files, the build output folders (for example dist/ and build/) and the platform's own: .gradle/, local.properties, *.jks and *.keystore for Android, Pods/ and xcuserdata/ for iOS, .dart_tool/ for Flutter. Say so. Run git add -A and show git status --short. If a staged file looks like a secret (an .env file, a key or a credentials file), unstage it with git rm --cached and add it to .gitignore. Commit as "Baseline before RudderStack".If dir_kind is resume:
rudder/ already holds specs, from an earlier run here or copied from the folder where a first event was sent. Keep them. Never start again with an empty rudder/: its resources are CLI-managed now, and step 2's dry run would list them for removal (fact apply-scope).rudder/, keep the specs found there apart from this run's changes. If git_state is none, the baseline commit of the branch for an app not in git takes them with the app. Otherwise, if git_state is dirty, follow that branch first. Then do item 6, so git ignores the var file. If git status --porcelain -- rudder still lists anything and item 6's begin printed continued, those specs are this run's own, written before an earlier session stopped: commit them as step 5 does, git add rudder && git commit -m "Add RudderStack event delivery as specs" -- rudder, and record it with commit revert. If it printed started, commit them alone: git add rudder && git commit -m "Keep the RudderStack specs found in rudder/" -- rudder, and record it with commit keep (rule). Step 9's undo never reverts that commit, so it leaves the resources those specs manage alone, another project's included, and specs_commit holds only this run's changes.sender to curl.source_type as step 2 does, starting with its probe, and compare it with type: in rudder/sources/*.yaml. If they differ, say so and ask whether to add a source of the app's type. The CLI cannot change a source's type in place (fact source-type-fixed). On yes, leave the old source's spec and its connection as they are, because builds already shipped may still send with its write key. Beside them, add a source spec with a new id, name and the new type, a connection from it to the destination with a new id in rudder/connections.yaml, and the new type's connection_mode entry on the destination (fact connection-mode). A GA4 destination (type: ga4) sends to one data stream, a web data stream or a mobile app's data stream, and a mobile app's stream is that one app's, by its Firebase App ID. So the new source shares the destination only when its type replaces a legacy SDK's type on the same platform: android_kotlin for android, or ios_swift for ios. Otherwise leave the destination as it is, write a second GA4 destination for the new source as step 4 does, with a new id, the new app's own stream and secret names of its own, and connect the new source to it instead. Step 5's dry run then removes nothing, and step 9's undo removes only what this run added.'{{ .NAME }}' and rudder/secrets.vars.yaml is missing, as it is when rudder/ came through git or was copied without it, do item 6 first, so git ignores the file before it holds a value; in a folder not in git yet, the baseline branch adds that line before anything is staged. Then write the file with one NAME: line per secret and no value (fact unfilled-secret). Ask the user to fill every line in their editor, written as the destination reference says, and say continue, because step 2's dry run needs the values. Do not read them back.rudder/plan.events.json and ask whether to keep or change it, keep the destination unless the user wants another, and apply only what the dry run lists. Step 5 commits rudder/ as usual.If workspace info says an access token is required, or answers 401:
rudder-cli auth login in a terminal and say continue. Stop until then. If dir_kind is not app or resume, give the advice to start again in the app in the same message.If the rudderstack MCP tools are missing, or a call says the server needs authentication:
claude mcp list, which prints each server's name and URL. A RudderStack server can have any name; the rudder-core plugin's is plugin:rudder-core:rudderstack. If one points at https://mcp.rudderstack.com/mcp or https://mcp.rudderstack.com/bearer-auth-mcp, use it and add nothing. For /mcp, the user types /mcp, chooses it, enables it if it is disabled, chooses Authenticate, approves in the browser and says continue. A /bearer-auth-mcp server has no sign-in: it sends the token in RUDDERSTACK_ACCESS_TOKEN from the shell Claude Code was started from, and its X-Workspace-ID header names the workspace. Check the variable without printing it: test -n "${RUDDERSTACK_ACCESS_TOKEN:-}" && echo set || echo missing. If it is missing, ask the user to export it in that shell and start you again. Otherwise ask them to enable the server in /mcp if it is disabled and say continue. A 401 or 403 from it means the token expired or was revoked, or the header names a workspace the token cannot reach. Only if neither URL is listed, they run claude mcp add --scope user --transport http rudderstack https://mcp.rudderstack.com/mcp in a terminal, start Claude Code again and authenticate it the same way. User scope makes it load in every folder, including the app the user may restart in. In other agents, add an HTTP MCP server with that URL in the agent's MCP settings and sign in. It uses the user's RudderStack login, not the access token. Then begin again at this step; it is idempotent. If dir_kind is not app or resume, give the advice to start again in the app in the same message.If the CLI's workspace is not among the workspaces user_details lists, or user_switch_workspace says it is not found:
Facts that apply here (references/facts.md): cli-features, first-commit-adds-whole-files, source-type, source-type-fixed, http-api-any-source.
Done when:
[ -n "$(rudder-cli workspace info --json | jq -r '.workspaceID // empty')" ])rudder/ exists, and its var files and .env.local are git-ignored (check: test -d rudder && git check-ignore -q rudder/secrets.vars.yaml && git check-ignore -q rudder/first-event.vars.yaml && git check-ignore -q .env.local)rudder/ and agent files, or in the files above it that git_state reads (check: git rev-parse --is-inside-work-tree >/dev/null 2>&1 && ! { git status --porcelain -- . ':!rudder' ':!.claude' ':!.agents' ':!.cursor' ':!.codex' ':!.mcp.json' ':!AGENTS.md' ':!CLAUDE.md'; (while [ -n "$(git rev-parse --show-prefix)" ] && cd -P ..; do git status --porcelain -- ':(glob)*' ':(glob)gradle/*' ':!.mcp.json' ':!AGENTS.md' ':!CLAUDE.md'; done); } | grep -q .)Record: work_dir, sender, workspace_id, workspace_name, data_plane_url.
If it fails:
workspace info exits 1 with access token is required: this shell has no RUDDERSTACK_ACCESS_TOKEN and rudder-cli auth login was never run.Two questions. What is this app, and what does the workspace already hold?
Needs: dir_kind, sender.
Run these first, as written. Each prints one word; keep it as the value it names.
found_types: the source types the code here points to (fact source-type), joined with + when there are several, or none when it finds no app it knows. It looks four levels down, and its comments say what it checks, in order. Frameworks come first and claim the android/, ios/ and macos/ folders beside their manifest, and platforms/ for Cordova, so another app in the repository still counts. A server language counts only when it finds no client app.
sh '<skill folder>/references/found-types.sh'
--apps: sh '<skill folder>/references/found-types.sh' --apps. It prints one line per app it found, its type and its folder from work_dir, such as android_kotlin apps/consumer, with . for work_dir itself. When one Gradle build holds more than one Android app, each of their lines ends with the app's module, such as android_kotlin . :consumer. The folder is the Gradle build's, and the module's name goes wherever the Android references say the application module's name. Act on found_types and these lines with the branches below. source_type is the type of the one app, or of the app the user picks, unless a branch changes it (fact source-type). Then read the manifest and entry points of that app: package.json, the vite or next config and src/ for a browser app; the app module's build.gradle.kts and its Application class for Android; the Xcode project and the @main App or AppDelegate for iOS; pubspec.yaml and lib/main.dart for Flutter; package.json and App.tsx for React Native. Decide where the code runs, and the language of a native app: Kotlin or Java (the app module applies no Kotlin plugin), Swift or Objective-C.sh '<skill folder>/references/found-types.sh' --sdks '<its line from --apps>', such as --sdks 'android_kotlin . :consumer'. It prints each file and the SDK it names. It reads only the manifests of that app's type, in its folder, and leaves out the folders of the other apps and of a Node server, and in a Gradle build with several apps, the other apps' modules. When --apps printed nothing and the user's answer names an app type, use that type and .. The branches below then concern only the chosen app. Then search its code, its HTML pages included, for analytics loaded without a package: rudderanalytics and cdn.rudderlabs.com (RudderStack's JavaScript snippet), cdn.segment.com (Segment's), gtag(, mixpanel, amplitude and posthog. A RudderStack snippet counts as a RudderStack SDK in the branches below, so the user is asked before step 6 points it at the new source or adds another.list_sources (retl_type none), list_destinations and list_connections to see what the workspace holds.rudder-cli apply -l rudder --dry-run, adding --var-file rudder/secrets.vars.yaml when the file exists, with its output filtered (rule) and rudder/ still empty unless dir_kind is resume. Every line under Removed resources: is a CLI-managed resource that an apply from this project would delete, of any type (sources, destinations, tracking plans, transformations). No changes to apply means there are none.If sender is curl:
found_types, keep the source_type step 1 mapped from the user's answer, and propose a source name from what the user said will send events.If --apps printed more than one line, so there is more than one app here, of one type or of several, such as two Android apps, or android/ and web/:
--apps printed, with its folder and type>source_type is the type of the app the user picks. On something else, ask the shared question what-sends (under Shared questions) and follow its notes.If the app, the only one or the one the user picked, is in a subfolder of work_dir, so its --apps folder is not .:
.env.local and its install, build and start commands go in that folder. Run everything else from work_dir, where rudder/ is, including step 7's check and step 8's probe, and write <subfolder>/.env.local wherever a command or a done check reads or checks .env.local.If found_types is none, so there is code here but no app the probe knows:
mix.exs.what-sends, "What will send events to RudderStack?", as written under Shared questions, and follow its notes.If the SDK list, or the search after it, names a RudderStack SDK:
sender to curl: step 6 changes no code and leaves .env.local alone, and step 8 sends the first planned event with curl.com.rudderstack.android.sdk (Android, Java) and the Rudder pod or rudder-sdk-ios package (iOS, Objective-C) are the legacy SDKs, whose types are android and ios (fact source-type). For those, also ask whether to keep the legacy SDK with that type, or to move to the Kotlin or Swift SDK with android_kotlin or ios_swift.If the SDK list names a Segment SDK:
If that dry run lists Removed resources: with anything under it:
rudder/: step 5 would commit them with this project's specs, and step 9's undo, which reverts that commit and applies, would delete that project's resources too. rudder-cli import workspace cannot help either: it imports only resources no project manages, and refuses while a dry run lists removals.If source_type is not javascript:
android_kotlin and ios_swift, and the legacy android and ios, step 6 follows the Android or iOS instrumentation reference, in the app's language, and step 7 the local verification reference's part for mobile apps. For flutter, react_native and unity, step 6 follows the SDK's own documentation in the same shape; step 7 is skipped for unity. For a server app, step 6 adapts the SDK's documentation and step 7 starts the app with its own command. Ask before continuing.If the app has no package manager, as with a static site of HTML files:
npm run dev. Ask before continuing.Facts that apply here (references/facts.md): apply-scope, source-type.
Record: app_kind, source_type, source_id, sender.
Not in scope yet, mention as a next step if relevant:
One answer becomes a written plan, and the user agrees to it before anything is built.
Consult: rudder-instrumentation-planning.
Needs: sender.
rudder/plan.events.json, the only place event names and property types are written. Each event name maps to its properties, and each property to string, number, integer or boolean: {"Order Completed": {"order_id": "string", "total": "number"}}.rudder/plan.md: the question under ## Question, and under ## Where each event fires one line per event, - <Event Name>: <file and function>. Property names and types stay out of it. The CLI loads only YAML from rudder/, so neither file changes what apply does.jq -r --rawfile md rudder/plan.md -f '<skill folder>/references/plan-table.jq' rudder/plan.events.json. Then copy the table it printed, unchanged, into your message above the question. Some agents fold a command's output, so the user may not see the table otherwise.If sender is curl:
rudder/plan.events.json with curl, so put the one the user cares about most first.Loop. Apply the user's changes to rudder/plan.events.json (names and types) or rudder/plan.md (question and places), and render the table again until the user agrees to the plan, at most 5 attempts. When the bound is hit, keep the plan as it stands, list the changes still open, and ask whether to go ahead with it.
Gate. Ask "Is this the plan? Add, drop or change anything, or say go." Do not continue without an explicit yes.
Done when:
test -s rudder/plan.events.json && jq -e 'type == "object" and length > 0 and all(.[]; type == "object" and all(.[]; IN("string", "number", "integer", "boolean")))' rudder/plan.events.json)grep -q '^## Where each event fires' rudder/plan.md)Record: events, plan.
Not in scope yet, mention as a next step if relevant:
rudder/plan.events.json into a tracking plan (rudder-tracking-plans) so violations are caught in the pipeline.Visible choices, a spec built from what the installed rudder-cli accepts, and no secrets typed into chat.
destination_type: webhook, ga4, am or mp for the four named options. For something else, run rudder-cli docs destination --source <source_type> --json, which lists only the types that take events from this source, and match the user's words against each entry's type and displayName; ask when more than one matches. If none matches, say this workflow cannot connect that destination yet, and offer a webhook for the first event.destination_id to <source_id>-<destination_type> with every _ turned into -, such as storefront-webhook. Run rudder-cli docs destination <destination_type> --source <source_type> --id <destination_id> --json and keep its output for this step. It is the only place to read keys, allowed values, defaults, patterns, connection modes and secret keys (fact cli-features); write no key it does not list, and read it as the destination reference's "Reading the docs output" says. If it prints an error, act on error.code as that section says. If docs itself is unknown, go back to step 1's cli_features. If fields has a required rudder_account_id, the destination connects through a sign-in in the RudderStack dashboard (OAuth), which this workflow cannot do yet; say so and offer a webhook for the first event. If verified is false, say RudderStack has not finished verifying this destination in rudder-cli, so validate and apply accept it only with the variables under enable set. Ask whether to use it anyway or pick a verified type; if they keep it, set the enable variables on every validate and apply.specTemplate unchanged to rudder/destinations/<destination_id>.yaml. It holds enabled: true, every top-level key this type always requires, with a secret as its slot and any other key as null, the keys its connection mode requires, and the connection_mode entry, cloud when the source can use it. If it has no connection_mode entry, ask the user to pick one of the modes under connectionModes, add connection_mode: {<token>: <mode>} with the token named there, and add that mode's requiredKeys. If the template's entry, or the mode the user picks, is device, the app's SDK sends to this destination itself, so RudderStack reports no delivery for it and step 8 cannot confirm the first event; say so and offer a destination that takes cloud for the first event.null, one question at a time, reading the key's entry in fields as the destination reference's "Reading the docs output" says: offer only its enum values, and check a typed value against its pattern, bounds and type. For a webhook with no public URL, offer the destination reference's options: a quick tunnel to this machine, only where background processes outlive a shell call (fact background-processes), or a request bin. Say that either one passes every payload through a third party, Cloudflare or the bin's owner, and use the one the user picks. On a resume, a quick tunnel's URL in the spec no longer answers; start a new tunnel as the reference says and write its URL into the spec. If you stop before step 9, stop the tunnel first, as the reference says. For GA4, client_type follows the source type: on android_kotlin, ios_swift, flutter, react_native, unity, android or ios it is firebase with that app's Firebase App ID, because an app's events belong in its app data stream; on any other source it is gtag, a web data stream. Validate accepts either on any source, so it cannot catch a wrong one.fields has secret keys that nothing requires and the spec does not hold yet, ones with no required, requiredIf, requiredUnless, requiredWith or checkedBy, such as a webhook's header value, ask one question before writing any of them. Skip it for a webhook to a quick tunnel or a request bin, which needs no header. Name each in plain words, and offer "No" first, then one option per key, and let the user pick several. Add only the keys the user picks, as item 8 says. For a key inside a list item, write one item with the secret key's slot, and ask for the item's other key only, such as the header's name, Authorization unless the user names another; the secret's value goes in the var file, never in chat. A header's line in the var file holds the header's whole value, such as Bearer <token> for Authorization, or the key alone for a header such as X-Api-Key; say so when you ask the user to fill it.default unless the user wants another value.fields says secret: true. Its value is the field's slot, unchanged; under a list, <N> in slot and var is the item's zero-based index. Never write a value, a default ({{ .NAME | value }}) or a variable name of your own. Add an optional secret the user wants the same way. Add each var the spec references to rudder/secrets.vars.yaml as NAME: with no value (fact unfilled-secret), and keep the lines already there.rudder-cli validate -l rudder 2>&1 | grep -E '^warning\[destination/secret-reference(-unique)?\]|^Found |configuration is valid', with the variables under enable set when verified is false. It needs no --var-file, and its lines name keys and variables, never values. Without the var file, the Found line also counts each variable as undefined, which is expected here. If it prints neither a Found line nor Project configuration is valid, validate did not run; fix that first. For each warning, write that key's slot from the docs output, with its own var in the var file. Then ask the user to fill every line of the var file in their editor and say continue; the destination reference says how to write a value, a ', a JSON value, a value that spans lines and a key file. Do not read the file back.Facts that apply here (references/facts.md): cli-features, connection-mode, destination-disabled, unfilled-secret, background-processes.
Done when:
ls rudder/destinations/*.yaml)enable set when verified is false (check: out=$(rudder-cli validate -l rudder 2>&1); printf '%s\n' "$out" | grep -qE '^Found |configuration is valid' && ! printf '%s\n' "$out" | grep -qE '\[destination/secret-reference(-unique)?\]')Record: destination_id, destination_type.
Files first, then a dry run that says exactly what changes, then apply and commit.
Needs: source_type, source_id, destination_id.
rudder/sources/<source_id>.yaml with type set to source_type, and rudder/connections.yaml, from the destination reference.rudder-cli validate -l rudder --var-file rudder/secrets.vars.yaml, without --var-file when the file does not exist, through the rule's filter, and add | grep -E '^(error|warning)\[|^ *--> |^Found [0-9]+ error|^Error: |^exit [0-9]+$' at its end, so only the error lines and the exit status print. Validate masks the values of secret keys in the source lines it prints under each error (fact cli-features); show only these lines anyway, because the fix needs nothing else. For an error on a destination key, read the key's field in step 4's docs output, running the command again if you no longer have it; a custom validator named in its checkedBy says what it needs only in the error. When a secret key is missing, or validate warns destination/secret-reference or destination/secret-reference-unique, write the key's slot, add its var to the var file as NAME: and ask the user to fill it; never ask for the value in chat. Validate exits 0 with either warning, so read its lines, not only its exit status.rudder-cli apply -l rudder --dry-run with the same --var-file, its output filtered (rule). Show the plan as N to create, N to change, N to delete.sh '<skill folder>/references/run-record.sh' workspace "$(rudder-cli workspace info --json | jq -r '.workspaceID // empty')". If it says this run applied to another workspace, stop and tell the user both. Then apply: rudder-cli apply -l rudder --confirm=false with the same --var-file, its output filtered. Expect exit 0 and the created resources listed.git status --porcelain -- rudder prints nothing, as on a resume that kept every spec and the plan, there is nothing to commit: make no commit and leave specs_commit unset. Otherwise commit rudder/ by its path alone: git add rudder && git commit -m "Add RudderStack event delivery as specs" -- rudder, and record it with commit revert (rule). Step 1 already committed .gitignore, and .mcp.json stays out. Tell the user that step 9 gives the undo.Loop. Fix the reported file and line, then validate again until validate exits 0 with no errors and no destination/secret-reference or destination/secret-reference-unique warning, at most 5 attempts. When the bound is hit, show the remaining errors and their files to the user and stop.
Gate. Show the dry-run plan and ask "Apply these changes to <workspace_name>?" Do not continue without an explicit yes.
Facts that apply here (references/facts.md): cli-features, silent-decline, apply-scope, unfilled-secret.
Done when:
out=$(rudder-cli validate -l rudder $( [ -f rudder/secrets.vars.yaml ] && echo --var-file rudder/secrets.vars.yaml ) 2>&1) && ! printf '%s\n' "$out" | grep -qE '\[destination/secret-reference(-unique)?\]')rudder/ is committed (check: git log --oneline -1 -- rudder | grep -q . && ! git status --porcelain -- rudder | grep -q .)Record: specs_commit.
If it fails:
Removed resources:. Stop (rule), show the list, and go back to step 2's branch.key "NAME" has a null or empty value: that secret is not filled yet, and others may not be either. Ask the user to fill every empty line in the var file in their editor; never write NAME: "" (fact unfilled-secret).The step no browser flow can do, a change to the user's own code.
Consult: rudder-code-first-instrumentation.
Needs: events, data_plane_url, sender.
list_sources and find the source by name. Record its id and write key. Call list_destinations and record the destination's id.npm install @rudderstack/analytics-js for a browser app.rudder/plan.events.json, with exactly its names, properties and types. Follow the browser instrumentation reference, including the development-time error when the write key is missing, so events are never dropped silently.rudder/plan.md lists. Change nothing else..env.local or an iOS app's RudderStack.local.xcconfig, for step 9's undo. Before the first write, run sh '<skill folder>/references/run-record.sh' save '<file>', with <file> the file's path from work_dir. The first save in a run keeps the file as it is, or notes that it does not exist, in the run record. A later save in the same run, in this session or another, keeps that copy and checks that the file still holds what the run last wrote. If it prints changed since step 6, the user changed the file since. Ask whether an undo should put back the copy from before this run, which drops those changes, or the file as it is now. For the file as it is now, run sh '<skill folder>/references/run-record.sh' forget '<file>', then the save again. If the save says the file is a symbolic link to a file that does not exist, write nothing to it: tell the user, ask them to create that file, even empty, or remove the link, and run the save again. After the last write, run sh '<skill folder>/references/run-record.sh' record '<file>', so the undo can tell whether the file still holds what this run wrote..env.local, which step 1 git-ignored, or update them there, and keep its other lines. Check with git check-ignore -q .env.local before writing, and stop if it is not ignored.npx tsc --noEmit where there is a tsconfig.json, or npm run build) and fix what it reports..env.local, as "Instrument with events", and record it with commit revert (rule). To find them, run the first line of step 1's git_state command and then changes, in one shell call: it lists each file changed since step 1, by its path from the repository's top. In an npm, yarn or pnpm workspace the lockfile is in a folder above work_dir; name it with :/ before that path, such as ':/package-lock.json'. Leave out a file this step did not change, and tell the user it is still uncommitted.If sender is curl:
.env.local as RUDDERSTACK_WRITE_KEY and RUDDERSTACK_DATA_PLANE_URL. When the user chose in step 2 to leave an app's RudderStack SDK as it is, write them to rudder/first-event.vars.yaml instead, as RUDDERSTACK_WRITE_KEY: <key> and RUDDERSTACK_DATA_PLANE_URL: <url>, and leave .env.local alone, because the app may read those names from it. Step 1's rudder/*.vars.yaml line keeps that file out of git, and rudder-cli loads no .vars.yaml file as a spec. Check with git check-ignore -q rudder/first-event.vars.yaml before writing, and stop if it is not ignored. There is nothing to commit, so there is no code_commit.If source_type is android_kotlin:
sender becomes curl, as the reference says.If source_type is ios_swift:
sender becomes curl, as the reference says. It keeps the key in RudderStack.local.xcconfig as well as .env.local. Check that file first with git check-ignore -q RudderStack.local.xcconfig; if git does not ignore it, add it to .gitignore, commit that line alone and record it with commit keep, as step 1 does. Never edit project.pbxproj; ask the user for the Xcode changes the reference lists, in one message.If source_type is flutter, react_native or unity:
If step 2 found a RudderStack SDK in the app, and the user chose to send to the new source:
xcodebuild for a native app), not npm. If the user chose to move from a legacy SDK, follow the Android or iOS reference, including its part on the legacy SDK, which asks before removing it.Done when:
.env.local, or in rudder/first-event.vars.yaml for an app left on its old source, and git ignores that file (check: { test -s .env.local && git check-ignore -q .env.local; } || { test -s rudder/first-event.vars.yaml && git check-ignore -q rudder/first-event.vars.yaml; })sender is app, a RudderStack SDK is a dependency of the app (package.json, Gradle, Package.swift or Package.resolved, the Xcode project, Podfile, pubspec.yaml or a server language's manifest, such as requirements.txt or go.mod) (check: [ -z "$(find . -maxdepth 3 -name node_modules -prune -o \( -name package.json -o -name 'build.gradle*' -o -name Podfile -o -name Package.swift -o -name '*.xcodeproj' -o -name pubspec.yaml \) -print)" ] || grep -rqE --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=Pods --exclude-dir=build --exclude-dir=vendor --exclude-dir=target --exclude-dir=.venv --exclude-dir=venv --include=package.json --include='*.gradle' --include='*.gradle.kts' --include='*.versions.toml' --include=Podfile --include=Package.swift --include=Package.resolved --include=project.pbxproj --include=pubspec.yaml --include='requirements*.txt' --include=pyproject.toml --include=Pipfile --include=setup.py --include=setup.cfg --include=go.mod --include=pom.xml --include='*.csproj' --include='*.fsproj' --include=composer.json --include=Gemfile --include=Cargo.toml '"@rudderstack/|com\.rudderstack\.|rudder-sdk-[a-z-]+|pod .Rudder.|rudder_sdk_flutter|rudderlabs/analytics-go|rudder-php-sdk|rudder_analytics_sync|[Rr]udder[Aa]nalytics' .)[ ! -f tsconfig.json ] || npx --no-install tsc --noEmit).env.local is not tracked (check: ! git ls-files --error-unmatch .env.local 2>/dev/null)work_dir outside rudder/ and agent files, or in the files above it that git_state reads (check: git rev-parse --is-inside-work-tree >/dev/null 2>&1 && ! { git status --porcelain -- . ':!rudder' ':!.claude' ':!.agents' ':!.cursor' ':!.codex' ':!.mcp.json' ':!AGENTS.md' ':!CLAUDE.md'; (while [ -n "$(git rev-parse --show-prefix)" ] && cd -P ..; do git status --porcelain -- ':(glob)*' ':(glob)gradle/*' ':!.mcp.json' ':!AGENTS.md' ':!CLAUDE.md'; done); } | grep -q .)Record: remote_source_id, remote_destination_id, write_key, code_commit.
Check the code against the agreed events before anything touches the cloud.
Needs: events, sender.
references/check-events.jq unchanged and write no jq of your own (fact local-no-types).rudder-cli sources needs (fact sources-listen-gate). Exit 4 is a guard: the rudder-cli that ran has no sources listen. Act on it as the reference says.rudder/plan.events.json, and say done. With the one-call recipe, say this before the call, because the user cannot answer during it. On the iOS Simulator, you launch the app after each mark, so ask the user to use it where it is and not to close or reopen it.kill with the two process ids the start calls printed. Never use pkill, killall or a match on a name such as vite, which also stops the user's other servers.If sender is curl:
If the app has no package manager (step 2's branch), or source_type is unity:
If source_type is a mobile type (android_kotlin, ios_swift, flutter, react_native, android or ios):
10.0.2.2 from an Android emulator, built in with Gradle properties, and 127.0.0.1 from the iOS Simulator, passed only when you launch it with xcrun simctl launch), launches it or has the user open it only after the mark, and asks the user to wait 15 seconds after the last action, because the SDK sends in batches (facts emulator-loopback, mobile-config-url, mobile-batches). Tell the user to open the installed Android app from the emulator's app drawer, not with Run in Android Studio. Launch an iOS app yourself after each mark, and tell the user not to close it, open it from its icon or press Run in Xcode. Each of those starts the app with the real values, so its events go to the live data plane.Loop. Fix the code, commit the fix by explicit paths as "Fix 's RudderStack events", record it (rule) and add it to fix_commits, ask the user to repeat the flow, and run a new pass from a new mark until the check exits 0, so every planned event arrived with the agreed property types, at most 3 attempts. When the bound is hit, show the last table of expected against received names and types, and stop.
Facts that apply here (references/facts.md): local-no-types, sources-listen-gate, background-processes, emulator-loopback, mobile-config-url, mobile-batches.
Record: fix_commits.
Not in scope yet, mention as a next step if relevant:
rudder-cli sources check --expect rudder/plan.events.json, with the same report, its own exit code for a failed check, and a step 7 result in CLI telemetry.Local is clean. Now the real pipeline, measured from a known start time.
Needs: write_key, data_plane_url, remote_destination_id, events, sender.
started_at as the current UTC time rounded down to the minute: date -u +%Y-%m-%dT%H:%M:00Z (fact metrics-minute-buckets).p to the prefix of the names step 6 wrote, as the reference lists, so it probes the key the app sends with. Act on its exit status as the reference says; on any exit but 0, stop before anyone sends an event..env.local) and ask the user to go through the flow once, then say done.get_destination_event_metrics with the destination id and start_time: started_at. Delivered means each event the user sent from rudder/plan.events.json shows deliveredCount of at least 1 and failedCount 0.get_destinations_errors for the destination and report the error.rudder/plan.events.json. If the app sent a name or a type that differs, fix the code, commit the fix as step 7's loop does and add it to fix_commits. Then wait for the next minute to start and record started_at again as item 1 does, so items 4 and 5 count only the next attempt (fact metrics-minute-buckets), and repeat items 3 to 6, at most 3 times.If sender is curl:
rudder/first-event.vars.yaml, set f to that file in item 2's probe, with p=, and in the send. Instead of item 3, once the write-key probe exits 0, send the first event in rudder/plan.events.json with the live verification reference's send command, which builds the body from the plan with sample values of the agreed types (fact http-api-any-source). Send it once and expect HTTP 200. Items 4 to 6 then check that one event.If source_type is a mobile type or unity:
./gradlew :<app module>:installDebug with no -P values, for iOS Run in Xcode or xcrun simctl launch with no SIMCTL_CHILD_ values, and for Flutter and React Native a debug build without the listener's URLs. Run a Unity game as usual. A physical device works too, because the data plane is public. Ask the user to wait 15 seconds after the last action before saying done (fact mobile-batches). If the app cannot run on an emulator, a simulator or a device, send the first planned event with curl as the curl branch does; .env.local already holds the write key and data plane URL.Loop. Probe the write key every 20 seconds until it is accepted, then poll delivery metrics every 30 seconds until each agreed event shows as delivered since started_at or has arrived at a destination the user can read, give up after 5 minutes for the write key and 10 minutes for delivery. When the bound is hit, report the last probe status and the last metrics seen, and suggest get_destinations_errors and the live events page.
Facts that apply here (references/facts.md): write-key-delay, metrics-no-timestamps, metrics-minute-buckets, metrics-lag, mcp-hashes-values, http-api-any-source, mobile-batches.
Record: started_at, fix_commits.
What changed, how to undo it, what to try next.
Needs: sender.
Summarise in a table: workspace resources (as specs in git), code changes (files and events), evidence (delivered and failed counts since started_at), the commits, and the undo, which you run only when the user asks for it. It reverts these commits and removes from the workspace what this run created. If step 1 added a source beside an old one of another type, say that the old source and its connection stay, and that the user can delete them by removing their specs from rudder/ and applying once no build sends to the old source. If you ran rudder-cli by its full path (rule), end the summary with export PATH="$HOME/.local/bin:$PATH" and say that adding this line to their shell profile, such as ~/.zshrc, lets a new terminal run rudder-cli. Then run sh '<skill folder>/references/run-record.sh' close, so a later setup here starts a run of its own.
If step 4 started a quick tunnel, stop its server and tunnel with kill and the two process ids its start command printed, never pkill. Say that the webhook's URL stops answering, so the destination fails each delivery until the user points it at a lasting endpoint and applies again.
If the repository has a remote, offer to push a branch and open a pull request.
Do this item only when the app's code sends events: sender is app, or step 2 found a RudderStack SDK in the app: its SDK list or the search after it named one, or the user said so when no probe ran. An app with no RudderStack SDK whose user declined an upgrade in step 6 sends nothing, so skip the item there. Choose <file>: AGENTS.md when it exists, else CLAUDE.md when it exists, else AGENTS.md. If <file> already names rudder-tracking-review, skip this item. Skip it too when [ -L '<file>' ] succeeds, because the write would change the file the link points to, or when ls -A | grep -iFx '<file>' | grep -vFx '<file>' prints a name, such as agents.md on a case-insensitive file system, because step 1's probes would then read the change as the user's own work. Say that you skipped it and why. Otherwise ask one question: "Add a line to so your agent checks analytics edits against RudderStack before it reports a task as done?" with the choices Yes and No. If rudder-tracking-review is not among your skills, add to the question that the line needs that skill from the rudder-core plugin. On yes, create the file if it is missing, and append the line below at the end of the file as a paragraph of its own, after an empty line. Make no commit. Then tell the user which file you changed, that the change is not committed, and that an undo leaves the line in place. Step 1's probes ignore these files, and the run record does not hold the line. On no, write nothing and do not ask again in this run.
This app sends analytics events to RudderStack. After you change code that sends events, use the rudder-tracking-review skill before you report the task as done.
If sender is curl:
work_dir is not the app, as when step 1 continued in an empty folder or in ./rudderstack-first-event, the app can send events later once rudder/ is in its repository. Copy it there without the filled var file, which the app's repository may not ignore yet: tar -cf - --exclude='*.vars.yaml' rudder | tar -xf - -C '<path to the app>'. Make no commit there yourself. Step 1 there writes the var file again, with empty lines for the user to fill.resume), works out the app's source type and, if it differs from the source in rudder/, offers to add a source of that type beside it. Starting there with an empty rudder/ would stop at step 2, because these resources are CLI-managed now (fact apply-scope).If the user asks you to undo this run, after the summary or in a later session, and only then:
rudder/, after checking that rudder-cli reaches the workspace the run applied to.Facts that apply here (references/facts.md): apply-scope.
Not in scope yet, mention as a next step if relevant:
rudder-cli typer generate.rudder/destinations/ and one more line in rudder/connections.yaml.references/facts.md: the measured facts the steps citereferences/destinations.md: source and connection specs, webhook endpoints and the var filereferences/instrument-javascript.md: browser instrumentationreferences/instrument-android.md: Android instrumentation, Kotlin SDKreferences/instrument-ios.md: iOS instrumentation, Swift SDKreferences/instrument-other-sdks.md: Flutter, React Native and Unity instrumentationreferences/verify-local.md: local verificationreferences/verify-live.md: live verificationreferences/check-events.jq: the step 7 checker, run unchangedreferences/plan-table.jq: the step 3 plan table, run unchangedreferences/found-types.sh: the step 2 probe, run unchangedreferences/run-record.sh: the run record for step 9's undo, run unchangedreferences/undo.md: undoing a runreferences/check-events.jq (opens in a new tab)references/destinations.md (opens in a new tab)references/facts.md (opens in a new tab)references/found-types.sh (opens in a new tab)references/instrument-android.md (opens in a new tab)references/instrument-ios.md (opens in a new tab)references/instrument-javascript.md (opens in a new tab)references/instrument-other-sdks.md (opens in a new tab)references/plan-table.jq (opens in a new tab)references/run-record.sh (opens in a new tab)references/undo.md (opens in a new tab)references/verify-live.md (opens in a new tab)references/verify-local.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
rudderstack, analytics-setup, event-tracking, cli-onboarding
npx claudepluginhub rudderlabs/rudder-agent-skills --plugin rudder-core11 skills in this plugin
/rudder-code-first-instrumentationDerives tracking plans from existing codebase types and structures. Use when instrumenting an existing product that wasn't well-instrumented or restructuring existing tracking./rudder-data-catalogCreates and manages events, properties, categories, and custom types for instrumentation schemas. Use when creating or managing events, properties, categories, or custom types for RudderStack instrumentation/rudder-data-graphsProduces Data Graph YAML from RETL sources for Audiences. Use when designing Data Graphs, mapping RETL to entities/events, or assessing customer fit for Audiences./rudder-design-first-instrumentationPlans instrumentation for new features starting from product requirements before code exists. Use when building new features and need to define events as part of product definition./rudder-destination-debuggingDiagnoses why events are failing, dropping, or not arriving at a destination. Use when events are missing from a destination, seeing high error rates, getting auth failures, or events are stuck retrying./rudder-environment-checkChecks RudderStack tool prerequisites and reports status. Use when checking prerequisites, setup status, what tools are missing, or before running RudderStack workflows for the first timeOther plugins' skills for the same job