saas-billing-patterns

Implement subscription billing patterns for SaaS applications with code examples.

2|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/telum-ai/speck --skill saas-billing-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: saas-billing-patterns
Source: https://github.com/telum-ai/speck/tree/main/.cursor/skills/saas-billing-patterns
Command: npx skills add https://github.com/telum-ai/speck --skill saas-billing-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and code examples for implementing complex subscription billing systems for SaaS applications, addressing common challenges like state management, proration, and dunning.

Core Features & Use Cases

  • Subscription State Machines: Visual diagrams and SQL schemas for managing subscription lifecycle states (trialing, active, past_due, etc.).
  • Proration Logic: Code examples for calculating charges and credits when plans are changed mid-cycle.
  • Dunning Sequences: Strategies and code for recovering failed payments and managing grace periods.
  • Metered Billing: Implementations for tracking usage and hybrid pricing models.
  • Feature Gating: Examples of how to control feature access based on subscription plans.
  • Use Case: You are building a new SaaS product and need to implement a reliable subscription billing system that handles upgrades, downgrades, failed payments, and usage-based charges.

Quick Start

Use the saas-billing-patterns skill to generate a subscription state machine diagram and its corresponding SQL schema.

Frequently Asked Questions about saas-billing-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a subscription state machine for SaaS billing?

SaaS subscription state machines manage lifecycle states like trialing, active, and past_due. You can implement them using visual diagrams and corresponding SQL schemas to track subscription transitions and ensure accurate recurring revenue tracking.

What is proration in subscription billing and how is it calculated?

Proration in subscription billing calculates proportional charges or credits when users change plans mid-cycle. It requires tracking the remaining billing period and applying rate differentials to generate accurate invoices for plan upgrades or downgrades.

How do I handle failed payments and dunning sequences in SaaS?

Dunning sequences handle failed payments by managing grace periods and automated retry strategies. Implementing dunning logic allows your SaaS application to recover failed transactions and automatically transition subscriptions to past_due states when necessary.

How do I implement metered billing and hybrid pricing models?

Metered billing tracks usage metrics to calculate charges based on consumption rather than flat rates. Implementing hybrid pricing models requires tracking usage events and combining them with base subscription rates for accurate usage-based invoicing.

How do I control feature gating based on SaaS subscription tiers?

Feature gating controls application access based on active subscription plans. You implement this by mapping feature sets to subscription tiers and checking the user's current plan status before granting access to restricted functionalities.

Can I generate a SQL schema for SaaS subscription lifecycle states?

Yes, you can generate a SQL schema for subscription lifecycle states. The schema defines database structures for managing state transitions between trialing, active, and past_due statuses to maintain reliable recurring billing records.