autumn-gating

Implements usage tracking and feature gating with the Autumn billing SDK.

2.7k|244|Updated Jan 21, 2025
One-click install
npx skills add https://github.com/useautumn/autumn --skill autumn-gating
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: autumn-gating
Source: https://github.com/useautumn/autumn/tree/main/packages/atmn-tests/.claude/skills/autumn-gating
Command: npx skills add https://github.com/useautumn/autumn --skill autumn-gating

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires autumn-js, autumn_sdk.

What problem does it solve?

Enforcing usage limits, metering feature consumption, and gating access based on a customer's plan requires wiring billing state into application code, which is error-prone when done manually against Stripe webhooks and custom entitlement logic.

Core Features & Use Cases

  • Feature Access Checks: Call the Autumn check function server-side (TypeScript, Python, or cURL) to verify a customer has sufficient balance before executing a protected action.
  • Usage Tracking: Record consumption with the track function after a successful action so balances decrement correctly.
  • Credit Systems: Deduct usage from a shared credit balance across multiple features with different per-unit costs, and gate boolean features like premium model access.
  • Use Case: An AI chatbot limits free users to a monthly message quota; the backend checks the messages feature balance before each request and tracks usage afterward, while React hooks show paywalls when limits are reached.

Quick Start

Ask the AI to add usage tracking and feature gating to your app using the Autumn SDK, checking access server-side before each protected action and tracking usage afterward.

Frequently Asked Questions about autumn-gating

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add usage-based feature gating to my app?

Use the Autumn SDK's check function with a customer ID and feature ID before executing a protected action, then call track afterward to decrement the balance. Always perform the check server-side, since frontend checks can be bypassed.

How do I check feature access with the Autumn SDK?

Call autumn.check with customerId, featureId, and requiredBalance; it returns an allowed boolean indicating whether the customer has sufficient balance. The same pattern works in TypeScript, Python, or via the /v1/check REST endpoint.

Can I use React hooks to enforce usage limits?

React hooks like useCustomer provide a client-side check function for UX purposes such as showing paywalls, but they read local state and can be bypassed. Enforcement must happen on the backend before any protected action.

How do credit systems work with multiple features?

Define a credit balance that multiple features draw from at different rates, then interact with the underlying feature IDs rather than the credit system directly. The requiredBalance parameter converts feature usage into the equivalent credit cost.

What setup is required before using Autumn gating?

You need an autumn.config.ts file in your project root, generated by running npx atmn init to log in, plus a secret key set as the AUTUMN_SECRET_KEY environment variable for backend SDK calls.