billing-integrity

A checklist and audit guide for in-app purchases, subscriptions, and quota billing. It covers store verification, user entitlements, webhooks, reconciliation, and an append-only ledger, which is a record where entries are added rather than rewritten.

In plain words
What is it for?
Designing or auditing Google Play and App Store billing, server-side access checks, receipt validation, webhook monitoring, reconciliation polling, idempotent charges, migrations, and regression tests.
Why use it?
It addresses billing failures such as silently removing access, accepting invalid purchases, charging twice, losing store notifications, or granting permanent access by mistake.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/ezbuilder/code-brain/billing-integrity
Any agent
npx skills add ezBuilder/code-brain --skill billing-integrity
Clone the repo
git clone --depth 1 https://github.com/ezBuilder/code-brain

Made for: Claude Code, Codex.

Per session 130 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,918 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00130 $0.01918
Opus 5 $0.00065 $0.00959
Sonnet 5 $0.00026 $0.00384
Haiku 4.5 $0.00013 $0.00192

Measured 2d ago against content hash 38885b0b58fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

billing-integrity 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 2d 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.

kits/global-agent-kit/.claude/skills/billing-integrity/SKILL.md · 108 lines

How it starts

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

결제 무결성

결제는 실패해도 사용자가 항의하지 않는 방향으로 무너진다. 권한이 조용히 사라지거나, 검증이 조용히 통과하거나, 원장이 조용히 비어 있다. 그래서 "동작하는 것처럼 보이는 상태"가 가장 위험하다. 이 스킬은 실제 운영 사고에서 역산한 항목만 담는다.

핵심 원칙 6

  1. 조용한 실패 금지. 모든 실패 경로는 소리를 낸다(로그+운영자 알림).
  2. 권한은 회수보다 유지가 안전하다. 조회 실패·불확실 상태에서 절대 회수하지 않는다.
  3. 스토어 알림은 반드시 유실된다고 가정한다. 웹훅은 보조, 폴링이 진짜 원장이다.
  4. 모든 지급/차감은 멱등키를 가진다. 사용자 식별자를 키에 포함한다.
  5. 집행 판정은 서버가 사실 기반으로. 클라이언트 입력은 티어에 영향을 주지 못한다.
  6. 정상 판정은 폐쇄루프 증거로. HTTP 200이나 콘솔 저장 성공만으로 끝내지 않고, 스토어 테스트 알림이 인증된 전송 경로를 거쳐 운영 인박스에 도착하는지 확인한다.

언제 무엇을 하나

새로 결제를 붙일 때

이 순서를 지킨다. 2~4를 나중으로 미루면 반드시 사고로 돌아온다.

  1. 상품 카탈로그를 서버 단일 소스로 정의(productId, kind, 가격, 부여 게이트)
  2. 재검증용 원문 보관 설계 — 해시만 저장하면 나중에 복구가 불가능해진다
  3. 멱등키 설계 — 이벤트 append-only + 유니크 인덱스
  4. 리컨사일 폴링 — 웹훅보다 이게 원장이다
  5. 부팅 시크릿 검증 + 운영자 알림
  6. 웹훅 수신 + 인박스 + 미처리/무수신 감시
  7. 만료 앵커 불변식 + 결제 실패 유예 정책
  8. 티어·게이트 판정 서버화
  9. 구매 복원 + 판매중단 SKU 화이트리스트
  10. 웹훅 폐쇄루프 검증: topic + push 구독 + 인증 + 운영 인박스
  11. 레거시 재검증 토큰 보유율 측정 + 백필 계획
  12. 회귀 테스트: SKU kind 라우팅, 멱등 중복, 티어 폴백, 유예 판정
  13. 쿼터 정책 변경 시 저장된 운영 설정을 마이그레이션하거나 읽기 단계에서 정책 정규화
  14. 광고 단위의 콘솔 포맷과 SDK 로더 타입(Rewarded/Rewarded Interstitial)을 실기기에서 대조
  15. 양 스토어의 SKU 판매 상태와 스토어 설치 실기기 상품 조회를 각각 확인

상세는 references/playbook.md를 읽는다.

기존 결제를 감사할 때

references/audit.md의 절차를 따른다. 코드만 보지 말고 인프라 설정과 운영 데이터를 함께 확인해야 한다 — 코드가 완벽해도 웹훅 엔드포인트 설정이 죽어 있을 수 있다.

결제 사고가 났을 때

  1. 범위 파악 — 몇 명이 영향받았나. DB로 센다. 추측 금지.
  2. 권한 부여 방향으로 먼저 구제 — 회수는 나중에. 사용자 이탈이 가장 비싸다.
  3. 복구 스크립트는 멱등하게 — dry-run 기본, --apply 명시, 재실행 안전.
  4. 근본 원인을 코드 주석으로 박는다 — 다음 사람이 같은 함정에 빠지지 않게.
  5. 회귀 테스트 추가 — 사고는 재발한다. 테스트만이 막는다.
  6. 복구 입력은 추적 파일에 넣지 않는다 — 주문번호·토큰은 untracked 입력/표준입력으로 받고 로그는 요약만 남긴다.
  7. 고객 공지는 정책과 장애를 분리한다 — 기존 가격·광고·강제 전환 여부와 비공개 문의 경로를 명시한다.

즉시 확인용 체크리스트

작업 전 이 질문에 답할 수 없으면 먼저 확인한다.

  • 오늘 웹훅이 전부 죽으면 며칠 만에 알아차리는가? 자동 회복되는가?
  • 스토어 조회가 실패했을 때 사용자 권한이 회수되지는 않는가?
  • 같은 웹훅을 10번 재전송해도 지급이 1회인가?
  • 한 주문을 여러 계정이 공유할 때 전부 반영되는가?
  • 만료시각이 NULL인 활성 행이 지금 몇 건인가? (영구 무료 권한)
  • 판매 중단된 레거시 SKU 보유자의 한도가 무료로 떨어지지 않는가?
  • 결제 시크릿이 누락되면 부팅 시 큰 소리로 드러나는가?
  • 소모성/구독이 각각 올바른 스토어 엔드포인트로 가는가?
  • 스토어 테스트 알림이 운영 인박스까지 도착했는가?
  • topic만 있고 push 구독이 없거나, OIDC audience/email/IAM이 어긋나지 않았는가?
  • 기존 구독의 암호화 재검증 토큰 보유율과 백필 계획이 있는가?
  • /api/status의 HTTP 코드뿐 아니라 billing readiness 각 항목이 모두 true인가?
  • 기본 쿼터만 바꾸고 운영 DB의 구형 override가 남아 있지는 않은가?
  • AdMob 콘솔 광고 포맷과 앱 SDK 로더 클래스·테스트 광고 ID 포맷이 일치하는가?
  • App Store 신규 SKU가 판매 지역·심사 자료·제출 상태를 모두 갖췄는가?
  • Google Play 신규 SKU의 base plan이 활성이고, 스토어 설치본에서 상품 조회되는가?

Read the full file on GitHub · 108 lines

Files

What ships with it

3 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. 2d ago First seen · 108 lines · 130 tokens per session scan A 38885b0b58fb

Subscribe to this mod's changes

billing-integrity is a skill published in the GitHub repository ezBuilder/code-brain (11 stars, last pushed 2d ago), licensed Apache-2.0. It adds 130 tokens to every session and 1,918 once invoked, about $0.0006 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

kayba-stage-3-metrics

Define metrics from Kayba insights, implement them as Python measurement code, run against traces, and iterate until the metrics are clean and meaningful. Trigger when the user says "run stage 3", "define metrics", "build metrics", "compute baselines", or when invoked by the kayba-pipeline orchestrator. Requires…

kayba-ai/agentic-context-engine · 92 tokens

kayba-stage-4-rubric

Organize computed metrics into a tiered evaluation rubric with leading, lagging, and quality indicators. Trigger when the user says "run stage 4", "build rubric", "tier metrics", or when invoked by the kayba-pipeline orchestrator. Requires eval/baselinemetrics.json and eval/computebaselines.py to exist.

kayba-ai/agentic-context-engine · 77 tokens

kayba-stage-5-action-plan

Triage each insight into discard/code-fix/prompt-fix and produce a prioritized action plan with specific recommendations. Trigger when the user says "run stage 5", "make action plan", "triage skills", or when invoked by the kayba-pipeline orchestrator. Requires eval outputs from stages 1-4.

kayba-ai/agentic-context-engine · 74 tokens

kayba-stage-6-hitl

Human-In-The-Loop gate that presents the action plan with full context, collects an informed approval/modification/rejection decision, and records the outcome. Trigger when the user says "run stage 6", "HITL review", "approve action plan", or when invoked by the kayba-pipeline orchestrator. Requires eval/actionplan.md…

kayba-ai/agentic-context-engine · 87 tokens

kayba-stage-2-domain-context

Gather domain context about the repository and agent — system prompt, tool definitions, domain docs, and behavior patterns from traces. Trigger when the user says "run stage 2", "gather context", "domain context", or when invoked by the kayba-pipeline orchestrator.

kayba-ai/agentic-context-engine · 64 tokens

kayba-stage-7-fixer

Implement the approved fixes from the action plan and log all changes. Trigger when the user says "run stage 7", "implement fixes", "apply action plan", or when invoked by the kayba-pipeline orchestrator. Requires eval/actionplan.md to exist.

kayba-ai/agentic-context-engine · 61 tokens