SuperAPI AI Directory

reading-payment-statement

Office & productivity

View repository

Updated 10-15 20:07

About this skill

Payment Record Image Reading

A skill that reads images of payment records (payment records for remuneration, fees, contract money, and prizes) and returns them as structured data.

In the case of a PDF file

The 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 (payment amount, withholding tax amount, 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 (parallel 2 contexts)

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

  1. Perform two independent readings: In environments where subagents are available, launch two subagents in parallel and have each independently read the image. 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 (amounts, etc.) from both reading results.

  3. If they match: Adopt as is. Report that "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 environments 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 units). Remove commas and "円"
  • Return dates in YYYY-MM-DD format
  • Convert Japanese era years 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 passed, process all of them in order and return them together

Output Format

Read the image and return it in the following format:

---PAYMENT_STATEMENT_DATA---
payer_name: 支払者名
category: 区分(報酬/料金/契約金/賞金)
gross_amount: 支払金額(int)
withholding_tax: 源泉徴収税額(int)
---END---

Extraction Points

  • Extract the "Payment Amount" field with the highest priority
  • Accurately read the "Withholding Tax Amount" field
  • Extract the payer's name
  • Check the category (one of: remuneration, fees, contract money, prize money)
  • Check the title "Payment Record for Remuneration, Fees, Contract Money, and Prize Money"
  • If the information of the person receiving the payment (address and name) can also be read, include it for verification purposes

Processing Multiple Files

When multiple file paths are specified:

  1. Get 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
---PAYMENT_STATEMENT_DATA---
...
---END---

## file2.jpg
---PAYMENT_STATEMENT_DATA---
...
---END---