Rig onboarding
You are onboarding the current working project (the "target") into Rig.
Your job is to detect what the project is, agree a project profile with the
user, copy in the pieces they want, and leave them with a working, documented
setup. Be interactive but efficient — detect aggressively, ask only what you
cannot infer.
0. Locate the kit (RIG_DIR)
The kit lives in a directory (RIG_DIR) separate from the target project — you
copy files out of it. Resolve RIG_DIR in this order:
An explicit local path in the invocation args.
This skill's own location (.../rig/skills/rig-onboard/) → RIG_DIR is two
levels up (the repo root that contains skills/, agents/, ci/).
~/dev/rig, then ~/rig.
Remote (the zero-setup path). If none of the above exist — which is the
case when the user just pointed you at a GitHub URL for this skill — clone the
kit to a temp dir and use that as RIG_DIR:
RIG_DIR="$(mktemp -d)/rig"
git clone --depth 1 <RIG_REPO_URL> "$RIG_DIR"
Derive <RIG_REPO_URL> from the URL you were given: strip any
/blob/<branch>/… or raw.githubusercontent.com/… suffix back to the repo
root (e.g. https://github.com/agent-rig/rig). Cloning is strongly
preferred over fetching files one-by-one — the kit is ~40 small text files
and a shallow clone grabs them all at once. If git isn't available, fall
back to fetching individual raw files as you need them.
Then confirm the resolved RIG_DIR with the user before copying anything.
Never copy a file onto itself — if the target project is the kit, stop and say so.
1. Detect the stack (no questions yet)
Read, don't ask. Gather:
- Runtime / package manager: presence of
bun.lockb/bunfig.toml → bun;
pnpm-lock.yaml → pnpm; yarn.lock → yarn; package-lock.json → npm; else
inspect package.json. Note the monorepo tool (turbo.json, nx.json,
workspaces) and package layout (packages/*, apps/*).
- Test command: read
package.json scripts (test, test:integration,
test:e2e). Detect whether tests boot a database (docker in test setup,
testcontainers, a test-setup.ts preload, a Postgres dep).
- VCS:
git remote get-url origin → project.repo; git symbolic-ref refs/remotes/origin/HEAD or the default branch → vcs.defaultBranch +
vcs.baseRef. Check branch protection / merge queue only if gh is available.
- Tracker: is a Linear MCP server connected? Do existing branch names /
recent PR titles carry a ticket prefix (e.g.
ABC-123)? If neither, default
tracker.provider: "none".
- Review bot: scan recent PRs (if
gh available) for a bot reviewer
("codex", "claude"). Otherwise review.bot: "none".
- Agent(s) / delivery target: which coding agent does this project use? Map
from repo markers to delivery targets (may be more than one):
.claude/ or CLAUDE.md → claude-code (native: .claude/skills/,
.claude/agents/).
AGENTS.md, .agents/, .cursor/, .github/copilot-instructions.md,
GEMINI.md, or .windsurf/ → agents-md (universal: skills land in
.agents/skills/<name>/ — the standard cross-agent "Agent Skills" layout
that Codex, Cursor, Gemini CLI, Copilot, and Rovo Dev auto-discover
natively, so no per-skill index file is needed; agents/scripts/review
patterns stay under .rig/, the same home as the config profile, since
nothing else standardizes those; plus a minimal ## Rig pointer block
injected into AGENTS.md). If none detected, default to claude-code; if
unsure, ask.
.pi/ → pi (pi: skills go to .agents/skills/,
which pi scans natively; personas to .pi/agents/ in pi-subagents
frontmatter; a /rig dispatcher to .pi/prompts/). Detect alongside the
others — a repo worked on from both Claude Code and pi wants both targets.
- Existing
.claude/ or .agents/skills/: note any skills/agents already
present so you can warn before overwriting. Also check for a legacy
.rig/skills/*.md flat-file layout from a pre-.agents/skills/ onboarding —
see "Re-running" below.
Summarize what you found in a short table before moving on.
2. Fill the profile (ask only the gaps)
Present the detected values and ask the user to confirm or correct. Only surface
questions you genuinely couldn't infer. The knobs are defined in
RIG_DIR/rig.schema.json and documented in RIG_DIR/docs/config.md; the
important ones to settle:
test.command (+ integration/e2e/requiresDatabase)
sourceScope (default path skills operate on)
vcs.baseRef, vcs.defaultBranch, vcs.protectedBranchMergeQueue
tracker.provider and, if not "none": team, project, ticketPrefix,
githubIntegration
review.patternsFile, review.bot (+ botRetrigger if a bot)
style.guideFile — the writing style agents follow for PR bodies, tickets,
and findings (.claude/STYLE.md, or .rig/STYLE.md on the non-Claude targets)
Do not ask about agents overrides unless the user already has agents with
clashing names — the defaults are the kit's own rig-<role> agents.
3. Pick the pieces
Show the menu (from RIG_DIR/README.md) and let the user choose. Recommend a
default set based on detection:
- Always useful:
rig-debug, rig-tidy, rig-spike, rig-review + agents
rig-debugger, rig-reviewer, rig-architect.
- If a tracker is configured:
rig-issue, rig-sprint, rig-epic (the
multi-item integration-branch arc; also works tracker-less via its state file).
- If the project uses PRs / worktrees:
rig-worktree, rig-task (the
end-to-end ticket→PR orchestrator; rig-sprint calls it) + agents rig-qa,
rig-coder. (rig-review — always useful above — carries both the find
gate and the fix loop.)
- CI: offer the workflow templates separately (Step 5) — they're heavier and
need secrets.
4. Write the profile and deliver the skills (per target)
First write the shared, agent-agnostic profile: .rig/config.json in the
target from the agreed values (include "$schema" pointing at the kit schema).
Then deliver for each target from Step 1. The mechanical path is
RIG_DIR/install.sh --target <t1,t2> <target> <skills…> — you may just run it;
or do the copies yourself as below. Either way, never overwrite an existing
skill/agent/catalog without diff-and-confirm.
claude-code: copy chosen RIG_DIR/skills/<name>/ →
<target>/.claude/skills/<name>/; RIG_DIR/agents/*.md →
<target>/.claude/agents/; RIG_DIR/scripts/* → <target>/.claude/scripts/
(chmod +x); and starter REVIEWER.md / STYLE.md / label-mapping.md →
<target>/.claude/ only if absent.
agents-md: skills are delivered as full directories — copy each chosen
RIG_DIR/skills/<name>/ → <target>/.agents/skills/<name>/ (same shape as
the claude-code copy, just a different root). This is the location the
target agent already scans on its own, so no per-skill index or "read and
follow" pointer is written — the agent auto-discovers each skill from its
SKILL.md frontmatter description. Everything the standard doesn't cover
keeps living under .rig/ (the same dir as the shared config profile, so
there's still one rig home for non-skill pieces): agents →
<target>/.rig/agents/; scripts → <target>/.rig/scripts/; starter docs
(REVIEWER.md, STYLE.md, label-mapping.md) → <target>/.rig/ (if
absent). Then
inject/refresh an idempotent ## Rig section into <target>/AGENTS.md
(between <!-- rig:start --> / <!-- rig:end --> markers — replace any
existing block, don't duplicate). Keep this block short: a pointer to
.rig/config.json for project settings, and a note that subagent-less
agents should adopt the .rig/agents/ personas inline — it no longer
enumerates skills. Set review.patternsFile to .rig/REVIEWER.md and
style.guideFile to .rig/STYLE.md in the profile for this target.
pi: skills go to <target>/.agents/skills/<name>/ (same copy as
agents-md — pi scans that location natively). Personas are assembled, not
copied: for each RIG_DIR/agents/<name>.md, write
<target>/.pi/agents/<name>.md as --- + RIG_DIR/pi/agents/<name>.yml +
--- + the source persona's body (everything after its own closing ---).
The body is never duplicated in the kit; see RIG_DIR/pi/agents/README.md for
the mapping and why the frontmatter differs. Copy
RIG_DIR/pi/prompts/*.md → <target>/.pi/prompts/; scripts and starter docs
go to .rig/ as in agents-md. Create <target>/.pi/settings.json with
{"packages": ["npm:pi-subagents"]} only if absent — if it exists, tell
the user to add that entry themselves rather than rewriting their settings.
Set review.patternsFile to .rig/REVIEWER.md and style.guideFile to
.rig/STYLE.md. Then tell them to approve the
project-local files on first pi start (pi ignores .pi/ until the project is
trusted) and to try /rig review find. Details: RIG_DIR/docs/pi.md.
When more than one target delivered .agents/skills/, write the ## Rig
AGENTS.md block once, after all copies, describing every target you
installed — the block is replaced wholesale between its markers, so writing it
per-target means the last one silently wins.
5. Offer CI (optional, gated on consent)
If the user wants CI, follow RIG_DIR/ci/README.md: copy the chosen workflow
files into <target>/.github/workflows/, substitute the parameters from the
profile, and print the full list of GitHub secrets/vars each workflow
requires so the user can add them. Do not invent secret values. The AI
review-bot bundle additionally needs a GitHub App token — do the copy-and-wire
yourself, then hand the human docs/auto-fix-app.md (the click-by-click App +
secrets setup you can't do for them). See ci/README.md#review-bot-bundle.
6. Verify and summarize
- Sanity-check:
.rig/config.json parses; every copied skill's config
references resolve; scripts are executable.
- If the target is a git repo you did not create, do not commit — leave the
changes staged/unstaged for the user to review, and tell them what changed.
- Print a summary: profile written, skills/agents/scripts installed, CI
workflows added (+ required secrets), and 3 suggested first commands to try
(e.g.
/rig-debug, /rig-review, /rig-tidy).
Re-running
Onboarding is idempotent-ish: re-running detects the existing
.rig/config.json, offers to update it, and only copies pieces that are
missing or that the user explicitly asks to refresh. Use it to pull kit updates.
Projects onboarded before this change may still have the old flat
.rig/skills/<name>.md files and a ## Rig block that lists them by name.
Re-running onboarding delivers skills into .agents/skills/<name>/ and
replaces the ## Rig block (it's idempotent between the markers), but it will
not delete the old .rig/skills/*.md files on its own — copy_no_clobber
and the rest of the install path only ever add files, never remove them. Point
this out in your Step 1 summary and Step 6 wrap-up, and — because you're
interactive and a human is present to confirm — offer to delete the now-dead
.rig/skills/ directory for them. Don't delete it silently, and don't do this
from install.sh (non-interactive, no consent to delete).
1---2name: rig-onboard3description: Onboard the current project into Rig — detect the stack, fill a project profile, and copy in the skills, agents, scripts, and CI workflows you choose. Triggers on 'onboard', 'set up rig', 'install rig', 'adopt these skills', 'onboard me into the skills'.4---56# Rig onboarding78You are onboarding **the current working project** (the "target") into Rig.9Your job is to detect what the project is, agree a **project profile** with the10user, copy in the pieces they want, and leave them with a working, documented11setup. Be interactive but efficient — detect aggressively, ask only what you12cannot infer.1314## 0. Locate the kit (`RIG_DIR`)1516The kit lives in a directory (`RIG_DIR`) separate from the target project — you17copy files *out of* it. Resolve `RIG_DIR` in this order:18191. An explicit local path in the invocation args.202. This skill's own location (`.../rig/skills/rig-onboard/`) → `RIG_DIR` is two21 levels up (the repo root that contains `skills/`, `agents/`, `ci/`).223. `~/dev/rig`, then `~/rig`.234. **Remote (the zero-setup path).** If none of the above exist — which is the24 case when the user just pointed you at a GitHub URL for this skill — clone the25 kit to a temp dir and use that as `RIG_DIR`:2627 ```bash28 RIG_DIR="$(mktemp -d)/rig"29 git clone --depth 1 <RIG_REPO_URL> "$RIG_DIR"30 ```3132 Derive `<RIG_REPO_URL>` from the URL you were given: strip any33 `/blob/<branch>/…` or `raw.githubusercontent.com/…` suffix back to the repo34 root (e.g. `https://github.com/agent-rig/rig`). Cloning is strongly35 preferred over fetching files one-by-one — the kit is ~40 small text files36 and a shallow clone grabs them all at once. If `git` isn't available, fall37 back to fetching individual raw files as you need them.3839Then confirm the resolved `RIG_DIR` with the user before copying anything.40Never copy a file onto itself — if the target project *is* the kit, stop and say so.4142## 1. Detect the stack (no questions yet)4344Read, don't ask. Gather:4546- **Runtime / package manager**: presence of `bun.lockb`/`bunfig.toml` → bun;47 `pnpm-lock.yaml` → pnpm; `yarn.lock` → yarn; `package-lock.json` → npm; else48 inspect `package.json`. Note the monorepo tool (`turbo.json`, `nx.json`,49 workspaces) and package layout (`packages/*`, `apps/*`).50- **Test command**: read `package.json` scripts (`test`, `test:integration`,51 `test:e2e`). Detect whether tests boot a database (docker in test setup,52 `testcontainers`, a `test-setup.ts` preload, a Postgres dep).53- **VCS**: `git remote get-url origin` → `project.repo`; `git symbolic-ref54 refs/remotes/origin/HEAD` or the default branch → `vcs.defaultBranch` +55 `vcs.baseRef`. Check branch protection / merge queue only if `gh` is available.56- **Tracker**: is a Linear MCP server connected? Do existing branch names /57 recent PR titles carry a ticket prefix (e.g. `ABC-123`)? If neither, default58 `tracker.provider: "none"`.59- **Review bot**: scan recent PRs (if `gh` available) for a bot reviewer60 ("codex", "claude"). Otherwise `review.bot: "none"`.61- **Agent(s) / delivery target**: which coding agent does this project use? Map62 from repo markers to delivery **targets** (may be more than one):63 - `.claude/` or `CLAUDE.md` → **`claude-code`** (native: `.claude/skills/`,64 `.claude/agents/`).65 - `AGENTS.md`, `.agents/`, `.cursor/`, `.github/copilot-instructions.md`,66 `GEMINI.md`, or `.windsurf/` → **`agents-md`** (universal: skills land in67 `.agents/skills/<name>/` — the standard cross-agent "Agent Skills" layout68 that Codex, Cursor, Gemini CLI, Copilot, and Rovo Dev auto-discover69 natively, so no per-skill index file is needed; agents/scripts/review70 patterns stay under `.rig/`, the same home as the config profile, since71 nothing else standardizes those; plus a minimal `## Rig` pointer block72 injected into `AGENTS.md`). If none detected, default to `claude-code`; if73 unsure, ask.74 - `.pi/` → **`pi`** ([pi](https://pi.dev): skills go to `.agents/skills/`,75 which pi scans natively; personas to `.pi/agents/` in `pi-subagents`76 frontmatter; a `/rig` dispatcher to `.pi/prompts/`). Detect alongside the77 others — a repo worked on from both Claude Code and pi wants both targets.78- **Existing `.claude/` or `.agents/skills/`**: note any skills/agents already79 present so you can warn before overwriting. Also check for a legacy80 `.rig/skills/*.md` flat-file layout from a pre-`.agents/skills/` onboarding —81 see "Re-running" below.8283Summarize what you found in a short table before moving on.8485## 2. Fill the profile (ask only the gaps)8687Present the detected values and ask the user to confirm or correct. Only surface88questions you genuinely couldn't infer. The knobs are defined in89`RIG_DIR/rig.schema.json` and documented in `RIG_DIR/docs/config.md`; the90important ones to settle:9192- `test.command` (+ integration/e2e/requiresDatabase)93- `sourceScope` (default path skills operate on)94- `vcs.baseRef`, `vcs.defaultBranch`, `vcs.protectedBranchMergeQueue`95- `tracker.provider` and, if not "none": team, project, `ticketPrefix`,96 `githubIntegration`97- `review.patternsFile`, `review.bot` (+ `botRetrigger` if a bot)98- `style.guideFile` — the writing style agents follow for PR bodies, tickets,99 and findings (`.claude/STYLE.md`, or `.rig/STYLE.md` on the non-Claude targets)100101Do **not** ask about `agents` overrides unless the user already has agents with102clashing names — the defaults are the kit's own `rig-<role>` agents.103104## 3. Pick the pieces105106Show the menu (from `RIG_DIR/README.md`) and let the user choose. Recommend a107default set based on detection:108109- **Always useful**: `rig-debug`, `rig-tidy`, `rig-spike`, `rig-review` + agents110 `rig-debugger`, `rig-reviewer`, `rig-architect`.111- **If a tracker is configured**: `rig-issue`, `rig-sprint`, `rig-epic` (the112 multi-item integration-branch arc; also works tracker-less via its state file).113- **If the project uses PRs / worktrees**: `rig-worktree`, `rig-task` (the114 end-to-end ticket→PR orchestrator; `rig-sprint` calls it) + agents `rig-qa`,115 `rig-coder`. (`rig-review` — always useful above — carries both the `find`116 gate and the `fix` loop.)117- **CI**: offer the workflow templates separately (Step 5) — they're heavier and118 need secrets.119120## 4. Write the profile and deliver the skills (per target)121122First write the shared, agent-agnostic profile: **`.rig/config.json`** in the123target from the agreed values (include `"$schema"` pointing at the kit schema).124125Then deliver for **each** target from Step 1. The mechanical path is126`RIG_DIR/install.sh --target <t1,t2> <target> <skills…>` — you may just run it;127or do the copies yourself as below. Either way, **never overwrite** an existing128skill/agent/catalog without diff-and-confirm.129130- **`claude-code`:** copy chosen `RIG_DIR/skills/<name>/` →131 `<target>/.claude/skills/<name>/`; `RIG_DIR/agents/*.md` →132 `<target>/.claude/agents/`; `RIG_DIR/scripts/*` → `<target>/.claude/scripts/`133 (`chmod +x`); and starter `REVIEWER.md` / `STYLE.md` / `label-mapping.md` →134 `<target>/.claude/` **only if absent**.135- **`agents-md`:** skills are delivered as full directories — copy each chosen136 `RIG_DIR/skills/<name>/` → `<target>/.agents/skills/<name>/` (same shape as137 the `claude-code` copy, just a different root). This is the location the138 target agent already scans on its own, so **no per-skill index or "read and139 follow" pointer is written** — the agent auto-discovers each skill from its140 `SKILL.md` frontmatter `description`. Everything the standard doesn't cover141 keeps living under `.rig/` (the same dir as the shared config profile, so142 there's still one rig home for non-skill pieces): agents →143 `<target>/.rig/agents/`; scripts → `<target>/.rig/scripts/`; starter docs144 (`REVIEWER.md`, `STYLE.md`, `label-mapping.md`) → `<target>/.rig/` (if145 absent). Then146 inject/refresh an idempotent `## Rig` section into `<target>/AGENTS.md`147 (between `<!-- rig:start -->` / `<!-- rig:end -->` markers — replace any148 existing block, don't duplicate). Keep this block short: a pointer to149 `.rig/config.json` for project settings, and a note that subagent-less150 agents should adopt the `.rig/agents/` personas inline — it no longer151 enumerates skills. Set `review.patternsFile` to `.rig/REVIEWER.md` and152 `style.guideFile` to `.rig/STYLE.md` in the profile for this target.153- **`pi`:** skills go to `<target>/.agents/skills/<name>/` (same copy as154 `agents-md` — pi scans that location natively). Personas are **assembled, not155 copied**: for each `RIG_DIR/agents/<name>.md`, write156 `<target>/.pi/agents/<name>.md` as `---` + `RIG_DIR/pi/agents/<name>.yml` +157 `---` + the source persona's body (everything after its own closing `---`).158 The body is never duplicated in the kit; see `RIG_DIR/pi/agents/README.md` for159 the mapping and why the frontmatter differs. Copy160 `RIG_DIR/pi/prompts/*.md` → `<target>/.pi/prompts/`; scripts and starter docs161 go to `.rig/` as in `agents-md`. Create `<target>/.pi/settings.json` with162 `{"packages": ["npm:pi-subagents"]}` **only if absent** — if it exists, tell163 the user to add that entry themselves rather than rewriting their settings.164 Set `review.patternsFile` to `.rig/REVIEWER.md` and `style.guideFile` to165 `.rig/STYLE.md`. Then tell them to approve the166 project-local files on first `pi` start (pi ignores `.pi/` until the project is167 trusted) and to try `/rig review find`. Details: `RIG_DIR/docs/pi.md`.168169When more than one target delivered `.agents/skills/`, write the `## Rig`170AGENTS.md block **once**, after all copies, describing every target you171installed — the block is replaced wholesale between its markers, so writing it172per-target means the last one silently wins.173174## 5. Offer CI (optional, gated on consent)175176If the user wants CI, follow `RIG_DIR/ci/README.md`: copy the chosen workflow177files into `<target>/.github/workflows/`, substitute the parameters from the178profile, and **print the full list of GitHub secrets/vars each workflow179requires** so the user can add them. Do not invent secret values. The AI180review-bot bundle additionally needs a GitHub App token — do the copy-and-wire181yourself, then hand the human `docs/auto-fix-app.md` (the click-by-click App +182secrets setup you can't do for them). See `ci/README.md#review-bot-bundle`.183184## 6. Verify and summarize185186- Sanity-check: `.rig/config.json` parses; every copied skill's config187 references resolve; scripts are executable.188- If the target is a git repo you did not create, **do not commit** — leave the189 changes staged/unstaged for the user to review, and tell them what changed.190- Print a summary: profile written, skills/agents/scripts installed, CI191 workflows added (+ required secrets), and 3 suggested first commands to try192 (e.g. `/rig-debug`, `/rig-review`, `/rig-tidy`).193194## Re-running195196Onboarding is idempotent-ish: re-running detects the existing197`.rig/config.json`, offers to update it, and only copies pieces that are198missing or that the user explicitly asks to refresh. Use it to pull kit updates.199200Projects onboarded before this change may still have the old flat201`.rig/skills/<name>.md` files and a `## Rig` block that lists them by name.202Re-running onboarding delivers skills into `.agents/skills/<name>/` and203replaces the `## Rig` block (it's idempotent between the markers), but it will204**not** delete the old `.rig/skills/*.md` files on its own — `copy_no_clobber`205and the rest of the install path only ever add files, never remove them. Point206this out in your Step 1 summary and Step 6 wrap-up, and — because you're207interactive and a human is present to confirm — offer to delete the now-dead208`.rig/skills/` directory for them. Don't delete it silently, and don't do this209from `install.sh` (non-interactive, no consent to delete).