本文へ移動
cccskills
無料GitHub で公開日本語紹介

billing

Stripeを使うサブスクリプションや決済、利用枠、請求Webhookの実装方針を確認し、SKUごとの状態管理や重複イベントへの対応を支援します。

原文原文の説明を見る

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

trycompai/compスター 2,058(GitHub 2,058 + cccskills 0)
連携ツールStripe

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • 請求SKUや価格を追加・変更したいとき
  • サブスクリプション決済を実装したいとき
  • 請求Webhookの再送に対応したいとき
  • 利用枠や請求履歴を記録したいとき

日本語での紹介

できること

Stripeを使う請求機能の実装方針を確認できます。製品や価格はSKU単位でカタログに定義し、組織共通の請求情報と製品ごとの状態を分けて管理します。有料操作の可否はStripeのオブジェクトを都度参照せず、ローカルの権利情報と利用状況で判定します。Checkoutによるサブスクリプション作成、利用枠の同期、利用台帳への記録、監査イベントの記録、Webhook処理の設計を支援します。Webhookは再送や順不同を想定し、イベントIDなどを使って二重処理を防ぎます。

こんなときに便利

Stripeの商品・価格やサブスクリプション、組織の支払い方法、利用枠、請求書、請求Webhookを変更するときに向いています。複数の商品を扱う際のSKU管理や、更新・キャンセル・支払い失敗を含むイベント処理を確認したい場合にも使えます。

使い方の例

  • 「新しいサブスクリプションSKUを追加する実装方針を確認してください」
  • 「StripeのWebhookで利用枠を更新する処理を見直してください」
  • 「利用台帳と監査イベントの記録を追加してください」

注意点

Prismaスキーマ変更後はbun run db:generateとbun run check:prisma-schemasを実行します。SKU変更時はカタログテストを、Webhook変更時は重複・順不同イベントなどのテストを追加します。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md3.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

api-endpoint-contract

無料概要あり

APIエンドポイントの追加・変更で、DTO、入力検証、OpenAPI仕様、MCPツールの説明や公開範囲を揃え、エージェントからも扱いやすいAPIに整えます。

  • APIエンドポイントを追加したいとき
  • DTOと入力検証を整えたいとき
  • MCPツールとしてAPIを公開したいとき
trycompai/comp2,0582026年10月24日 更新

audit-design-system

無料概要あり

既存コードのデザインシステム利用状況を調べ、旧UI部品やlucide-reactのアイコンを@trycompai/design-systemの部品・Carbonアイコンへ置き換えるスキルです。

  • 旧UI部品を移行したいとき
  • アイコンをCarbonに置き換えたいとき
  • 画面のデザインシステム準拠を確認するとき
trycompai/comp2,0582026年10月24日 更新

audit-hooks

無料概要あり

指定されたファイルのフックやAPI利用を点検し、禁止パターンをSWRやapiClientなどの指定方式へ修正するための監査手順と実装規約をまとめています。

  • 既存コードのAPI利用を点検したいとき
  • 生のfetchをapiClientに置き換えたいとき
  • 更新処理をSWRのmutateにそろえたいとき
trycompai/comp2,0582026年10月24日 更新

audit-rbac

無料概要あり

NestJSのAPIとフロントエンドを調べ、権限チェックや監査ログのルール違反を修正するための確認項目を示します。

  • APIの権限チェックを点検したいとき
  • 画面操作の権限制御を確認したいとき
  • RBAC違反を修正したいとき
trycompai/comp2,0582026年10月24日 更新

audit-tests

無料概要あり

権限で表示や操作が変わるコンポーネントの単体テストを点検し、不足分の追加や失敗の修正を行って、管理者と閲覧専用ユーザーの動作を確かめます。

  • 権限別の単体テストを追加したいとき
  • 管理者と監査ユーザーの表示を検証したいとき
  • 失敗する権限テストを修正したいとき
trycompai/comp2,0582026年10月24日 更新

better-auth-best-practices

無料概要あり

Better Authを使ったTypeScript認証の設定を支援し、データベース接続、セッション管理、メール認証、OAuth、プラグインやセキュリティ項目を整理します。

  • Better Authで認証を導入したいとき
  • DBやORMアダプターを接続したいとき
  • セッションの保存方法を設定したいとき
trycompai/comp2,0582026年10月24日 更新

trycompai のスキルをすべて見る

このスキルの問題を報告する