ynab-db

A guide for querying a local SQLite database made from a YNAB account export. YNAB is a budgeting service, and SQLite is a file-based database that can be queried with SQL.

In plain words
What is it for?
Use it to query budgets, accounts, categories, payees, and transactions in ynab.db. It is also for writing SQL reports against the exported YNAB data.
Why use it?
It helps produce accurate spending, income, balance, and budget answers while avoiding deleted records and other common data mistakes. It also explains how to check whether the export needs refreshing.

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/rubick/ynab-sqlite-export/ynab-db
Any agent
npx skills add RuBiCK/ynab-sqlite-export --skill ynab-db
Clone the repo
git clone --depth 1 https://github.com/RuBiCK/ynab-sqlite-export

Made for: Claude Code, Codex.

Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,021 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.00061 $0.01021
Opus 5 $0.00030 $0.00511
Sonnet 5 $0.00012 $0.00204
Haiku 4.5 $0.00006 $0.00102

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

Security

Grade A, and why

ynab-db 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.

.claude/skills/ynab-db/SKILL.md · 80 lines

How it starts

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

Querying ynab.db

A local SQLite export of a YNAB account, produced by ynab_to_sqlite.py. Refresh it anytime with python3 ynab_to_sqlite.py (incremental, cheap); check staleness first: SELECT MAX(updated_at) FROM sync_state;

Schema in one look

budgets(id, name, last_modified_on, first_month, last_month, currency_iso, currency_symbol)
accounts(id, budget_id, name, type, on_budget, closed, balance, cleared_balance, uncleared_balance, last_reconciled_at, deleted)
category_groups(id, budget_id, name, hidden, deleted)
categories(id, budget_id, category_group_id, name, hidden, budgeted, activity, balance, goal_type, deleted)
payees(id, budget_id, name, transfer_account_id, deleted)
transactions(id, budget_id, account_id, date, amount, memo, cleared, approved, flag_color, payee_id, category_id, transfer_account_id, import_id, deleted)
subtransactions(id, transaction_id, amount, memo, payee_id, category_id, deleted)
sync_state(budget_id, resource, server_knowledge, updated_at)   -- internal, ignore for analysis

Rules that prevent wrong answers

  1. Always filter deleted = 0. Deletions are soft — deleted rows stay in every table with deleted = 1. Skipping this inflates all totals.
  2. Always scope by budget_id (or JOIN budgets and GROUP BY). One account often has several budgets; mixing them produces nonsense. List them first: SELECT id, name, currency_iso FROM budgets;
  3. Exclude transfers from income/spending math. A transfer between the user's own accounts has transfer_account_id IS NOT NULL and is not real income or spending — counting it double-counts money.
  4. Amounts are decimal currency units (already converted from YNAB milliunits): negative = outflow, positive = inflow.
  5. Income = inflows to the category named Inflow: Ready to Assign (a real row in categories). Don't treat every positive amount as income — refunds and transfers are also positive.
  6. Splits: a split transaction's own category_id may be NULL; its line items live in subtransactions. For per-category accuracy, take categorized rows from transactions where the id is NOT in subtransactions' parents, plus all subtransactions rows.
  7. category_id IS NULL + transfer_account_id IS NULL = genuinely uncategorized spending — report it as such rather than dropping it.
  8. Dates are TEXT YYYY-MM-DD — safe for lexicographic comparison and SQLite date functions (date('now','-3 months'), strftime).

Read the full file on GitHub · 80 lines

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 · 80 lines · 61 tokens per session scan A 6bdf7e572388

Subscribe to this mod's changes

ynab-db is a skill published in the GitHub repository RuBiCK/ynab-sqlite-export (10 stars, last pushed 1mo ago), licensed MIT. It adds 61 tokens to every session and 1,021 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

twitter-reader

Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…

himself65/finance-skills · 161 tokens

chenhao-limit-up

Use when evaluating A-share limit-up (涨停板) setups through Chen Hao's sentiment and momentum lens: market emotion cycles, board strength, follow-through, and short-term aggressive momentum trading.

questflowai/investorskills · 44 tokens

copy-trading-solana

Copy trade Solana wallets - mirror trades automatically.

alsk1992/CloddsBot · 15 tokens

southwest

Search Southwest Airlines fares and points pricing via Patchright browser automation. SW is not in any GDS or API. Covers all fare classes, Companion Pass value, and fare drop monitoring.

borski/travel-hacking-toolkit · 40 tokens

alpaca-trade-api-sdk

Integrate and build on the @alpacahq/alpaca-trade-api TypeScript SDK for the Alpaca Trading and Market Data APIs (the unified Alpaca client, ergonomic order builders, normalized market-data shapes, pagination, typed errors, resilience, and real-time streaming). Use when writing or reviewing code that imports…

alpacahq/alpaca-trade-api-js · 123 tokens

alphagbm-greeks

Greeks dashboard for any option contract or multi-leg position. Covers first-order Greeks (Delta, Gamma, Theta, Vega, Rho) and second-order Greeks (Charm, Vanna, Volga). Returns individual and position-level Greeks with scenario heatmaps. Use when: checking option sensitivities, managing position risk, understanding…

AlphaGBM/skills · 128 tokens