agentleFS
ASNNetworksASNNetworks/floh-skills/skills/document-extraction/SKILL.md

document-extraction

Skill0 starsChanged 4 months agoMITView on GitHub

Pull structured data out of invoices, receipts, contracts and forms — PDF or scan — into a validated schema, with a confidence flag per field. Use when asked to read a document, extract invoice or receipt fields, digitise a stack of PDFs, or turn documents into rows.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. Happy-Technologies-LLC/happy-platform-skills★ 41same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository9 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    2. Totals that do not reconcile: Always check sum(lines) == subtotal and subtotal + sum(vat) == total.

    line 70
  2. Distinctive:

    4. Multi-page documents where the total is on page 3: Do not extract page 1 and stop.

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Document extraction

Turning a document into a row is easy. Turning it into a row you can post to a ledger without a human looking is the hard part, and it is entirely about knowing which fields you are unsure of.

When to use this

Reading invoices, receipts, purchase orders, contracts, packing slips or forms into structured data. Single file or a directory.

How to run it

  1. Get text out of the file first. Decide which kind of document you have:

    python3 scripts/extract.py detect invoice.pdf

    It reports text (a digital PDF with a real text layer), scan (images only, needs OCR), or mixed.

  2. Extract.

    python3 scripts/extract.py run invoice.pdf --schema invoice --json

    For a scan, the script shells out to pdftotext/tesseract when they are installed and tells you plainly when they are not. Do not silently return empty fields.

  3. Read the confidence block before the data block. Anything below the threshold is a field a human must confirm. Say so in your answer, by name.
  4. Never invent a missing field. A null with a reason beats a plausible guess, every time. This is the rule the whole skill exists for.

The schema

references/schemas.md holds the field sets. The invoice one, which covers most work:

FieldTypeNotes
invoice_numberstringAs printed. Do not normalise away prefixes
invoice_dateISO dateWatch DD/MM vs MM/DD — see below
due_dateISO date, nullOften expressed as "30 dagen" and must be computed
supplier.namestringThe party being paid
supplier.vat_numberstring, nullValidate the country prefix and length
supplier.ibanstring, nullChecksum it
customer.namestring
lines[]arraydescription, quantity, unit_price, line_total
subtotaldecimal
vat[]arrayrate + amount per rate. Multiple rates are normal
totaldecimal
currencyISO 4217Infer from the symbol only when it is unambiguous

The four mistakes that cost real money

1. Date order. 03/04/2026 is 3 April in the Netherlands and 4 March in the US. Do not guess from the number alone. Resolve it from: an explicit month name elsewhere in the document, the supplier's country, or another date in the same document where the day exceeds 12. If none of those settle it, return the raw string and flag it. A silently wrong invoice date lands the payment in the wrong quarter.

2. Totals that do not reconcile. Always check sum(lines) == subtotal and subtotal + sum(vat) == total. When it does not add up, the extraction is wrong, not the invoice. Report the discrepancy rather than the numbers.

3. Credit notes read as invoices. A negative total, or the words "creditnota" / "credit note", flips the sign of the whole document. Booking one as a payable is a real error with a real cost.

4. Multi-page documents where the total is on page 3. Do not extract page 1 and stop. Concatenate first, extract second.

Reporting

invoice.pdf → invoice
  ✓ invoice_number  2026-0417
  ✓ total           1.234,56 EUR
  ✓ reconciles      lines 1.020,30 + btw 214,26 = 1.234,56
  ⚠ due_date        null — "betaling binnen 30 dagen" found, but no invoice_date
                    to compute from. Needs a human.

Files

  • scripts/extract.py — detection, text extraction, field parsing, reconciliation.
  • references/schemas.md — the field sets for invoice, receipt, contract and packing slip.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.