find-negative-balance-users

Query ClickHouse for users whose intraday-corrected balance is currently negative.

7|12|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/OpenRouterTeam/docs --skill find-negative-balance-users-openrouterteam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: find-negative-balance-users
Source: https://github.com/OpenRouterTeam/docs/tree/main/.agents/skills/find-negative-balance-users
Command: npx skills add https://github.com/OpenRouterTeam/docs --skill find-negative-balance-users-openrouterteam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Daily balance snapshots in the analytics mart lag by a day or more, so raw balance queries miss recent top-ups and usage. This Skill runs the same intraday balance-correction logic as the negative-balance-usage-sync cron against ClickHouse, giving an accurate, current list of accounts in the red for fraud and ban investigations. ## Core Features & Use Cases - Live balance correction: Combines the daily dim_users.outstanding_balance snapshot with post-snapshot credits and minute-level usage to compute a current balance. - Cron-matched eligibility filters: Excludes deleted users, enterprise accounts, billed-in-arrears accounts, autobuy triggers, credit pools, and accounts allowed to go negative. - Fraud investigation support: Returns clerk user ID, corrected balance, email, and signup date ranked most-negative-first, with guidance for adding ring-evidence columns like signup IP hash, JA4, and ASN. - Use Case: A Trust & Safety analyst investigating a suspected abuse ring runs the query with a -10 USD threshold to pull all accounts currently more than $10 in the hole, then cross-references shared signals before filing ban-candidate suggestions. ## Quick Start Ask the assistant to run the negative balance query with a threshold of -10 and list the top 100 overspending accounts from ClickHouse.

Frequently Asked Questions about find-negative-balance-users

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

FAQPage Schema
How do I find users with a negative balance in ClickHouse?▼

Run the negative-balance-users.sql query against the ClickHouse HTTP endpoint with threshold and row_limit parameters. It corrects the daily balance snapshot with post-snapshot credits and usage, returning accounts ranked most negative first.

How is the live balance calculated from a daily snapshot?▼

The live balance equals the dim_users snapshot plus post-snapshot credits from stg_credits minus post-snapshot usage from user_activity_minute_v7. Credits count only from the day after balance_as_of_date, with lookback clamped to 3-30 days.

Which accounts are excluded from the negative balance query?▼

The query excludes deleted users, accounts with allow_negative_balance, non-zero negative_balance_limit, enterprise accounts, billed-in-arrears accounts, and those with active autobuy triggers or credit pools, matching the cron's eligibility filters.

Can a negative balance list alone justify banning accounts?▼

No, a negative balance is a lead, not proof of fraud. Ban decisions require at least three independent shared signals such as signup IP hash, JA4, and ASN, plus human review through the Sentinel ban-candidate workflow.

Why might the negative balance results be stale or inaccurate?▼

Results go stale if accounts top up after the query runs, and if the mart stalls over three days the usage correction stops looking back, hiding genuinely negative accounts. Check max(balance_as_of_date) freshness when numbers look off.