credit-metering

credit-metering is a skill for Claude Code from tushaarmehtaa/tushar-skills. It costs 42 tokens per session (635 once invoked), scanned A, original, MIT.

A skill for implementing or checking usage credits, where credits are consumable units an app spends on actions. It covers balances, reservations, spending, grants, purchases, expiry, refunds, limits, interface state, and an append-only transaction record.

In plain words
What is it for?
Use it when an app sells or grants credits, charges credits for actions, reserves them before work, refunds them, or needs an auditable history of changes.
Why use it?
It helps prevent incorrect balances, duplicate charges, overspending, and lost credit changes when usage is concurrent or retried.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the slashskills plugin — 34 skills shipped together

Good fit Use it when an app sells or grants credits, charges credits for actions, reserves them before work, refunds them, or needs an auditable history of changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tushaarmehtaa/tushar-skills/credit-metering
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tushaarmehtaa/tushar-skills --skill credit-metering
Clone the repo
git clone --depth 1 https://github.com/tushaarmehtaa/tushar-skills

Made for: Claude Code.

Or install slashskills, the plugin that ships this one along with the rest of its 34 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for credit-metering

README.md
[![agentmods](https://agentmods.dev/badge/skills/tushaarmehtaa/tushar-skills/credit-metering/github.svg)](https://agentmods.dev/skills/tushaarmehtaa/tushar-skills/credit-metering)
Your own site
<a href="https://agentmods.dev/skills/tushaarmehtaa/tushar-skills/credit-metering"><img src="https://agentmods.dev/badge/skills/tushaarmehtaa/tushar-skills/credit-metering/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for credit-metering

Your own site · 80×15
<a href="https://agentmods.dev/skills/tushaarmehtaa/tushar-skills/credit-metering"><img src="https://agentmods.dev/badge/skills/tushaarmehtaa/tushar-skills/credit-metering.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 635 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.00635
Opus 5 $0.00021 $0.00318
Sonnet 5 $0.00008 $0.00127
Haiku 4.5 $0.00004 $0.00064

Measured 12d ago against content hash 26295bcbc73a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

credit-metering scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

credit-metering/SKILL.md · 36 lines

How it starts

The opening of the file, as written. The whole thing — 36 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Credit metering

Build credits as a financial state machine. Preserve existing denominations, billing semantics, and provider integrations.

Workflow

  1. Inspect backend/runtime, database/ORM, auth and tenant keys, current balance/ledger fields, payment provider, usage paths, retries, queues, and frontend state.
  2. Infer existing costs, grants, and packs from code. Ask only for unresolved commercial policy: denomination, per-action or measured cost, free/recurring grants, expiration/rollover, refund/clawback behavior, and overspend/debt policy. Never default to a new payment provider when one exists.
  3. Read database schemas, then implement only the matching database variant. Do not treat PostgreSQL, MySQL/PlanetScale, Prisma providers, and MongoDB as interchangeable.
  4. Use an append-only ledger with a unique idempotency key/external event ID. Update cached balance and ledger in one database transaction, or derive balance from the ledger when scale permits. Enforce positive input amounts and the chosen non-negative/debt rule in the database.
  5. Implement explicit operations:
    • grant for signup, subscription, promotion, or admin credit;
    • reserve before costly/concurrent work;
    • capture after measured success;
    • release on cancellation/failure;
    • refund or reverse linked to the original transaction;
    • expire/rollover when credits have lifecycle rules.
  6. Authenticate and authorize from server context. Never accept balance, price, pack value, or user identity from the browser. Map a server-owned product/price ID to the credit amount.
  7. Read payment providers only for the detected provider. Verify raw-body signatures, durably deduplicate events, and retry transient failures. Acknowledge before processing only after a durable queue/inbox write.
  8. Make promotions atomic. Use a redemption table with a unique (promo_id, user_id) constraint when one redemption per user is intended; update global usage and grant credit in the same transaction.
  9. Treat the UI balance as a projection. Reconcile after responses, account switches, multi-tab updates, refunds, and webhook grants. Optimistic display must not authorize work.

Read the full file on GitHub · 36 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 36 lines · 42 tokens per session scan A 26295bcbc73a

Subscribe to this mod's changes

credit-metering is a skill published in the GitHub repository tushaarmehtaa/tushar-skills (11 stars, last pushed 3d ago), licensed MIT. It adds 42 tokens to every session and 635 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

x402

Set up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key. Two setups it works out up front — "just use it" (set up a wallet so you or Claude Code can run cloud browser tasks paid from the wallet — Claude writes and runs throwaway scripts, nothing…

browser-use/browser-use · 175 tokens

tushare

A Python interface for Tushare, a financial data service that provides market and company information for stocks, funds, futures, and digital assets. It returns queried data as pandas tables.

HKUDS/Vibe-Trading · 79 tokens

stripe-best-practices

Guides Stripe integration decisions across development and test environment planning (separate sandboxes vs the shared test mode sandbox), API selection (Checkout Sessions vs PaymentIntents), Connect platform setup (Accounts v2, controller properties), billing/subscriptions, tax and registrations (Stripe Tax…

stripe/ai · 161 tokens

pinme-uniwebpay

Use when generating, modifying, or reviewing PinMe Worker (Cloudflare Worker TypeScript) code that accepts payments through UniwebPay — payment links, products/prices, checkout sessions, payment status reads, refunds, subscriptions, or handling UniwebPay webhooks with @uniwebpay/sdk in a PinMe project.

glitternetwork/pinme · 71 tokens

erp-xpp

X++ code development lifecycle for Finance and Operations — scaffold models, author classes, custom services/APIs, and data entities, install matching SDKs, compile deployable packages, deploy packages, synchronize databases, and verify deployed artifacts. Use when the user explicitly requests creating, building…

microsoft/Dataverse-skills · 86 tokens

kalshi-api

Kalshi exchange mechanics — RSA-PSS auth, order schema, YES/NO orderbook convention, WebSocket, and endpoint surface. Market-type-agnostic shared layer for all Kalshi skills.

agiprolabs/claude-trading-skills · 44 tokens