Agent skill

Billing Review

by polarsource in polarsource/polar

Review a diff that touches Polar's billing domain — subscriptions, cycles and crons, orders, billing entries, meters and usage, discounts, checkout, payments and dunning, refunds, disputes, payouts…

MITAuto-check passedData & Analytics

Install Billing Review

skills CLI
$ npx skills add polarsource/polar --skill billing-review -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install polarsource/polar billing-review --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/polarsource/polar.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/billing-review .claude/skills/billing-review && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
billing-review
GitHub stars
10k
Token cost
~2.3k tokens
SKILL.md length
1,087 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
MIT

At a glance

Review a diff that touches Polar's billing domain — subscriptions, cycles and crons, orders, billing entries, meters and usage, discounts, checkout, payments and dunning, refunds, disputes, payouts…

  • Works in 10 steps: Money comes from billing entries, not… → Reuse the lifecycle, do not hand-roll… → Dunning decisions live in the dunning… → …
  • Asks for a billing review
  • SKILL.md covers Scope, Checks and Output
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Billing Review is an agent skill from polarsource/polar. Review a diff that touches Polar's billing domain — subscriptions, cycles and crons, orders, billing entries, meters and usage, discounts, checkout, payments and dunning, refunds, disputes, payouts, wallets, tax and invoices. Use before opening a PR that changes money movement or subscription lifecycle, when the user asks for a billing review, or when a reviewer needs the domain rules the team enforces in review but that no linter catches.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Data & Analytics, covering DataFrames, Scheduled and recurring tasks and Forms and invoices. The repository describes itself as: Polar — A billing platform for the intelligence era. The licence is MIT.

When your agent uses it

  • Asks for a billing review
  • A reviewer needs the domain rules the team enforces in review but that no linter catches

Example prompts

  • “/billing-review”

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Money comes from billing entries, not derived state
  2. Reuse the lifecycle, do not hand-roll the transition
  3. Dunning decisions live in the dunning entry point
  4. Payment locks release on one path
  5. Keep processor state in sync, keep processor names out of the domain
  6. Crons and batch jobs
  7. Discounts
  8. Amounts, currency and tax
  9. Free and zero-amount paths
  10. Billing-specific additions to rules owned elsewhere

What it can do on your machine

Read from SKILL.md and the folder at commit 71c1ac6. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Billing Review loads about 2.3k tokens when it runs. Until then it costs about 115 tokens; SKILL.md has 1,087 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~115
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from polarsource/polar at commit 71c1ac6, republished under its MIT licence (© polarsource). 1,087 words, ~2,258 tokens.

Download SKILL.mdSave it as .claude/skills/billing-review/SKILL.md (or your agent's skills folder).
name
billing-review
description
Review a diff that touches Polar's billing domain — subscriptions, cycles and crons, orders, billing entries, meters and usage, discounts, checkout, payments and dunning, refunds, disputes, payouts, wallets, tax and invoices. Use before opening a PR that changes money movement or subscription lifecycle, when the user asks for a billing review, or when a reviewer needs the domain rules the team enforces in review but that no linter catches.
license
MIT
metadata.author
polar
metadata.version
1.0.0

Billing Review (Polar)

The handle is the diff. The evidence is where the change breaks a billing invariant the team enforces in review.

Not a general code review. The other lenses know Polar's conventions, contract and deploy shape. This one knows how the billing domain is supposed to behave.

Distilled from ~210 review comments François (frankie567) left on billing PRs between February and August 2026, plus domain invariants raised by pieterbeulque, psincraian, joebon and Yopi on the same PRs. Each rule cites its PR.

Read .agents/skills/polar-billing.md first. That is the map of the domain — entities, services, tasks, the cycle flow, proration, dunning, the ledger. This file is the checklist that assumes it.

Scope

polar/{subscription,order,billing_entry,meter,event,discount,checkout,checkout_link}/
polar/{payment,payment_method,refund,dispute,payout,payout_account,wallet,transaction}/
polar/{invoice,receipt,tax,product,customer_seat,account}/  ·  polar/benefit/grant/
polar/models/{subscription,order,order_item,product,product_price,discount,checkout,
              payment,billing_entry,refund,dispute,wallet,transaction}.py
migrations/ and server/scripts/ when they touch those tables

Owned elsewhere: schema and SDK impact → api-surface-review; migration and actor deploy safety → ship-safety; lazy="raise" and repository conventions → conventions-check; ADR-0006 / ADR-0007 → adr-check; existing helpers → reuse-check.

For a domain question you cannot settle from the diff, ask it rather than assert a defect. That is how this team reviews.

Checks

1. Money comes from billing entries, not derived state

BillingEntry is the ledger tying an invoice line back to the events that caused it. Anything computing an amount from a summary or a recomputation loses that trace.

  • Invoicing metered usage reads billing entries, never the customer meter's computed balance. "Billing Entries are the source of truth… Otherwise, we lose the ability to track billing down to the events." (#12510)
  • If consumption happened, the entries already exist. New code that recomputes usage instead of picking up pending entries is a smell. (#12510)
  • Order creation is what consumes pending entries. The question for a new billing trigger is "should this create an order", not "should this compute an amount".
2. Reuse the lifecycle, do not hand-roll the transition

The cycle already moves periods, writes events, and grants or revokes benefits.

  • Changing plan during a trial: call update_trial so periods and events are right, then let it cycle naturally because the new period is already past — same as ending a trial immediately. (#11898)
  • New periodic behaviour gets a scheduler modelled on subscription/scheduler.py, not a bespoke loop. (#12990)
  • One cycle, one invoice. Overages from a meter cycle that coincides with a billing cycle belong on the renewal invoice, not a second order with a second payment. (#12510)
3. Dunning decisions live in the dunning entry point
  • The retry decision belongs in _handle_first_dunning_attempt, not the caller. Check the latest payment's decline code, set a retry date if recoverable, leave it None otherwise. Everything else (past due, benefit enqueue) is untouched. (#9744)
  • Never schedule a retry for a non-recoverable decline. (#9744)
  • Decline-code knowledge lives on the Payment model as a @property (UNRECOVERABLE_DECLINE_CODES), guarded by if self.processor == PaymentProcessor.stripe so a second processor does not inherit Stripe's codes. (#9744)
  • Retry-exhaustion arithmetic is a classic off-by-one. Check the boundary. (#11905)
4. Payment locks release on one path
  • The webhook handler for the payment outcome (handle_payment_failure) releases the lock. A caller that also releases it on its own error path is duplicated logic — delete it and its test. (#10653)
  • Never release a payment lock on success. release_on_success was removed from the codebase for this reason. A diff reintroducing it is a regression. (#10653)
  • with_for_update belongs in the task that owns the unit of work, not inside transfer_stripe. "This logic should be independent from Stripe behavior." (#12097)
  • A wedged lock breaks dunning silently. (#13272)
5. Keep processor state in sync, keep processor names out of the domain
  • Domain statuses mirror the processor's vocabulary. accepted was rejected as a dispute status because Stripe uses lost either way, and diverging breaks the sync. (#12713)
  • A merchant action with a processor counterpart makes the processor call in the same flow. "The risk is way too high to forget… and let the dispute expire." (#12713)
  • Name things after the domain: "Payout Account", not "Connect". (#12097)
Show full SKILL.md (456 more words)Show less
6. Crons and batch jobs
  • Catch-up loops hide missed runs. A while walking forward through skipped cycles computes credits wrong for the periods it skipped. Prefer an invariant alert that the cycle did not run. (psincraian, #12510)
  • Use repository.stream rather than a keyset loop over UUIDs. (#12749)
  • Loading every row in a script or sweep is a review stop. "Won't that blow up in memory?" (#11728, #13687)
7. Discounts
  • Redemption counting is the whole game. A failed payment should not count. A fully refunded order is an open question the team has not settled. (pieterbeulque, #13328)
  • Concurrent redemption of the same code needs a customer lock, and the caller acquires it — say so at the call site. (joebon, #13328)
  • max_redemptions and max_redemptions_per_customer are separate limits; a guard checking one usually needs both. (#13394)
  • Expiry is checked in cycle but has been missed elsewhere. New paths that apply a discount check it too — prefer extracting the shared check. (psincraian, #12510)
  • Multi-line discounts apply as a waterfall, not proportionally. Questioned in review as unusual for invoices; a change to allocation is a merchant-visible invoice change. (joebon, #12172)
8. Amounts, currency and tax
  • Fee values are basis points: 4% is 400. Check the unit before trusting arithmetic.
  • Per-jurisdiction tax comes straight from the Numeral API response. Recomputing it from rates and polar_round introduces fractional-cent drift. (#11211)
  • Tax sits on transactions of type payment, which are on the Polar side and not linked to the merchant's account. Transactions reach an organization through account_id; payment_organization_id is a Pledge-era leftover that does not mean what it looks like. (#12204)
  • On imports, tax-inclusive versus exclusive must mirror the source provider, or the merchant loses money. (#12502)
  • Voiding or reversing an order credits back what was applied (applied_balance_amount), not the customer's current balance. (#11637)
9. Free and zero-amount paths

These keep breaking because new code assumes a payment exists.

  • Keep ProductPrice.is_free / Checkout.is_free_product_price checks when reworking price handling. (#12225)
  • A new charge path supports a free price by skipping the payment step, not rejecting it. (#12089)
  • Renewal emails, invoices and receipts all have free-subscription branches. (#9291)
10. Billing-specific additions to rules owned elsewhere

Short pointers only — the owning lens reports the general rule.

  • Money tables are busy tables. orders, subscriptions, payments, customers, events. Heavy backfills go in a script; indexes go in concurrently. → ship-safety
  • Order foreign keys get ondelete="restrict". "A DELETE statement is easy to spawn." (#11206) → ship-safety
  • Lazy loads in money paths are stuck jobs, not just 500s. assert order.customer does not protect you — it raises the lazy-load error itself (#11900). When a denormalized column lands, the matching joinedload usually becomes dead; remove it (#12162). → conventions-check
  • Customers cannot choose proration behaviour, so it does not belong in the customer portal API. (#13095) → api-surface-review

Output

## Billing

### 🔴 Blocking
- `file:line` — <invariant broken>. Fix: <fix>

### 🟠 Should fix
- `file:line` — <claim>. Fix: <fix>

### 🟡 Question
- `file:line` — <question>

### Notes
- domain context the author may not have: <one line, or omit>

### Verdict
✅ Clean  |  ❌ n blocking, n should-fix

© polarsource, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/billing-review of polarsource/polar.

Open the folder on GitHubat commit 71c1ac6

Compare with similar skills

Billing Review next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Billing Review compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Billing Review this skillpolarsource/polar10k—~2.3kAutomated safety check: PassMIT
Data Analysisbrycewang-stanford/Auto-Empirical-Research-Skills4.5k—~1.2kAutomated safety check: NotesCustom licence
Mobile Platform Offline Validateforcedotcom/sf-skills1.1k—~2kAutomated safety check: PassApache-2.0
Review Rbrycewang-stanford/Auto-Empirical-Research-Skills4.5k—~1.3kAutomated safety check: PassCustom licence
Skill Doli Code ReviewDolibarr/dolibarr7.7k1 repos~1.1kAutomated safety check: PassMIT
Qt Cpp ReviewSerial-Studio/Serial-Studio7.2k—~4.3kAutomated safety check: PassCustom licence

Similar skills

  • Data Analysis

    brycewang-stanford/Auto-Empirical-Research-Skills

    End-to-end R data analysis for the sewage project. An agent skill from brycewang-stanford/Auto-Empirical-Research-Skills.

    4.5k GitHub stars~1.2k tokensUpdated 4 days ago
    Data & AnalyticsAuto-check: notes
  • Review a Lightning Web Component for mobile offline compatibility — the Komaci offline static analyzer that pre-primes the data graph for Salesforce Mobile App Plus and Field Service Mobile App.

    1.1k GitHub stars~2k tokensUpdated 2 days ago
    Sales & SupportAuto-check passed
  • Review R

    brycewang-stanford/Auto-Empirical-Research-Skills

    R code review for the sewage project. An agent skill from brycewang-stanford/Auto-Empirical-Research-Skills.

    4.5k GitHub stars~1.3k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Skill Doli Code Review

    Dolibarr/dolibarr

    Reviews Dolibarr PHP code for compliance with coding standards and security best practices, and fixes identified issues.

    7.7k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed
  • Qt Cpp Review

    Serial-Studio/Serial-Studio

    Qt6/C++ deep code review for Serial Studio. An agent skill from Serial-Studio/Serial-Studio.

    7.2k GitHub stars~4.3k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Qt Qml Review

    Serial-Studio/Serial-Studio

    Qt6/QML deep code review for Serial Studio. An agent skill from Serial-Studio/Serial-Studio.

    7.2k GitHub stars~3.7k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from polarsource/polar

All 17 skills in this repo
  • Polar Python SDK

    polarsource/polar

    Integrate Polar billing in server-side Python applications using the versioned Polar and PolarAsync clients.

    10k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Polar Typescript SDK

    polarsource/polar

    Integrate Polar billing in server-side TypeScript applications using the versioned createPolar and createPolarCore clients.

    10k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Adr Check

    polarsource/polar

    Check a code change against the repo's Accepted Architecture Decision Records (ADRs) in handbook/engineering/decisions/ and report violations with citations.

    10k GitHub stars~771 tokensUpdated today
    Auto-check passed
  • API Surface Review

    polarsource/polar

    Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs.

    10k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Interview Task

    polarsource/polar

    Prepare an interview task for a candidate, as part of our hiring process.

    10k GitHub stars~933 tokensUpdated today
    Auto-check passed
  • Open PR

    polarsource/polar

    Open or update a draft GitHub pull request after Polar-specific review and cubic CLI review.

    10k GitHub stars~586 tokensUpdated today
    Auto-check passed

Questions about Billing Review

What does Billing Review do?

Review a diff that touches Polar's billing domain — subscriptions, cycles and crons, orders, billing entries, meters and usage, discounts, checkout, payments and dunning, refunds, disputes, payouts…. Billing Review is an agent skill from polarsource/polar. Review a diff that touches Polar's billing domain — subscriptions, cycles and crons, orders, billing entries, meters and usage, discounts, checkout, payments and dunning, refunds, disputes, payouts, wallets, tax and invoices.

When should I use Billing Review?

Billing Review fits situations like: asks for a billing review; A reviewer needs the domain rules the team enforces in review but that no linter catches.

How do I install Billing Review in Claude Code?

Run `npx skills add polarsource/polar --skill billing-review -a claude-code`. Or copy the skill folder (.agents/skills/billing-review in polarsource/polar) into .claude/skills/billing-review in your project. Claude Code loads it when a task matches its description.

How do I install Billing Review in Codex?

Run `npx skills add polarsource/polar --skill billing-review -a codex`. Or copy the skill folder (.agents/skills/billing-review in polarsource/polar) into .agents/skills/billing-review in your project. Codex loads it when a task matches its description.

Can I use Billing Review in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add polarsource/polar --skill billing-review -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/billing-review, .gemini/skills/billing-review, .github/skills/billing-review and .opencode/skills/billing-review in your project.

What does Billing Review need to run?

SKILL.md names no scripts, command-line tools or credentials: Billing Review is instructions for the agent only.

Does Billing Review access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Billing Review safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Billing Review use?

Billing Review is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Billing Review use?

About 2.3k tokens (SKILL.md is roughly 9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Billing Review?

Skills that share tags, products or a category with Billing Review: Data Analysis (brycewang-stanford/Auto-Empirical-Research-Skills, 4.5k stars), Mobile Platform Offline Validate (forcedotcom/sf-skills, 1.1k stars), Review R (brycewang-stanford/Auto-Empirical-Research-Skills, 4.5k stars) and Skill Doli Code Review (Dolibarr/dolibarr, 7.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Billing Review?

polarsource (a GitHub organization) maintains it in polarsource/polar, which has 10,343 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 9, 2026.

Source: polarsource/polar on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.