beancount-importer-author

Write and repair tested beangulp importers for bank CSV export formats.

275|32|Updated Oct 2, 2020
One-click install
npx skills add https://github.com/bex-co/beancount-io --skill beancount-importer-author-bex-co
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: beancount-importer-author
Source: https://github.com/bex-co/beancount-io/tree/main/skills/.claude/skills/beancount-importer-author
Command: npx skills add https://github.com/bex-co/beancount-io --skill beancount-importer-author-bex-co

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires beangulp, beancount, and includes references (resource) components.

What problem does it solve? Bank export formats differ across institutions and drift over time, and a subtly wrong beancount importer silently corrupts ledger data for months. This Skill authors or repairs a reusable beangulp importer from a sample export file and drives the golden-file test harness until it passes, so the importer is verified before it is handed over. ## Core Features & Use Cases - Importer authoring from samples: Drafts a csvbase-based importer (or raw beangulp.Importer for non-CSV formats) from a real bank export, with narrow header-signature identify() and deterministic import-id metadata for dedup compatibility. - Golden-file test loop: Generates golden .beancount files, walks the user through eyeballing rows against the raw sample, and iterates until the beangulp testing harness reports green — a red harness is never declared done. - Drift repair: When a bank changes its format, reproduces the failure, diagnoses the change, patches minimally, and keeps both old and new sample goldens passing. - Use Case: Your Chase checking CSV format changed and your importer broke. Provide the old and new samples; the Skill diagnoses the header rename, patches the column mapping, and verifies the harness passes on both format generations. ## Quick Start Ask the agent to write a beangulp importer for your bank's CSV export, providing a sample file and the target ledger account such as Assets:Bank:Checking.

Frequently Asked Questions about beancount-importer-author

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

FAQPage Schema
How do I write a beangulp importer for a bank CSV file?

Subclass beangulp.importers.csvbase.Importer with declarative column descriptors for date, narration, and amount, and implement a narrow identify() that matches the header signature rather than just the .csv extension. Add the beangulp.testing.main self-test CLI block so the importer file can generate and verify golden files.

How do I fix a beancount importer after my bank changed its CSV format?

Reproduce the failure by running identify or extract on a new sample file, then diagnose the drift such as renamed headers or date format changes. Patch minimally, add the new sample to the test corpus with an eyeballed golden, and keep the old samples' goldens passing so historical re-imports still work.

What is the difference between csvbase and a raw beangulp.Importer?

csvbase.Importer provides declarative column mapping for CSV files with less code and fewer bugs, while a raw beangulp.Importer subclass is needed for formats csvbase cannot express, such as OFX files, multi-table exports, or unusual encodings.

Does beangulp work with beancount 2.x?

No, beangulp is beancount-3-only. Users on beancount 2.x need the older beancount.ingest framework, which has a different API and should not be mixed with beangulp code.

Why does my beangulp test fail with KeyError: 'lineno'?

This happens when a metadata() override returns a dict containing only custom keys like import-id, dropping the filename and lineno keys beangulp's sorting requires. Build on data.new_metadata(filepath, lineno) and add your keys to it instead of replacing it.

Should a beancount importer assign expense categories to transactions?

No, an importer should post only the source-account leg and never hardcode guessed counter-accounts. Categorization belongs to downstream hooks like smart_importer's PredictPostings applied at the multi-importer runner layer.