Skip to content
cccskills
FreePublished on GitHub

billing

Use this skill when changing subscription billing with Stripe. It guides catalog and SKU updates, checkout, local entitlements and usage records, audit events, and webhook handling that tolerates retries and out-of-order delivery.

OriginalShow the original description

Use when changing Comp AI billing, Stripe products/prices, subscription checkout, org payment methods, entitlements, usage ledgers, invoices, or billing webhooks.

trycompai/comp2,058 stars(GitHub 2,058 + cccskills 0)
Works withStripe

Run score Not tested

See how to install

Good for

  • Adding or updating a billing SKU
  • Implementing subscription checkout
  • Handling billing webhooks safely
  • Recording usage and entitlement changes

Files included (1)

  • SKILL.md3.2 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Billing

Comp AI billing is SKU-first and subscription-ready. Stripe is the payment provider; Comp AI owns catalog definitions, entitlement state, usage gating, and audit history.

Core Rules

  • Use @trycompai/billing for SKU keys, amounts, Stripe product IDs, Stripe price IDs, cadence, and included usage.
  • Do not add product-specific nullable fields to OrganizationBilling.
  • Keep org-level billing generic: stripeCustomerId, stripePaymentMethodId, and paymentMethodUpdatedAt.
  • Store per-product state in generic per-SKU tables keyed by skuKey.
  • Gate paid actions from local entitlement/usage state, not directly from Stripe object reads.
  • Treat Stripe webhooks as eventually consistent, retryable, and possibly out of order.
  • Make webhook and entitlement handling idempotent with Stripe event IDs, invoice IDs, subscription item IDs, and period start/end.
  • Archive accidental live/test Stripe objects instead of reusing them blindly.

Current SKU Shape

  • Active background-check subscriptions: background_checks_monthly_3 ($79/mo, 3 checks), background_checks_monthly_10 ($199/mo, 10 checks), and background_checks_monthly_20 ($399/mo, 20 checks).
  • Active penetration-test subscriptions: pentest_monthly_1 ($299/mo, 1 scan), pentest_monthly_3 ($499/mo, 3 scans), and pentest_monthly_5_current ($899/mo, 5 scans).
  • Deprecated / legacy SKUs remain in the catalog for historical Stripe records: background_check_one_time, background_checks_monthly_25, pentest_monthly_4, pentest_monthly_5, and pentest_monthly_10.

Live catalog entries should only be added after deliberate live Stripe object creation.

Implementation Pattern

  1. Add or update SKU definitions and Stripe IDs in packages/billing/src/index.ts and packages/billing/src/sku-definitions.ts.
  2. Store Stripe IDs in the catalog by environment rather than adding new env vars.
  3. Create subscriptions through Stripe Checkout mode: subscription.
  4. Use the shared Stripe customer default payment method unless the product explicitly needs overrides.
  5. For allowance products, sync local subscription state from Stripe subscription items and period timestamps.
  6. Record usage in the billing usage ledger with a stable idempotency key.
  7. Record support-relevant mutations in billing audit events.

Webhooks

Handle these events before launching subscription access:

  • checkout.session.completed
  • invoice.paid
  • invoice.payment_failed
  • invoice.payment_action_required
  • customer.subscription.updated
  • customer.subscription.deleted

Provision or renew allowance only for the matching subscription item and SKU. Do not use generic invoice-level periods for multi-item subscriptions.

Validation

  • Run bun run db:generate after Prisma schema changes.
  • Run bun run check:prisma-schemas to catch stale copied schema fragments.
  • Run catalog tests after SKU changes.
  • Add webhook tests for duplicate events, out-of-order delivery, payment failure, action required, cancellation, and renewal.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Guide API endpoint changes so request DTOs, runtime validation, OpenAPI documentation, and MCP tool metadata stay aligned. It covers discoverability, authentication, uploads, long-running tasks, and response types that MCP tools cannot handle.

  • Adding an API endpoint with a request body
  • Updating DTO validation and OpenAPI metadata
  • Making an endpoint available as an MCP tool
trycompai/comp2.1KUpdated Oct 24, 2026

Review specified files for design system usage, replace legacy @trycompai/ui components and lucide-react icons with available @trycompai/design-system equivalents, and run the app type check to verify the migration.

  • Migrating legacy UI components
  • Replacing lucide-react icons with Carbon icons
  • Checking specified files for design system compliance
trycompai/comp2.1KUpdated Oct 24, 2026

audit-hooks

FreeSummary

Review specified files for outdated hook and API patterns, then replace them with the prescribed SWR hooks, API clients, or server API calls. The guidance covers data fetching, mutations, cache updates, and response handling, followed by a typecheck command.

  • Auditing files for disallowed API and hook patterns
  • Replacing raw fetch calls with the API client
  • Migrating server actions and database mutations to API hooks
trycompai/comp2.1KUpdated Oct 24, 2026

audit-rbac

FreeSummary

Review NestJS API endpoints and frontend components for role-based access control and audit log compliance. The skill lists permission, guard, route, and UI gating rules, then directs the agent to fix violations and run type checks.

  • Auditing API routes for permission decorators
  • Checking UI actions against user permissions
  • Fixing access control inconsistencies
trycompai/comp2.1KUpdated Oct 24, 2026

audit-tests

FreeSummary

Audit unit tests for components that use permissions. Add missing tests and fix failures, checking that administrators can use mutation controls, auditors cannot, and read-only content remains visible to both.

  • Adding permission tests for a component
  • Checking admin and auditor behavior
  • Fixing failing permission-related tests
trycompai/comp2.1KUpdated Oct 24, 2026

Set up Better Auth for TypeScript applications, including server and client configuration, database adapters, sessions, email and social sign-in, and plugins. The guide also highlights environment variables, schema generation, and security settings to review.

  • Configuring Better Auth in a TypeScript app
  • Connecting an ORM or database adapter
  • Setting up sessions and cookie storage
trycompai/comp2.1KUpdated Oct 24, 2026

See all skills by trycompai

Report a problem with this skill