SuperAPI AI Directory

reading-receipt

General & other

View repository

Updated 10-15 20:04

About this skill

Receipt / Invoice / Hometown Tax Donation Receipt Certificate Image Reading

A skill that reads images of receipts, invoices, and hometown tax donation receipt certificates and returns them as structured data.

In the case of a PDF file

File is PDF (.pdf), attempt text extraction before image OCR.

  1. shinkoku pdf extract-text --file-path <path> Run
  2. If the extracted text contains the necessary information (amount, date, store name, etc.), generate structured data from the text
  3. If the text is insufficient (scanned PDF, etc.), shinkoku pdf to-image --file-path <path> --output-dir <dir> convert to PNG with and proceed to the following image reading flow

Image Reading Method

Recommended: Dual verification (2 parallel contexts)

To improve accuracy, read the same image in two independent contexts in parallel and cross-check the results.

  1. Run two independent readings: In an environment where subagents are available, launch two subagents in parallel and have each read the image independently. Pass the following "Basic Rules" and "Output Format" to each subagent as a prompt, and specify the image file path.

  2. Result cross-check: Compare the main fields (amount, etc.) from both reading results.

  3. If they match: Adopt as is. Report "The results matched in two independent readings."

  4. If they do not match: Present the original image path and both results to the user and have them select the correct one:

    • Clearly indicate the fields with discrepancies
    • Present three options: Adopt A / Adopt B / Manual input

Fallback (when subagents are not supported)

In an environment where subagents are unavailable, read using the following procedure:

  1. Read the image file directly with the Read tool
  2. Extract data according to the following "Basic Rules" and "Output Format"
  3. Present the extraction results to the user andalways request visual confirmation

⚠ Since dual verification is unavailable, always request visual confirmation from the user.

Basic Rules

  • Read image files with the Read tool (Claude Vision automatically recognizes images)
  • Always return amounts as int (integer in yen). Remove commas and "円"
  • Return dates in YYYY-MM-DD format
  • Convert Japanese era names to Western years (Reiwa 7 → 2025, Reiwa 6 → 2024, Heisei 31 → 2019)
  • For fields that cannot be read, use UNKNOWN (string) or 0 (amount)
  • If multiple files are provided, process all of them in order and return the results together

Output format

For receipts

Read the image and return it in the following format:

---RECEIPT_DATA---
date: YYYY-MM-DD
vendor: 店舗名
total_amount: 金額(int)
tax_included: true/false
items:
  - name: 品目名
    amount: 金額(int)
    quantity: 数量(int)
---END---

For hometown tax donation receipt certificates

Read the image and return it in the following format:

---FURUSATO_RECEIPT_DATA---
municipality_name: 自治体名(市区町村名)
prefecture: 都道府県名
amount: 寄附金額(int)
date: YYYY-MM-DD
receipt_number: 受領証明書番号(記載がなければ UNKNOWN)
---END---

Extraction points

Receipts

  • Extract the total amount (tax included) with the highest priority
  • Check the distinction between tax-included and tax-excluded (the notation of "tax included" or "tax excluded")
  • Extract line items to the extent they can be read (if unknown, leave items empty)
  • Extract the store name from the logo or name at the top of the receipt
  • Use the transaction date on the receipt for the date (not the issue date)

Hometown tax donation receipt certificate

  • Check the title "Donation Receipt Certificate"
  • Extract the official name of the municipality, such as "XX City", "XX Town", "XX Village", etc.
  • The prefecture name is often written before the municipality name
  • Extract the donation amount from the "Amount" or "Donation Amount" field
  • Use the date the donation was received (receipt date) for the date
  • Extract the receipt certificate number from entries such as "No. XX"

Processing multiple files

When multiple file paths are specified, or when a file list is obtained with a Glob pattern:

  1. Obtain the file list with the Glob tool (when a pattern is specified)
  2. Read each file in order with the Read tool
  3. Return the results of all files together (write the file name before each result)
## file1.jpg
---RECEIPT_DATA---
...
---END---

## file2.jpg
---RECEIPT_DATA---
...
---END---