Command Palette

Search for a command to run...

Назад к скиллам
скилл № 21359

billing-automation

Automates invoice generation, billing workflows, payment tracking, and revenue recognition for SaaS and service businesses. Use when building billing…

БесплатноБез исполняемых скриптов
TerminalSkillsот TerminalSkills★ 221 звезда на GitHub15 установок в других каталогах

Установить billing-automation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Billing Automation

Overview

Build automated billing workflows covering invoice generation, PDF rendering, payment processing, dunning (payment failure handling), and financial reporting. Handles proration, usage-based billing, multi-currency support, tax calculation, discounts, and professional invoice document generation.

Instructions

1. Define the Billing Model

  • Flat subscription: Fixed price per period (monthly/annual)
  • Usage-based: Metered billing (API calls, storage, compute hours)
  • Tiered: Volume-based pricing with breakpoints
  • Hybrid: Base subscription + usage overage
  • Per-seat: Price per active user

2. Design the Invoice Data Model

invoices (
  id, customer_id, invoice_number, status,
  billing_period_start, billing_period_end,
  subtotal, tax_amount, total, currency,
  due_date, paid_at, created_at
)
invoice_line_items (
  id, invoice_id, description, quantity, unit_price,
  amount, metadata_json
)
payments (
  id, invoice_id, amount, currency, method,
  processor_ref, status, paid_at
)

3. Invoice Generation Pipeline

For each billing cycle:
  1. Aggregate usage events for the billing period
  2. Apply pricing rules (tiers, discounts, proration)
  3. Calculate taxes based on customer location
  4. Generate invoice record with line items
  5. Render PDF with company branding
  6. Send via email and store in customer portal
  7. Initiate payment collection (auto-charge or payment link)
  8. Handle payment success/failure with appropriate follow-up

4. Generate Invoice PDFs

Gather required information and render professional documents:

  • Sender: Company name, address, email, phone, logo, tax ID
  • Recipient: Client name, address, contact information
  • Invoice number: Auto-generate sequential (INV-YYYY-NNN) or use custom scheme
  • Line items: Description, quantity, unit price, amount
  • Calculations: Subtotal, discount, tax (VAT/GST/sales tax), total
  • Payment terms: Net 30/60, accepted methods, bank details
from decimal import Decimal, ROUND_HALF_UP

CENT = Decimal("0.01")

def _money(value):
    return value.quantize(CENT, rounding=ROUND_HALF_UP)

def calculate_invoice(items, tax_rate="0", discount="0"):
    """items: [{"quantity": 12, "unit_price": "29.00"}]; tax_rate and discount are percentages."""
    subtotal = sum(Decimal(str(i["quantity"])) * Decimal(i["unit_price"]) for i in items)
    discount_amount = _money(subtotal * Decimal(discount) / 100)
    taxable_amount = subtotal - discount_amount          # tax is charged after the discount
    tax_amount = _money(taxable_amount * Decimal(tax_rate) / 100)
    total = taxable_amount + tax_amount
    return {
        "subtotal": _money(subtotal),
        "discount": discount_amount,
        "tax": tax_amount,
        "total": _money(total),
    }

# calculate_invoice([{"quantity": 1, "unit_price": "3500.00"},
#                    {"quantity": 1, "unit_price": "1200.00"},
#                    {"quantity": 12, "unit_price": "29.00"}], tax_rate="20", discount="10")
# -> subtotal 5048.00, discount 504.80, tax 908.64, total 5451.84

Use Decimal, not float: round() on floats uses banker's rounding and binary floats drift (0.1 + 0.2 is not 0.3). In JavaScript, keep amounts in integer cents or use a decimal library.

For PDF rendering, use reportlab (Python) or PDFKit (Node.js) with a clean layout: header with company info, invoice metadata, bill-to section, line items table, totals, and payment terms.

5. Handle Edge Cases

  • Proration: Calculate partial charges for mid-cycle upgrades
  • Credits: Apply account credits before charging payment method
  • Disputes: Mark invoice as disputed, pause dunning
  • Refunds: Generate credit notes linked to original invoice
  • Currency: Store amounts in smallest unit (cents); display with proper formatting
  • Tax: Integrate with tax service for multi-jurisdiction compliance

6. Dunning (Payment Failure) Workflow

Payment failed:
  Day 0: Retry payment, send "payment failed" email
  Day 3: Retry with updated payment method prompt
  Day 7: Final retry, warn about service suspension
  Day 14: Suspend service, send "account suspended" email
  Day 30: Cancel subscription, final notice

If you bill through Stripe, let Stripe run the retries where you can. Stripe Smart Retries picks retry times with its own model, and a custom retry schedule allows up to three retries, each a set number of days after the previous attempt. Your own schedule in code then covers only the emails, suspension and cancellation steps. Each failed attempt fires invoice.payment_failed, so use that event to drive the escalation stages.

Examples

Example 1: Usage-based invoice generation

User prompt: "Generate monthly invoices for our API platform. Tiered pricing: first 10,000 calls free, 10,001-100,000 at $0.001 each, 100,001+ at $0.0005 each."

calculateTieredPricing(
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _scores.json

FAQ

Что делает скилл billing-automation?

Automates invoice generation, billing workflows, payment tracking, and revenue recognition for SaaS and service businesses. Use when building billing pipelines, generating invoice PDFs, usage-based invoicing, subscription management, payment reminders, or financial reporting. Trigger words: invoice, billing, payment, subscription, usage billing, revenue recognition, accounts receivable, dunning, proration, Stripe billing, generate invoice, create bill.

Как установить скилл billing-automation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл billing-automation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить billing-automation с