ワンクリックで
debug-rta
Diagnostic flowchart for debugging Ready to Assign (RTA) calculation discrepancies
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Diagnostic flowchart for debugging Ready to Assign (RTA) calculation discrepancies
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | debug-rta |
| description | Diagnostic flowchart for debugging Ready to Assign (RTA) calculation discrepancies |
Use this skill when RTA shows an incorrect value. See scripts/ for diagnostic SQL queries.
npm run db:debug-rta
This prints per-month income, assigned, and RTA for the last 12 months.
RTA(M) = Cash Balance (non-CC budget accounts, date ≤ today)
+ Positive CC Balances (cashback/overpayments)
− Sum of category Available (latest complete month, cumulative)
− Future Month Assigned (months > latestComplete AND ≤ M)
− Credit Overspending Correction
RTA is per-month — assignments beyond month M do NOT reduce M's RTA.
| Symptom | Likely Cause | Section |
|---|---|---|
| RTA is way too high (millions) | Ghost entry → wrong latest month | §A |
| RTA is slightly too high | Credit overspending not subtracted | §B |
| RTA is too low | Extra assignments, missing carryforward | §C |
| Wrong for one specific month | available propagation broken | §D |
| Past month shows negative RTA | Clamping not applied | §E |
A ghost entry (assigned=0, activity=0, available=0) in a future month causes MAX(month) to select that month. With only 1 entry, SumAvailable ≈ 0 → RTA = full cash balance.
Diagnose: Run queries 1–2 from scripts/diagnostic-queries.sql.
Fix: Delete ghost entries. The HAVING COUNT(*) >= 10 clause is the safety net.
Prevention: updateBudgetAssignment() must delete rows when all fields are zero.
CC spending overspent a category. The negative available reduced SumAvailable without reducing cash → inflated RTA.
Diagnose: Run query 3 from scripts/diagnostic-queries.sql. Check getCashOverspendingForMonth() classification.
Key: If ALL spending is from CC → credit overspending (subtract from RTA formula). If ANY from cash → cash overspending (does NOT inflate RTA).
Check 1 — Carryforward: When no budget_months row exists, computeCarryforward() must fetch available from the latest prior month. If broken → available = 0.
Check 2 — Future assigned: Is futureMonthAssigned including too many months? Run query 5 from scripts/diagnostic-queries.sql.
Check 3 — Propagation: Assignment delta not propagating to subsequent months.
The available column is cumulative: available(M) = available(M-1) + assigned(M) + activity(M).
Diagnose: Run query 4 from scripts/diagnostic-queries.sql for the affected category. Look for breaks in the chain.
Past months (month < current) should clamp negative RTA to $0.00 (grey banner). Only current and future months show negative RTA (red banner).
| File | Function | Purpose |
|---|---|---|
lib/engine/rta.ts | calculateRTA() | Pure RTA formula |
lib/engine/rta-breakdown.ts | calculateRTABreakdown() | RTA popup breakdown |
lib/repos/budget.ts | getReadyToAssign() | Orchestration |
lib/engine/overspending.ts | calculateCashOverspending() | Cash vs credit |
lib/engine/carryforward.ts | computeCarryforward() | Month rollover |
lib/engine/cc-payment.ts | calculateCCPaymentAvailable() | CC funded amount |
scripts/debug-rta.ts | CLI script | Per-month dump |
Every balance query MUST use AND date <= date('now'). Missing this filter causes future transactions to inflate balances.
Functions that need this filter:
getReadyToAssign() — cash + CC balanceupdateBudgetActivity() — category activityupdateCreditCardPaymentBudget() — CC spendingupdateAccountBalances() — account balancesgetReconciliationInfo() — cleared balance02-ready-to-assign-calculation.md — Full formula03-credit-card-rta-logic.md — CC interaction07-rta-overspending-edge-cases.md — Overspending, carryforward, ghost entriesGuide for writing Playwright E2E tests with the project's auth, helpers, and isolation patterns
MANDATORY for any git commit, push, save, subir, or enviar request. Executes npm run git:sync as a single atomic command — zero exploration, zero loops. Enforces Conventional Commits format.
End-to-end guide for adding a new feature across all architectural layers (schema → repo → schema → DTO → route → hook → component → tests)
Comprehensive code review framework for pull requests and ad-hoc quality checks. Covers correctness, architecture compliance, security, performance, financial logic, testing, and style. Use when reviewing PRs, auditing changes, or checking code quality before merge.
Creates new Antigravity skills following the correct folder structure, frontmatter conventions, and best practices. Use when the user asks to create a new skill, document a repeating pattern, or extend the agent's capabilities for a specific task.
Create distinctive, production-grade frontend interfaces with intentional aesthetics, high craft, and non-generic visual identity. Use when building or styling web UIs, components, pages, dashboards, or frontend applications.