detect-revenue-leakage-in-billing-events
Use when revenue should be higher than it is. Audits billing events for missed invoices, uncaptured usage, stale discounts still applied, and downgrades that never took effect.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- detect-revenue-leakage-in-billing-events
- description
- Use when revenue should be higher than it is. Audits billing events for missed invoices, uncaptured usage, stale discounts still applied, and downgrades that never took effect.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md366 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Detect revenue leakage in billing events
Leakage is revenue you earned but never billed or never collected. It hides in missing events, stale discounts and failed downgrades, and it is found by comparing what should have happened to what did.
Procedure
-
Enumerate the leak classes and their detectors:
- missed invoice: an active subscription with no invoice in a period where one is due.
- uncaptured usage: metered units recorded after the billing cutoff and never rolled into an invoice.
- stale discount: a coupon or trial with an
expires_atin the past still reducing the charge. - failed downgrade: a downgrade requested but the charge still at the old amount.
- unbilled overage: usage above the tier with no overage line.
-
Query each class as a delta between expected and actual in integer minor units.
-
Worked example, stale discount: 84 subscriptions still discounted 2500 minor each after expiry:
leak = 84 * 2500 = 210000minor = USD 2,100.00 per month, compounding every month it stays broken. -
Compute total leakage as the sum of the found deltas, then annualise
monthly_leak * 12to size the fix. -
Rank by size and by fix cost; a one-line coupon-expiry check beats a manual sweep.
-
For missed invoices, inspect the subscription state machine: a paused/reactivated transition that skipped invoice generation is the usual cause.
-
Add a reconciliation guard: at month-end assert
count(invoiced_subs) == count(active_subs)and alert on the gap. -
Fix forward and recover: back-bill where the contract allows; where it does not, book the write-off so the leakage is visible rather than silent.
-
Report leakage by class and the annualised total before and after the fix.
-
Check dunning suppression: a failed payment suppressed to avoid over-emailing can silence billing entirely for an account.
-
Alert when a subscription's charge drops month over month with no matching downgrade event; that is a silent discount or an error.
-
Reconcile metered usage against the plan entitlement to catch usage never captured.
-
Recompute expected invoice totals from contract terms and diff against issued invoices each month.
-
Log the fix and the recovered dollars so leakage reduction is measured, not asserted.
-
Re-run the detector after the fix and confirm the class is empty.
Pitfalls
-
A stale discount is invisible in net MRR because it just makes each charge smaller; only an expected-vs-actual delta finds it.
-
Usage recorded after the billing cutoff is dropped silently; a late-watermark check catches it.
-
Paused subscriptions that fail to reactivate keep billing at zero; the state machine must emit an invoice on resume.
-
Back-billing without a contract clause damages trust and can be legally unenforceable.
-
Fixing the cash leak but not the reporting one leaves leakage invisible next quarter.
-
Over-aggressive communication suppression quietly stops invoices for a whole segment.
-
A month-over-month charge drop with no downgrade event is leakage by another name.
-
Verifying a fix by anecdote rather than re-running the detector leaves the class still open.
-
Metered usage never reconciled to entitlement hides lost billable units indefinitely.
Verification
python3 -c "print(84*2500, 84*2500*12)"
# 210000 2520000 -> a $2,100.00/mo leak, $25,200.00 annualised
Report: leakage by class in minor units, the annualised total, the reconciliation guard added, and the before/after month-end assertion result.
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.