revenuecat-entitlements-gate — скилл для Claude Code: гейт по подписке
Скилл проверяет активные entitlements в RevenueCat и решает, показывать ли платную функцию. Пригодится, когда нужно спрятать фичу за подпиской.
npx skills add RevenueCat/ai-toolkit --skill revenuecat-entitlements-gate -a claude-codeЧто делает revenuecat-entitlements-gate
Скилл отвечает на один вопрос: есть ли у пользователя доступ к платной функции прямо сейчас. Он смотрит в customerInfo.entitlements.active — это словарь с идентификаторами entitlements. Если идентификатор там есть, доступ открыт. Если нет — закрыт, даже когда покупки когда-то были.
Гейтить по истории покупок не стоит: истёкшие подписки остаются в customerInfo.entitlements.all, но из active выпадают. Скилл разбирает два сценария — разовую проверку и слушателя, который срабатывает после покупки, восстановления, продления или истечения. Опрашивать состояние в цикле не нужно.
Перед первым вызовом SDK должен быть сконфигурирован через Purchases.configure(…), иначе проверка упадёт — для этого есть отдельный скилл integrate-revenuecat. Покупки и авторизацию этот скилл не трогает, за них отвечают revenuecat-purchase-flow и revenuecat-identify-user. Ещё момент: идентификатор entitlement в коде должен совпадать с тем, что настроен в дашборде RevenueCat. Опечатка тихо закроет доступ всем.
Какие задачи решает
- показать или спрятать платную функцию по статусу подписки
- проверить, есть ли у пользователя активный entitlement
- обновить интерфейс после покупки или истечения подписки без перезапуска
- отличить активную подписку от истёкшей
- разобраться, почему платная функция не открывается после оплаты
Примеры запросов агенту
- проверь, есть ли у пользователя активный entitlement premium, и спрячь экспорт, если нет
- сделай гейт для pro-функции на Flutter через RevenueCat
- подпишись на изменения entitlements и обновляй экран настроек
Как установить revenuecat-entitlements-gate
1Через Skills CLI (Vercel)
npx skills add RevenueCat/ai-toolkit --skill revenuecat-entitlements-gate -a claude-code2Вручную: положить файлы
~/.claude/skills/revenuecat-entitlements-gate/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/revenuecat-entitlements-gate/
1Через Skills CLI (Vercel)
npx skills add RevenueCat/ai-toolkit --skill revenuecat-entitlements-gate -a codex2Вручную: положить файлы
.agents/skills/revenuecat-entitlements-gate/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add RevenueCat/ai-toolkit --skill revenuecat-entitlements-gate -a cursor2Вручную: положить файлы
.cursor/skills/revenuecat-entitlements-gate/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install RevenueCat/ai-toolkit revenuecat-entitlements-gate2Вручную: положить файлы
.github/skills/revenuecat-entitlements-gate/SKILL.md1Через Skills CLI (Vercel)
npx skills add RevenueCat/ai-toolkit --skill revenuecat-entitlements-gate -a gemini-cli2Командой платформы
gemini skills install https://github.com/RevenueCat/ai-toolkit --path revenuecat/skills/revenuecat-entitlements-gateВручную: положить файлы
.devin/skills/revenuecat-entitlements-gate/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add RevenueCat/ai-toolkit --skill revenuecat-entitlements-gate -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о revenuecat-entitlements-gate
Как установить revenuecat-entitlements-gate в Claude?
Выполните npx skills add RevenueCat/ai-toolkit --skill revenuecat-entitlements-gate -a claude-code. Скилл окажется в ~/.claude/skills/revenuecat-entitlements-gate/SKILL.md.
Что делает revenuecat-entitlements-gate?
Проверяет, есть ли у пользователя активный entitlement в RevenueCat, и по этому решает, показывать платную функцию или нет. Плюс показывает, как подписаться на изменения статуса.
Нужно ли что-то настроить до его использования?
Да, SDK RevenueCat должен быть сконфигурирован через Purchases.configure(…). Если этого не сделать, вызов проверки завершится ошибкой.
Исходный текст
SKILL.md · MIT
---
name: revenuecat-entitlements-gate
description: "Check whether a RevenueCat user currently has access to a paid feature via entitlements. Use when the user asks to gate a feature behind premium, check if the user has a pro subscription, read customerInfo active entitlements, show or hide a feature based on subscription status, react to entitlement changes, or 'is the user subscribed' on iOS, Android, Kotlin Multiplatform, Flutter, or React Native."
---
# revenuecat-entitlements-gate: check a RevenueCat entitlement
Use this skill when the user wants to decide whether to show or hide a feature based on an active RevenueCat entitlement. The skill covers the one shot check and the reactive listener; it does not cover purchasing (see `revenuecat-purchase-flow`) or auth (`revenuecat-identify-user`).
## 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)
- **Check the entitlement identifier, not the product ID.** The identifier (for example `"premium"`) is configured in the RevenueCat dashboard and mapped to one or more products. Using the entitlement lets you change products, prices, and stores without touching app code.
- **`customerInfo.entitlements.active` is the source of truth.** It is a `Map<String, EntitlementInfo>` keyed by entitlement identifier. Presence in `active` means the user currently has access. Absence means they do not, regardless of past purchases.
- **Do not gate on purchase history.** Expired subscriptions still appear in `customerInfo.entitlements.all` but drop out of `active`. Use `active` only.
- **Fetch once, then subscribe.** The first `customerInfo` call returns a cached value quickly, and the SDK refreshes in the background. Every SDK exposes a listener or stream that fires when entitlements change (after a purchase, restore, renewal, or expiration). Subscribe to that instead of polling.
- **The SDK must be configured first.** If `Purchases.configure(…)` has not run, the entitlement call will fail. Set up the SDK via `integrate-revenuecat` before using this skill.
## 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 one shot check, the reactive subscription, and where to place each in a typical app.
## 4. Verify
Do not claim the gate works until:
1. A user with an active entitlement sees the gated feature, and a user without it does not.
2. When the entitlement state changes (test with a sandbox purchase or a manual grant in the dashboard), the UI updates without a manual restart, confirming the listener is wired.
3. The entitlement identifier in the code matches an identifier that exists in the RevenueCat dashboard. A typo here silently gates everyone out.
© RevenueCat · MIT · RevenueCat/ai-toolkit