add-entitlement
Put a feature behind a paid plan, or give plans a new limit. Use when the user wants something available only on Pro, or a per-plan quota.
SKILL.md.claude/skills/add-entitlement/SKILL.md
GitHubAdd an entitlement
Plans and what they allow are in packages/contracts/src/billing.ts; Stripe holds the
prices. With billing off, every organization has everything (unlimited).
docs/files-and-billing.md, "Plans and entitlements", has the model.
- Declare it in
Entitlements, and set it in every plan inplansand inunlimited(false/truefor a feature, a number ornullfor a limit). Thesatisfiesclauses failcheck-typesuntil each has it. - Enforce it where the feature is used, in the API:
await this.billing.require(orgId, "<entitlement>")(BillingService, apps/api), which throwsENTITLEMENT_REQUIRED. A limit is checked where the count grows, likemembersinapps/api/src/auth/auth-plugins.ts. - Show it in the clients from
billing.overview: hide the feature or showUpgradeHint(apps/web/src/modules/billing/components/upgrade-hint.tsx), with its copy in every catalog. - Test in
apps/api/test/billing.integration.test.ts(against the fake Stripe): a free organization getsENTITLEMENT_REQUIRED, a paying one gets through, and with billing off everyone does. - Update the plans table in
docs/files-and-billing.md.
Done when
bun run check-types, bun run test and bun run test:integration pass, and the
reviewer agent reports nothing blocking.