Skill Cobranca Automatizada Saas Abacatepayのロゴ

Skill Cobranca Automatizada Saas Abacatepay

組織
IAPro-Community
skill-cobranca-automatizada-saas-abacatepay

AbacatePay(PIX+クレジットカード)を使ったSaaS向け自動請求エンジンです。設定可能な督促(regua de cobranca)、トライアル管理、請求書ポータル、メール(Resend)とWhatsApp(Evolution API)による通知、管理者向けCRUD、請求指標に対応します。プロビジョニングから料金回収まで、請求業務の全ライフサイクルをカバーします。

Add to TypingMind

概要

公開者IAPro-Community
リポジトリOrquestrador-Maestro
スキル名skill-cobranca-automatizada-saas-abacatepay
スター
63
フォーク
11
同梱ファイル
5
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 5個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    IAPro-CommunityがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Skill Cobranca Automatizada Saas Abacatepay」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/IAPro-Community/Orquestrador-Maestro/tree/v1/codex/skills/skill-cobranca-automatizada-saas-abacatepay
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/IAPro-Community/Orquestrador-Maestro.git /tmp/Orquestrador-Maestro
mkdir -p .claude/skills
cp -r /tmp/Orquestrador-Maestro/codex/skills/skill-cobranca-automatizada-saas-abacatepay .claude/skills/skill-cobranca-automatizada-saas-abacatepay
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSkill Cobranca Automatizada Saas Abacatepayを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSkill Cobranca Automatizada Saas Abacatepayを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Skill Cobranca Automatizada Saas Abacatepayは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

skill-cobranca-automatizada-saas-abacatepay

When To Use

This skill covers the complete automated billing system ("cobranca automatizada") for Brazilian SaaS products using AbacatePay. Use when implementing or maintaining:

=== Provisioning ===

  • Billing configuration tables (cobrancas, cobranca_reguas, billing_config, etc.)
  • Dunning rule sequencing (cobranca_regua_eventos)
  • Encrypted integration configs (Resend, Evolution API, AbacatePay)

=== Billing Engine ===

  • Automated invoice generation and dunning execution via cron
  • AbacatePay billing creation (PIX + CARD)
  • Webhook processing with HMAC-SHA256 verification
  • Invoice state machine (pending, paid, overdue, cancelled, refunded)
  • Subscription/plan integration via cobranca_tracking

=== Trial Management ===

  • Configurable trial duration
  • Pre-expiration notifications (7/3/1 days before)
  • Automatic trial expiration and account blocking

=== Interfaces ===

  • Public invoice page (FaturaPage) with PIX QR Code, payment link, polling
  • Pricing/Plans page with AbacatePay checkout
  • User-side invoice listing (MinhasCobrancasSection)
  • Admin billing management (cobranças CRUD, planos CRUD, global settings)
  • Plan Manager (PlanManager) for user plan changes

=== Notifications ===

  • Email via Resend with HTML templates (logo, badge, invoice details)
  • WhatsApp via Evolution API with template variables
  • Variables: {{nome}}, {{plano}}, {{valor}}, {{vencimento}}, {{link_pagamento}}, {{empresa_nome}}
  • Dunning sequence: configurable events with days_apos_vencimento, channel (email/whatsapp/ambos)

Architecture

                     +-------------------+
                     |   Cron (8/12/16h  |
                     |   BRT + 5min)     |
                     +--------+----------+
                              |
         +--------------------+--------------------+
         |                    |                    |
   Processar            Trial               Metrics
   Cobranças          Notificações          (meia-noite)
         |                    |
   +-----v------+      +-----v------+
   | Ver regua   |      | Trial exp. |
   | Send notif  |      | Notif pre  |
   | Create bill |      +------------+
   +-----+------+
         |
   +-----v------------------------------------------+
   |           Controller Layer                      |
   |  cobrancas.ts | abacatepay-webhook.ts           |
   |  fatura.ts    | trial.ts                        |
   +-----+----------------------------+--------------+
         |                            |
   +-----v----------+        +--------v---------+
   |  AbacatePay    |        |  Notifications    |
   |  API v2        |        |  Resend + Evol.  |
   +----------------+        +------------------+
         |
   +-----v----------+
   |  Supabase/     |
   |  PostgreSQL    |
   +----------------+

Billing State Machine

pending ──► paid ──► refunded
  │
  ├──► overdue ──► paid
  │             └──► cancelled
  │
  └──► cancelled

States managed by invoice-state-machine.ts:

  • pending: cobrança criada, aguardando pagamento
  • paid: paga, released_at setado, conteúdo liberado
  • overdue: vencida, entra na régua de cobrança
  • cancelled: cancelada manualmente ou por expiração
  • refunded: estornada (transição exclusiva de paid)

Key Tables

TablePurpose
cobrancasCore billing records per user
cobranca_reguasDunning rule sets per tenant
cobranca_regua_eventosIndividual dunning events in sequence
billing_configEncrypted integration configs (Resend, Evolution, AbacatePay)
front_usersUser profiles with plan and status
partner_billing_configPartner-specific billing overrides
cobranca_trackingSubscription-like recurring billing tracking
transaction_logBilling operation audit log
abacatepay_eventsRaw webhook event storage

Full details in billing-tables.md.

Core Flows

Dunning Flow (Régua de Cobrança)

  1. Cron runs billing-cron.ts at 8h/12h/16h BRT
  2. Queries cobrancas WHERE status = 'overdue' AND NOT paga
  3. For each cobranca, resolves billing_config + cobranca_regua + cobranca_regua_eventos
  4. Checks if next evento should fire (based on dias_apos_vencimento)
  5. Sends notification via billing-sender.ts (email + WhatsApp)
  6. If all eventos fired and still overdue, marks as cancelled

Webhook Flow

  1. POST /api/abacatepay-webhook receives an AbacatePay v2 event
  2. HMAC-SHA256 signature verification (replay + timing-safe compare)
  3. Rate limited: 100 req/min per IP
  4. On checkout.completed or subscription.renewed: processPaymentWithTransaction updates cobranca + cobranca_tracking
  5. On failure: processRollback reverts state
  6. Raw event stored in abacatepay_events

Trial Flow

  1. trial-cron.ts runs every 5 minutes
  2. Queries users where trial ends within notification window
  3. Sends pre-expiration notifications (7/3/1 day before)
  4. On expiration: blocks account (status = blocked)
  5. billing-cron.ts also handles trial notifications at 8/12/16h

Invoice Portal Flow

  1. FaturaPage loads by shortlink (8 chars, unique)
  2. Materializes billing from AbacatePay API on demand
  3. Shows: PIX QR Code, payment link, due date, amount, status badge
  4. Polls status every 5 seconds
  5. "Share via WhatsApp" button with pre-formatted message

Configuration

billing_config stores encrypted credentials per owner (AES-256-GCM):

  • resend_config: Resend API key + from email
  • evolution_config: Evolution API URL + API key + instance
  • abacatepay_config: AbacatePay API key
  • trial_duration_days: Trial length (default)
  • Encryption key: BILLING_CONFIG_ENCRYPTION_KEY env var

See billing-config.md for full schema and setup.

Provider API Boundary

  • AbacatePay: new code uses API v2 and the webhook events checkout.completed, checkout.refunded, checkout.disputed, subscription.completed, subscription.renewed, and subscription.cancelled. The legacy v1 billing.* events belong behind a migration adapter.
  • Resend: keep the key server-side and send through the official SDK or POST https://api.resend.com/emails with Authorization: Bearer <key> and a User-Agent; use Idempotency-Key for retryable sends, record provider request IDs, and redact message content from logs.
  • Evolution API: use the deployed v2 documentation and apikey header; keep instance credentials server-side and account for v2.4.0 activation/licensing before diagnosing business-endpoint failures.

Guardrails

  1. Keep ALL payment provider secrets server-side. Never expose AbacatePay API keys in browser bundles.
  2. Process webhooks idempotently: check cobranca current state before mutating.
  3. Treat checkout redirect as advisory. Grant access only after webhook confirmation.
  4. Do not log API keys, webhook secrets, full CPF/CNPJ, full phone numbers.
  5. Cron must not overlap. billing-cron uses lock checks to prevent concurrent runs.
  6. Dunning notifications must respect channel preference (email, whatsapp, or ambos).
  7. Trial expiration is irreversible: set status = blocked, do not auto-unblock without payment.
  8. Metrics queries (MRR, faturamento) should use aggregateBillingMetrics(), not ad-hoc SQL.
  9. New integrations must use https://api.abacatepay.com/v2, /checkouts/create, /subscriptions/create, and /transparents/create as appropriate. Keep /v1/billing/* and billing.* only inside an explicit legacy adapter.

Local Reference (example-saas)

This skill is extracted from the example-saas SaaS billing system. The production codebase is at:

  • {{USER_HOME}}/Documents/Code/example-saas/server/controllers/cobrancas.ts — billing CRUD + processing + dunning
  • {{USER_HOME}}/Documents/Code/example-saas/server/controllers/abacatepay-webhook.ts — webhook handler
  • {{USER_HOME}}/Documents/Code/example-saas/server/controllers/fatura.ts — invoice lookup by shortlink
  • {{USER_HOME}}/Documents/Code/example-saas/server/controllers/trial.ts — trial expiration processing
  • {{USER_HOME}}/Documents/Code/example-saas/server/services/abacatepay-create-billing-v2.ts — AbacatePay billing creation
  • {{USER_HOME}}/Documents/Code/example-saas/server/services/billing-sender.ts — notification dispatch (email + WhatsApp)
  • {{USER_HOME}}/Documents/Code/example-saas/server/services/billing-email-template.ts — HTML invoice email template
  • {{USER_HOME}}/Documents/Code/example-saas/server/services/billing-integrations-config.ts — encrypted config management
  • {{USER_HOME}}/Documents/Code/example-saas/server/services/billing-metrics.ts — MRR and billing metrics
  • {{USER_HOME}}/Documents/Code/example-saas/server/utils/invoice-state-machine.ts — state machine logic
  • {{USER_HOME}}/Documents/Code/example-saas/server/cron/billing-cron.ts — main billing scheduler
  • {{USER_HOME}}/Documents/Code/example-saas/server/cron/trial-cron.ts — trial scheduler
  • {{USER_HOME}}/Documents/Code/example-saas/src/pages/FaturaPage.tsx — public invoice page
  • {{USER_HOME}}/Documents/Code/example-saas/src/components/PlansPage.tsx — pricing/plans page
  • {{USER_HOME}}/Documents/Code/example-saas/src/components/PlanManager.tsx — user plan manager
  • {{USER_HOME}}/Documents/Code/example-saas/src/components/AdminCobrancas.tsx — admin billing CRUD
  • {{USER_HOME}}/Documents/Code/example-saas/src/components/AdminPlanos.tsx — admin plan CRUD
  • {{USER_HOME}}/Documents/Code/example-saas/src/components/AdminGlobalSettings.tsx — global settings
  • {{USER_HOME}}/Documents/Code/example-saas/src/components/MinhasCobrancasSection.tsx — user invoice list
  • {{USER_HOME}}/Documents/Code/example-saas/supabase/migrations/20260617_cobrancas_foundation.sql — core tables
  • {{USER_HOME}}/Documents/Code/example-saas/supabase/migrations/20260617_cobrancas_website_final.sql — shortlink trigger
  • {{USER_HOME}}/Documents/Code/example-saas/supabase/migrations/20240101_billing_config.sql — billing_config table
  • {{USER_HOME}}/Documents/Code/example-saas/supabase/migrations/20240117_partner_billing.sql — partner billing

Reference Files

  • billing-tables.md — complete table schemas, indexes, enums, RLS policies
  • billing-flows.md — detailed flow diagrams and pseudocode for each core flow
  • billing-config.md — encryption, config resolution, and setup steps
  • billing-admin.md — admin interfaces and CRUD operations
  • billing-notifications.md — email/WhatsApp templates, dunning sequence, template variables

Validation

  • After changes, run build and typecheck (npm run build, npm run typecheck or equivalent)
  • Simulate webhook: POST checkout.completed and subscription.renewed events and verify idempotent processing
  • Test dunning: create overdue cobranca with regua de 0/3/7 dias and confirm notification dispatch
  • Test trial: set trial_duration_days=1, create user, wait for pre-expiration and expiration
  • Verify no AbacatePay/Resend/Evolution keys leak to browser bundles
  • Run project lint when available

Related Skills

  • skill-abacatepay-integration — AbacatePay v2 API specifics and legacy v1 migration boundary
  • skill-saas-core-limits — plan limits, entitlements, feature flags after payment
  • skill-evolution-api — WhatsApp notification channel
  • skill-supabase-rls — RLS policies for billing tables
  • skill-saas-factory — top-level SaaS construction entry

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Skill Cobranca Automatizada Saas Abacatepay」では何ができますか?

AbacatePay(PIX+クレジットカード)を使ったSaaS向け自動請求エンジンです。設定可能な督促(regua de cobranca)、トライアル管理、請求書ポータル、メール(Resend)とWhatsApp(Evolution API)による通知、管理者向けCRUD、請求指標に対応します。プロビジョニングから料金回収まで、請求業務の全ライフサイクルをカバーします。

TypingMindでSkill Cobranca Automatizada Saas Abacatepayを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Skill Cobranca Automatizada Saas Abacatepayはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSkill Cobranca Automatizada Saas Abacatepayをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/IAPro-Community/Orquestrador-Maestro/tree/v1/codex/skills/skill-cobranca-automatizada-saas-abacatepayを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Skill Cobranca Automatizada Saas Abacatepayを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Skill Cobranca Automatizada Saas Abacatepayで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSkill Cobranca Automatizada Saas Abacatepayを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Skill Cobranca Automatizada Saas Abacatepay」は無料ですか?

はい。IAPro-CommunityがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇