Claude
Skills
Sign in
Back

recoup-setup

Included with Lifetime
$97 forever

First-run setup for Recoup inside Claude Code. Walks a customer through email + PIN verification, issues an API key tied to their real account, persists it locally, looks up their org via the Recoup API, and seeds Claude's memory so future music-industry questions (streaming, campaigns, artists, releases, document syncing) route through the recoup-api skill. Use this skill the first time someone installs the Recoupable skills plugin, or when they say "set up Recoup", "install Recoup in Claude Code", "connect Claude to Recoup", or "I just joined the Recoup enterprise deal".

Backend & APIs

What this skill does


# Set up Recoup in Claude Code

End-to-end onboarding for a fresh Claude Code install. Run once per machine after `/plugin marketplace add recoupable/skills`. Takes a couple of minutes (an email PIN round-trip) and is idempotent — safe to re-run.

## What this skill does

1. Check whether this machine is already set up.
2. Confirm which email to register and request a verification PIN.
3. Verify the PIN to receive an API key tied to that real account.
4. Save the key to `~/.claude/recoup.env`.
5. Verify the key works.
6. Look up which org(s) the account belongs to via the Recoup API.
7. Seed `~/.claude/CLAUDE.md` so Claude routes music-industry questions through Recoup.
8. Print a smoke-test prompt.

Confirm each command before running anything that writes to the home directory or shell profile.

## Step 1 — Idempotency check

If `~/.claude/recoup.env` already exists, load it and verify:

```bash
test -f ~/.claude/recoup.env && source ~/.claude/recoup.env && \
  curl -s -o /dev/null -w "%{http_code}\n" \
    -H "x-api-key: $RECOUP_API_KEY" \
    "https://api.recoupable.com/api/accounts/id"
```

If the response is `200`, jump to Step 6 to refresh the org lookup and memory block. Announce: "Recoup is already set up on this machine — refreshing memory only."

If the file is missing or the key is invalid, continue.

## Step 2 — Confirm the customer's email

Look for the customer's email in the current Claude Code session context (e.g. `# userEmail` block in the system prompt, or earlier conversation). If found, confirm it:

> Should I register Recoup under `<email>`? A 6-digit verification code will be emailed there.

If unknown, ask:

> Which email should I register? We'll send a 6-digit verification code there.

This must be an email the customer controls — the API key returned at the end is tied to that account and inherits access to its orgs and artists. Do NOT use the `agent+{timestamp}@recoupable.com` shortcut for production setup; agent-pattern accounts cannot access customer data.

Capture the answer as `$RECOUP_EMAIL`.

## Step 3 — Request a verification PIN

```bash
curl -s -X POST "https://api.recoupable.com/api/agents/signup" \
  -H "Content-Type: application/json" \
  -d "{\"email\": \"$RECOUP_EMAIL\"}" | jq .
```

A 6-digit code is emailed. Prompt the customer to check their inbox (and spam folder).

## Step 4 — Verify the PIN, receive the API key

Ask:

> Enter the 6-digit code from the email sent to `<email>`:

Capture as `$RECOUP_PIN`, then:

```bash
RECOUP_API_KEY=$(curl -s -X POST "https://api.recoupable.com/api/agents/verify" \
  -H "Content-Type: application/json" \
  -d "{\"email\": \"$RECOUP_EMAIL\", \"code\": \"$RECOUP_PIN\"}" | jq -r .api_key)
[ -n "$RECOUP_API_KEY" ] && [ "$RECOUP_API_KEY" != "null" ] && echo "API key issued successfully."
```

If the result is empty or `null`, surface the raw response and try again — usually a mistyped or expired PIN. Codes are short-lived; re-run Step 3 to request a new one if needed.

Never echo any portion of the API key value — even a partial key in terminal history is a leak.

## Step 5 — Persist the key

Write to `~/.claude/recoup.env` with `chmod 600`. This is the canonical location every other Recoup skill looks for the key.

```bash
mkdir -p ~/.claude
cat > ~/.claude/recoup.env <<EOF
# Recoup API credentials — created $(date -u +%Y-%m-%dT%H:%M:%SZ)
# Account email: $RECOUP_EMAIL
export RECOUP_API_KEY="$RECOUP_API_KEY"
export RECOUP_API_URL="https://api.recoupable.com/api"
EOF
chmod 600 ~/.claude/recoup.env
```

Offer to source it from the shell profile so it's available every session. **Ask before editing dotfiles.** If yes:

```bash
SHELL_RC="$HOME/.zshrc"
[ -f "$HOME/.bashrc" ] && SHELL_RC="$HOME/.bashrc"
grep -q "recoup.env" "$SHELL_RC" || \
  echo '[ -f ~/.claude/recoup.env ] && source ~/.claude/recoup.env' >> "$SHELL_RC"
```

If declined, mention they can `source ~/.claude/recoup.env` per session.

## Step 6 — Look up the account's org(s)

Now that the key works, use the **`recoup-api` skill** (already installed as part of the recoupable/skills plugin) to list the orgs this account belongs to. Defer the endpoint choice to that skill — it knows the docs at `https://developers.recoupable.com` and will pick the correct call.

Interpret the result:

- **One org:** that's the account's org. Use it without asking.
- **Multiple orgs:** ask which one this Claude Code instance is being set up for.
  > You have access to: <list of org names>. Which should I focus this Claude Code instance on?
- **No orgs:** record `unspecified` and continue.

Export the chosen org name as `$ORG_CONTEXT` (and the id as `$ORG_ID` if returned) so Step 7 can capture it.

**Sanity-check the roster.** While you have the org, list its artists too (the `recoup-api` skill's Roster discovery: `GET /api/artists?org_id=$ORG_ID`). This confirms the key reaches real data and gives the account a quick "you're connected to: `<artist names>`". If **both** orgs and artists come back empty, the key is almost certainly a throwaway `agent+…@recoupable.com` account, not the customer's — say so and re-run from Step 2 with the correct email rather than continuing with an empty roster.

## Step 7 — Seed Claude Code memory

Append a Recoup block to `~/.claude/CLAUDE.md` between sentinel markers so re-runs replace cleanly. Do not overwrite other content.

```bash
export ORG_CONTEXT
python3 - <<'PYEOF'
import os, pathlib, re, datetime
path = pathlib.Path.home() / ".claude" / "CLAUDE.md"
existing = path.read_text() if path.exists() else ""
block = f"""<!-- recoup-setup:start -->
## Recoup is installed

- **Org context:** {os.environ.get("ORG_CONTEXT", "unspecified")}
- **API key:** sourced from `~/.claude/recoup.env` (env var `RECOUP_API_KEY`)
- **Base URL:** `https://api.recoupable.com/api`
- **Auth header:** `x-api-key: $RECOUP_API_KEY`
- **Docs:** https://developers.recoupable.com
- **Last refreshed:** {datetime.datetime.now(datetime.UTC).isoformat()}

### When to use Recoup

For any music-industry question — streaming data, monthly listeners,
playlist placements, audience demographics, artists, songs, catalogs,
releases, campaigns, content creation (videos / images / captions /
lipsync), social analytics, A&R research, or syncing Google Docs / Drive
/ Sheets — reach for the Recoup skills first. Do not answer from training
data.

Recoup is REST-only. There is no MCP integration — call the API
directly via the `recoup-api` skill.

### Which skill to reach for

| Ask | Skill |
|-----|-------|
| Direct REST calls / docs navigation / connector actions (Google Docs / Drive / Sheets, TikTok, Gmail) | `recoup-api` |
| Artist analytics, streaming, audience research | `music-industry-research`, `chart-metric` |
| Hitting streaming milestones | `streaming-growth` |
| Generate video / image / caption | `content-creation` |
| Plan or write a release campaign | `release-management` |
| Manage artist workspace files | `recoup-artist-workspace`, `recoup-setup-sandbox` |
| Lyrics / song structure | `song-writing`, `trend-to-song` |
<!-- recoup-setup:end -->
"""
pattern = re.compile(r"<!-- recoup-setup:start -->.*?<!-- recoup-setup:end -->\n?", re.DOTALL)
if pattern.search(existing):
    new = pattern.sub(block, existing)
else:
    new = (existing.rstrip() + "\n\n" + block) if existing else block
path.write_text(new)
print(f"Wrote {path}")
PYEOF
```

Pass `ORG_CONTEXT` through the environment so the block records the org name resolved in Step 6.

## Step 8 — Smoke test

Print:

> You're set. Try one of these to verify Recoup is wired in:
>
> - "Look up Bad Bunny's monthly listeners on Recoup"
> - "Build me a release plan for `<artist>` using the release-management skill"
> - "Pull audience demographics for `<artist>` via music-industry-research"
>
> If something misfires, re-run the `recoup-setup` skill — it's idempotent.

## Failure modes

- **`jq: command not found`** — install via `brew install jq` (macOS) or `apt-get install jq` (Linux). The 

Related in Backend & APIs