Skip to main content
skill CX Codex

revenuecat-identify-user — Claude Code skill: tie auth to RevenueCat

Wires your app's login and logout to RevenueCat so app users and subscribers match up.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add RevenueCat/ai-toolkit --skill revenuecat-identify-user -a claude-code
Open on GitHub

What revenuecat-identify-user does

This skill covers the identity half of RevenueCat: calling logIn and logOut on the SDK. It first detects your platform from project files — react-native-purchases in package.json means React Native, pubspec.yaml means Flutter, a kotlin { … } block in build.gradle.kts means Kotlin Multiplatform, then Android and iOS. It reads the matching platform file, where both calls sit inside a typical auth state observer.

The shared rules are where the sharp edges are. RevenueCat hands out an anonymous ID prefixed $RCAnonymousID: until logIn runs, and purchases made anonymously get aliased onto the real appUserID on first login, so nothing is lost. Do not pass email, phone number or a sequential database id as the appUserID — use an opaque backend UUID or a hash, because the value is hard to change later. logOut only works on an identified user; on an anonymous ID every SDK throws.

Switching accounts means logOut, wait, then logIn with the new ID. A second logIn without the logout aliases the two IDs together. Purchases.configure(…) has to run first or the SDK throws. Initial SDK setup, purchases and entitlement gating live in other skills.

What it helps with

  • attach anonymous purchases to a user after login
  • switch subscriptions when a user changes accounts
  • call logIn from an auth state listener
  • handle logOut on an anonymous user without a crash
  • pick a stable appUserID instead of an email

Example prompts for the agent

  • Tie my app's login to RevenueCat: call logIn after the session is confirmed
  • User signs out and back in as someone else — do logOut, then logIn
  • Set up RevenueCat identity for my Flutter project

How to install revenuecat-identify-user

1Skills CLI (Vercel)

npx skills add RevenueCat/ai-toolkit --skill revenuecat-identify-user -a claude-code

2Manually: put the files in place

~/.claude/skills/revenuecat-identify-user/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/revenuecat-identify-user/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about revenuecat-identify-user

How do I install revenuecat-identify-user in Claude?

Run npx skills add RevenueCat/ai-toolkit --skill revenuecat-identify-user -a claude-code. The skill lands in ~/.claude/skills/revenuecat-identify-user/SKILL.md.

What does revenuecat-identify-user do?

It shows how to call logIn and logOut on the RevenueCat SDK so your app users line up with RevenueCat subscribers. It detects the platform and reads the matching file.

How is restorePurchases() different from logIn?

restorePurchases() asks the store for the current receipt and attaches it to the current RevenueCat user; it does not switch identities. On a new device, call logIn(appUserID) first.

Source text

SKILL.md · MIT
---
name: revenuecat-identify-user
description: Tie RevenueCat identity to your app's auth system. Use when the user asks to log in to RevenueCat, sync a user with RevenueCat, switch RevenueCat user on login, log out of RevenueCat, move a user from anonymous to identified, set appUserID, or handle account switching on iOS, Android, Kotlin Multiplatform, Flutter, or React Native.
---

# revenuecat-identify-user: connect RevenueCat to your auth system

Use this skill when the user wants to call `logIn` / `logOut` on the RevenueCat SDK so that their app users line up with RevenueCat subscribers. This skill does not cover initial SDK setup (see `integrate-revenuecat`), purchases (`revenuecat-purchase-flow`), or gating (`revenuecat-entitlements-gate`).

## 1. Detect the platform

Inspect the working directory and pick the **first** match, from top to bottom:

1. **React Native**: `package.json` has a `react-native-purchases` entry, or `react-native` as a dependency → read `platforms/react-native.md`. If `expo` is also a dependency, note it as an Expo project.
2. **Flutter**: `pubspec.yaml` exists at the project root → read `platforms/flutter.md`.
3. **Kotlin Multiplatform**: `build.gradle.kts` contains a `kotlin { … }` multiplatform source sets block, or depends on `com.revenuecat.purchases:purchases-kmp*` → read `platforms/kmp.md`.
4. **Android (native)**: `build.gradle(.kts)` applies `com.android.application` (and is not KMP) → read `platforms/android.md`.
5. **iOS (native)**: `Package.swift`, `*.xcodeproj`, `*.xcworkspace`, or `Podfile` at the project root → read `platforms/ios.md`.

If several match (e.g. an `ios/` folder inside a Flutter project), pick the **outermost** project, the one that owns the build. If still ambiguous, ask the user which platform they want to configure.

## 2. Shared concepts (all platforms)

- **Anonymous by default.** Before `logIn` is called, RevenueCat assigns a stable anonymous ID prefixed `$RCAnonymousID:`. Purchases made while anonymous are aliased onto the real `appUserID` the first time `logIn` is called with it, so there is no "lost purchase" risk from letting users buy before signing in.
- **Never use email, phone number, or a sequential database id as the appUserID.** Use a stable opaque value such as your backend's user UUID, or a hash of the user id. RevenueCat treats the ID as an opaque string and it is difficult to change later.
- **Call `logIn` after your auth system confirms the session.** Do not call `logIn` speculatively. The typical trigger is your auth state listener firing with a signed in user. `logIn` returns both the user's current `CustomerInfo` and a `created: Boolean` that tells you whether this is a brand new RevenueCat customer.
- **`logOut` only works on identified users.** Calling `logOut` while the SDK is on an anonymous ID throws an error in every SDK (`PurchasesErrorCode.LogOutWithAnonymousUserError` or the iOS equivalent). Gate it behind your own "is signed in" flag.
- **Restore is not login.** `restorePurchases()` asks the store for the current receipt and attaches it to the current RevenueCat user. It does not switch identities. If the user signs in on a new device, call `logIn(appUserID)` first, then `restorePurchases()` only if they also expect to pull a receipt from the current store account.
- **Account switching is `logOut` then `logIn`.** If your app lets a user sign out and sign back in as someone else, call `logOut()` first, wait for it, then `logIn(newId)`. Do not try to swap directly with a second `logIn`, since that will alias the two IDs together.
- **Configure first.** `Purchases.configure(…)` must have run before `logIn` / `logOut`. If it has not, the SDK throws.

## 3. Implementation

Read the platform file that matches detection:

- `platforms/ios.md`
- `platforms/android.md`
- `platforms/kmp.md`
- `platforms/flutter.md`
- `platforms/react-native.md`

Each platform file shows the `logIn` and `logOut` calls wired into a typical auth state observer.

## 4. Verify

Do not claim identity sync works until:

1. In the RevenueCat dashboard, the Customer page for your test user shows the **same** appUserID your backend uses, not the `$RCAnonymousID:` placeholder.
2. Signing out clears the ID back to a fresh anonymous user; signing in as a different account switches to that account's purchases (or shows none if it is a new account).
3. A purchase made while anonymous, followed by `logIn`, remains attached to the signed in user (aliased, not lost).
4. Calling `logOut` while already anonymous is handled, not treated as a crash or a silent success.

© RevenueCat · MIT · RevenueCat/ai-toolkit

Similar skills

Everything for Mobile →

From the same set25

revenuecat-purchase-flow A skill that writes the RevenueCat purchase and restore logic for your app. Useful when a custom paywall needs a working purchase call and a Restore button. CX Codex +1 978installs revenuecat-testing-setup Sets up a RevenueCat testing environment: Test Store, StoreKit config, sandbox, Google Play internal testing. No real charges. CX Codex +1 886installs revenuecat-entitlements-gate The skill checks a RevenueCat user's active entitlements and decides whether to show a paid feature. Useful when you need to hide something behind a subscription. CX Codex +1 831installs revenuecat-status Prints a status report for a RevenueCat project: apps, products, entitlements, offerings and webhooks. Useful when you need to see what is configured. CX Codex +1 825installs revenuecat-charts A skill that walks the agent through RevenueCat chart queries: options schema first, data second, then subscription metrics. CX Codex +1 757installs revenuecat-customer-center Adds RevenueCat's ready-made Customer Center screen so subscribers can cancel, request refunds and restore purchases without custom UI. CX Codex +1 715installs revenuecat-migrate A skill that walks an app through adopting RevenueCat or bumping the SDK to a new major version. It detects the platform first, then follows the steps. CX Codex +1 700installs rc-webhooks A skill for handling RevenueCat webhooks server-side: the event schema, deduplication by event.id, and the difference between cancellation, expiration and renewal. CX Codex +1 650installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor