本文へスキップ
Pathrule

パターン

このページは英語でのみご覧いただけます。

Pricing and Plan Modeling

Pathruleルール1件 • メモリ2件

Pricing and plan modeling separates what a customer buys, what it costs, and what the product enables so commercial changes do not become conditionals across the codebase. This bundle defines immutable price versions, stable entitlement keys, catalog migrations, and subscription snapshots. Unlike Subscriptions and Usage Billing, it owns the product catalog and commercial model rather than metering and recurring access processing.

推奨されるパスの配置

Pathruleは各要素を対応するパスに配置するため、アシスタントはそれが属する場所でだけ参照します。これはインポート時に適用されるスコープで、ワークスペースで調整できます。

/ ワークスペースのルート
src/
billing/
catalog/
Never mutate a price already used by a subscription
Products, prices, and terms have separate identities
entitlements/
Entitlements are not plan names

ルール

1
Never mutate a price already used by a subscription/src/billing/catalog高強制Commercial changes create a new immutable price version with an explicit migration policy.
1Commercial changes create a new immutable price version with an explicit migration policy. Editing amount, currency, interval, included quantity, or tax behavior in place silently changes the meaning of historical and active subscriptions. Enforce this boundary in /src/billing/catalog so invalid work stops before it reaches another subsystem or creates an externally visible side effect.
2 
3- Give products and entitlements stable internal keys while treating display names as editable presentation.
4- Create a new price identifier for any monetary or billing-term change and record its effective window.
5- Keep legacy prices resolvable for invoices, credits, reporting, and subscriptions that have not migrated.
6- Require a migration decision for existing customers: grandfather, opt in, scheduled move, or contract-specific handling.
7 
8Verification: Create an active subscription, publish a replacement price, and confirm the original invoice path and entitlement snapshot do not change until the chosen migration runs.

メモリ

2
Entitlements are not plan names/src/entitlementsA plan is a commercial package, while an entitlement is a stable product capability with limits and conditions.
1A plan is a commercial package, while an entitlement is a stable product capability with limits and conditions. Resolve a subscription or contract into entitlement keys at one boundary and let product code ask for capabilities such as projects.create or exports.monthly_limit.
2 
3Keep marketing labels, provider price IDs, and billing intervals out of authorization checks. Represent quantitative limits and feature access separately so an add-on can alter one without cloning a plan. Version entitlement mappings and preserve the resolved snapshot used for each access period. Keep the decision explicit at /src/entitlements; moving it into an incidental caller makes behavior depend on which route happened to execute first.
4 
5See /src/billing/catalog for commercial versions and the subscription billing pattern for access state. That related boundary consumes this decision and carries the evidence that proves it still holds.
Products, prices, and terms have separate identities/src/billing/catalogThe thing sold, the amount and cadence charged, and the contractual conditions change on different timelines and serve different consumers.
1The thing sold, the amount and cadence charged, and the contractual conditions change on different timelines and serve different consumers. Model a product as the durable offer, a price as an immutable charge definition, and terms as eligibility, commitment, trial, renewal, or negotiated conditions.
2 
3Allow several prices to reference one product without implying identical entitlement mappings. Keep provider IDs as adapters around internal catalog IDs so a provider migration does not rewrite product logic. Snapshot the accepted commercial terms when an order or subscription begins. Keep the decision explicit at /src/billing/catalog; moving it into an incidental caller makes behavior depend on which route happened to execute first.
4 
5See /migrations for catalog transitions and /src/entitlements for capability resolution. That related boundary consumes this decision and carries the evidence that proves it still holds.

このパターンを使う理由

Agents branch on labels such as pro or enterprise, mutate prices in place, and conflate billing intervals with product capabilities, making every pricing change risky.

対象:SaaS teams evolving plans, prices, packaging, trials, add-ons, and customer-specific terms

アシスタントが次のことをしないようにします。

  • Plan-name conditionals spread through application code
  • Existing subscriptions changing when a catalog price is edited
  • Billing interval, price, and entitlement concepts collapsed into one field
ライセンス
Apache-2.0
バージョン
1.0.0
更新日
2026-08-25
ソースを見る