ワンクリックで
billing
// Use when changing Comp AI billing, Stripe products/prices, subscription checkout, org payment methods, entitlements, usage ledgers, invoices, or billing webhooks.
// Use when changing Comp AI billing, Stripe products/prices, subscription checkout, org payment methods, entitlements, usage ledgers, invoices, or billing webhooks.
| name | billing |
| description | Use when changing Comp AI billing, Stripe products/prices, subscription checkout, org payment methods, entitlements, usage ledgers, invoices, or billing webhooks. |
| metadata | {"short-description":"Comp AI billing architecture"} |
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.
@trycompai/billing for SKU keys, amounts, Stripe product IDs, Stripe price IDs, cadence, and included usage.OrganizationBilling.stripeCustomerId, stripePaymentMethodId, and paymentMethodUpdatedAt.skuKey.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).pentest_monthly_1 ($299/mo, 1 scan), pentest_monthly_3 ($499/mo, 3 scans), and pentest_monthly_5_current ($899/mo, 5 scans).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.
packages/billing/src/index.ts and packages/billing/src/sku-definitions.ts.mode: subscription.Handle these events before launching subscription access:
checkout.session.completedinvoice.paidinvoice.payment_failedinvoice.payment_action_requiredcustomer.subscription.updatedcustomer.subscription.deletedProvision or renew allowance only for the matching subscription item and SKU. Do not use generic invoice-level periods for multi-item subscriptions.
bun run db:generate after Prisma schema changes.bun run check:prisma-schemas to catch stale copied schema fragments.The contract every new or modified API endpoint must follow so it is correct for the public OpenAPI spec, the MCP server (npm @trycompai/mcp-server), the ValidationPipe, and the docs. Triggers on "new endpoint", "add API", "new DTO", "@Body", "@RequirePermission", "MCP tool", "edit controller in apps/api", "OpenAPI", or whenever editing controllers under apps/api/src/.
MUST run after writing or modifying code — reviews changed files for verbose patterns, inconsistencies, and readability issues before considering work done
Audit & fix design system usage — migrate @trycompai/ui and lucide-react to @trycompai/design-system
Audit & fix hooks and API usage patterns — eliminate server actions, raw fetch, and stale patterns
Audit & fix RBAC and audit log compliance in API endpoints and frontend components
Audit & fix unit tests for permission-gated components