---
name: talooner-onboard
description: Onboard the current repository to Talooner — draft .talooner/rules.tln and its .tln.test suite with the talooner-runner image, tailor the rules to this codebase, keep the tests green, and prepare a pull request. Use when the user asks to onboard a repo to Talooner, set up Talooner rules, or add a Talooner PR guard.
---

# Onboard a repository to Talooner

Talooner reviews every pull request against the policy in `.talooner/rules.tln`. This
skill drafts that policy for the repository you are working in, adapts it to the code,
and leaves it ready to commit. Docs: https://talooner.dev/onboard/

```
IMAGE=registry.gitlab.com/onlinecopyrig-rlr6226/talooner-runner:1
```

## 1. Check the prerequisites

- `docker` is available (`docker version`). If not, stop and tell the user.
- `TALOONER_LICENSE_KEY` is set in the environment. If not, ask the user for it — never
  write it to a file in the repository.
- An LLM is recommended — any OpenAI-compatible endpoint (`TALOONER_MODEL_BASE_URL` +
  `TALOONER_MODEL` + `TALOONER_MODEL_API_KEY`: Qwen, DeepSeek, a local model…), or
  `ANTHROPIC_API_KEY`, or `OPENAI_API_KEY` + `TALOONER_MODEL`. Without one, onboarding writes
  the generic starter ruleset; say so and continue.
- Work from the repository root (`git rev-parse --show-toplevel`). If
  `.talooner/rules.tln` already exists, ask before replacing it.

## 2. Draft the rules

```sh
docker run --rm -v "$PWD:/repo" --user "$(id -u):$(id -g)" \
  -e TALOONER_LICENSE_KEY \
  -e TALOONER_MODEL_BASE_URL -e TALOONER_MODEL -e TALOONER_MODEL_API_KEY \
  -e ANTHROPIC_API_KEY -e OPENAI_API_KEY \
  "$IMAGE" onboard
```

Add `--force` only if the user agreed to replace existing rules. The command writes
`.talooner/rules.tln` and `.talooner/rules.tln.test`, then prints a CI snippet — keep it
for step 5. A non-zero exit means nothing usable was written: show the error and stop.

## 3. Tailor the rules to this repository

Onboarding only sees the repository's layout. You can read the code, so improve the draft:

- Read `.talooner/rules.tln` and the tests.
- Look at what matters here: auth and permission code, migrations, dependency manifests,
  CI config, infrastructure, secrets handling, public APIs, CODEOWNERS.
- Adjust paths and globs to the real folder names, route sensitive areas to the owners
  in CODEOWNERS, and remove rules that don't apply.
- For every rule you add or change, add or update a case in `.talooner/rules.tln.test`.
- Keep it small: a handful of precise rules beats many vague ones. Plans limit the number
  of rules (Starter 10, Team 20, Pro 50).

## 4. Keep the tests green

```sh
docker run --rm -v "$PWD:/repo" -w /repo --entrypoint tln "$IMAGE" test .talooner/
```

Fix the rules or the tests until every test passes. Never delete a failing test just to
make the suite pass — fix the rule it exposes, or ask the user.

## 5. Hand over

- Summarise each rule in one line for the user.
- Show the CI snippet printed in step 2 — the review step for their pipeline. Secrets go
  into CI/CD variables or repository secrets, never into the repository.
- Ask before committing. With approval, create a branch, commit `.talooner/rules.tln`,
  `.talooner/rules.tln.test` and the CI change, and open a pull request.
